How to open a remote file using python.
MRAB
google at mrabarnett.plus.com
Sun Feb 22 23:25:13 EST 2009
venutaurus539 at gmail.com wrote:
> Hello all,
> I am writing an application where I need to open a shared
> file on a remote machine using python script. I tried using the
> following function:
>
> f = urllib.open("\\remote_machine\\folder1\\file1.doc")
>
> I also tried using
>
> class urllib.FancyURLopener(...)
>
> but didn't work. Can some one help me in this regard.
>
What do you mean by "remote machine"? Do you mean you want to open a
file that's in a shared folder on a machine that's on the same local
network?
If it's meant to be a Windows filepath then it should be:
f = open(r"\\remote_machine\folder1\file1.doc")
(If the file is a Microsoft Word document file, then you won't probably
be able to make much sense of its contents using open().)
More information about the Python-list
mailing list