Can't access file on remote server with os.startfile

Viewed 284

I am trying to access a test text file on a server with the command os.startfile but I can't seem to make it work. I know it only fails because the text file is on the server and not on the computer but I have no idea how to access it.

Here's my code :

from os import startfile
path = "//10.2.30.61/c$/Qlikview_Tropal/Raport/test1.txt"
startfile("//10.00.00.00/c$/test/test1/test1.txt")

And I get this error : FileNotFoundError: [WinError 2]. I am on windows by the way.

Update_1 : I tried the enter os.startfile(os.path.normpath()) and i get this error : "filenotfounderror winerror 53 the network path was not found"

Thank you !!

1 Answers

You can do

from os import start file


#put two \\ to get one \
path = "\\\\10.2.30.61\\c$\\Qlikview_Tropal\\Raport\\test1.txt"
startfile(r"\\10.00.00.00\c$\test\test1\test1.txt")

https://stackoverflow.com/a/43205543/14579156

Related