# Error in copy file phyton script

**URL:** <https://forum.inductiveautomation.com/t/error-in-copy-file-phyton-script/12548>\
**Category:** Ignition\
**Created:** [January 11, 2017, 5:34pm UTC](https://forum.inductiveautomation.com/t/error-in-copy-file-phyton-script/12548 "2017-01-11T17:34:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrea.montresor](https://avatars.discourse-cdn.com/v4/letter/a/5f9b8f/32.png) [@andrea.montresor](https://forum.inductiveautomation.com/u/andrea.montresor)\
**Post date:** [January 11, 2017, 5:34pm UTC](https://forum.inductiveautomation.com/t/error-in-copy-file-phyton-script/12548/1 "2017-01-11T17:34:43Z")

</div>

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:

```auto
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:

```auto
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

---

<div class="post-metadata">

**Author:** ![adam.morales](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/adam.morales/32/3405_2.png) [@adam.morales](https://forum.inductiveautomation.com/u/adam.morales)\
**Post date:** [February 8, 2017, 11:34pm UTC](https://forum.inductiveautomation.com/t/error-in-copy-file-phyton-script/12548/2 "2017-02-08T23:34:28Z")

</div>

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.
