How to open a remote file using python.

Chris Rebert clp2 at rebertia.com
Mon Feb 23 05:21:43 CET 2009


On Sun, Feb 22, 2009 at 8:13 PM, venutaurus539 at gmail.com
<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.

That function and class are be for retrieving materials over the web
(typically HTTP/FTP); however, your path suggests you're trying to
access a file over a local Windows network, so those aren't
appropriate. The regular open() function would have a better chance of
working for this. Have you tried it?

Cheers,
Chris

-- 
Follow the path of the Iguana...
http://rebertia.com



More information about the Python-list mailing list