Gateway scripts cannot access to mapped drives

Hello, I have a script ready to run on the gateway, but i got an error when trying to access the mapped drive on my pc.
The gateway and the mapped drive are not running on the same machine. And i don't have access to the machine where the gateway is running.
Any help to resolve this issue ??

You will need to Map the network drive in a way that the Gateway service can access it.

See here:
https://docs.inductiveautomation.com/display/DOC81/Mapping+a+Network+Drive

You will need to get in touch with someone who does have access, otherwise, you will need to reconsider your approach.

Considering i will be able to have access to the machine where the gateway is running. What's the approch to have to solve the problem ?

Did you read the linked white paper? I has instructions for modifying your ignition.conf file so that the service starts up with mapped drives. Do note the inherent problem that occurs if a mapped drive is not available at the service startup time. Consider not using mapped drives in your script/application, but UNC paths instead. If you do that, and the Ignition service runs as a user with privileges, there is no startup problem.

2 Likes

Correct me if I'm mistaken, the only thing to do is follow the steps explained in this topic : Mapping a Network Drive - Ignition User Manual 8.0 - Ignition Documentation

Is that it ? Or shoud I do Something more ??

Yes and no. That is the simple solution, but it is not robust. If a network share is not available when Ignition starts up, that mapped drive letter will not be available later. It doesn't fix itself.

The proper answer is to not use mapped drives. AT ALL. Use UNC paths directly to the network resource wherever you would have used a mapped drive. For this to work properly, you need to change the user account under which Ignition runs to an account that has the necessary privileges on your network. The default account (LOCALSYSTEM) has no network privileges.

Using this approach also avoids putting user/password combinations into your configuration file.

(BTW, you linked to the old v8.0 documentation. It should be this link.)

1 Like

I am having a similar issue. I have changed the script to use r'\path\folder'. and still get the directory does not exist. I am no longer attempting to use a mapped folder. I am logged into the system that serves the gateway and the script works in script console. However, when I attempt to run it using "Gateway Timer" it doesn't. I have logged the user and confirmed that the Timer script is calling the same user as script console. Any suggestions would be greatly appreciated.

@Rashad_Reynolds

This snip of script works for me to read a list of pdf file names in a folder of a network drive. Not sure if it's helpful for you or not.

    import os
    
    folder_path = r"\\san\drive\folder"
    
    pdf_files = [f for f in os.listdir(folder_path) if f.endswith('.pdf')]

Without seeing at least an example of your script, it's hard for anyone to offer any help or suggestions.

And welcome to the forums!