Error in copy file

Hello,

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\shutil.py", line 96, in copy2
    copyfile(src, dst)
  File "user-lib\pylib\shutil.py", 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?

Thanks
Andrea

Read through this old topic.
Tag events run in the gateway, not in the designer or client, so you must have the network shares and permissions set up for the Ignition Service itself.