2

I have a TKinter script that lets the user choose from a list of existing scripts, input the variables that particular script requires, and then passes the variables to that script to be run. When all files are stored locally it goes off without a hitch. Once I tried to move it onto the network, so that colleagues can use it, it stopped executing the script.

There is no error message, just nothing happens. For troubleshooting simplicity I wrote a simple script that just calls a second script that prints "success", and the same issue happens where the simple scripts work locally, but not when stored on the network.

Script1.py:

import os
path=r'G:/files/Script2.py'
os.system(path)

Script2.py:

print("success")

No error messages, and if I try os.path.exists(path) it returns "True".

os.system(path) returns no errors even when the path is known to be incorrect.

If I do try open(path) for a path that is actually incorrect I get: FileNotFoundError: [Errno 2] No such file or directory.

I also tried setting path equal to the global drive name instead of G, using the IP address, changing the direction of the slashes, putting in double slashes after G:, and not using r''. Everything gives me the same result.

I also tried using path=os.getcwd()+"//Script2.py" since currently the files are all in the same folder on the network, again no success.

I am currently accessing the network through a VPN from home.

From googling I came up with these, but couldn't get a solution from them either:

Accessing a network folder through a python program Using Python, how can I access a shared folder on windows network?

1 Answer 1

1

use a python3 or python keyword before

os.system("sudo python3 {}".format(path))

or:

os.system(f"sudo python3 {path}")
Sign up to request clarification or add additional context in comments.

3 Comments

this will set the system interpreter as python.
Thanks for the suggestion. Unfortunately that didn't change anything when I ran it on the network.
you can use chdir() first to move into the network drive: and then run python3 script2.py there in cmd

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.