Reputation: 23
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?
Upvotes: 2
Views: 172
Reputation: 132
use a python3 or python keyword before
os.system("sudo python3 {}".format(path))
or:
os.system(f"sudo python3 {path}")
Upvotes: 1