0

I am trying to run a python file 'app.py' that is in my network path folder and print the result of whether it is running successfully or not. This is my code

import os

filepath = '\\\\server\folder'
os.chdir(filepath)
str=('app.py')
p=os.system(str)
print(p)

However this gives me the following error:

'\\server\folder'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported.  Defaulting to Windows directory.
'app.py' is not recognized as an internal or external command,
operable program or batch file.

Can I not change my directory to network path?? Then how can I execuate the file from my network folder? Thanks!

Sally
  • 87
  • 2
  • 10

1 Answers1

0

Have you tried the solution from a similar or duplicated question?

How can I access a shared folder on windows network?

The first response gives the following code:

Use forward slashes to specify the UNC Path:

open('//HOST/share/path/to/file')
Alex_P
  • 2,580
  • 3
  • 22
  • 37