Error in copy file phyton script


I tried to run a script to copy some files from a directory to a ftp path.
I tried this script in the “Interactive Script Tester” and it works:

import shutil, os, datetime, sys, traceback, binascii
shutil.copy2("D:\\SharedFolderSCADA\\2017\\01\\10\\Buffer - Belt 1 - 2017-01-10_10-34-59.dat","\\\TEST_FOLDER\\SharedFolderEVO\\2017-01-10\\Buffer - Belt 1 - 2017-01-10_10-34-59.dat")

This script copy the file from the folder in SCADA pc to the ftp path correctly.

When I try to put this script in a value changed of one tag, I have this error about the permission:

File "user-lib\pylib\", line 96, in copy2
    copyfile(src, dst)
  File "user-lib\pylib\", line 52, in copyfile
    fdst = open(dst, 'wb')
IOError: [Errno 13] Permission denied: '\\\\TEST_FOLDER\\SharedFolderEVO\\2017-01-10\\Buffer - Belt 1 - 2017-01-10_10-34-59.dat'

I think is a permission in a value change or something like this, but I don’t know how to solve. The script works in the tester script of the designer, but not works in the value change.
I have to run this script periodically, every 5 minutes.

Could you please help me?


The main difference between running the script in the designer and running it on a tag’s value changed script is that the latter will run on the gateway. This means that the script runs in a different scope and, in most cases, this also means that the script is run on an entirely different machine.

In any case, the Ignition service itself is normally run under the SYSTEM profile, rather than the user profile, which will generally run designers and clients. This is the most likely cause of the permissions issue.