Shutil.move() and Permission denied error

Hello,

I need some help using shutil.move() to move some files from the local drive (Ignition Gateway) but I get the following error:

IOError: [Errno 13] Permission denied: 'D:\AO001.dat'

I try to run the script in the desinger Vision on the same computer as the gateway.

Thanks for any help

Are you running this script in gateway scope or designer scope (i.e. Designer script console)? Either way you’ll need to validate filesystem permissions–if this is in a gateway event script, the user account that is running the Ignition gateway will need read/write/modify permissions against that file/parent folder.

In both. I test read/write permission for user that run ignition gateway.
The interesting thing is the os.remove() is working in both scope but Shutil.move() doesn’t work for me.
Is there any other lib for moving the file in Jython?

It looks like if it is on the same filesystem, you could try os.rename():

1 Like

Additionally, you could look towards the Java side of things, something like:

# Move the thing
from java.nio.file import Path, Files, StandardCopyOption
src_path = Path.of('/usr/local/bin/ignition/foo')  # foo is a folder
dst_path = Path.of('/usr/local/bin/ignition/baz')
Files.move(src_path, dst_path, StandardCopyOption.ATOMIC_MOVE)
1 Like