Yes, if you are normal Windows shared files, you should be using normal file
access functions. But your file name is incorrectly formatted. The name of
the remote computer must have TWO leading backslashes, which is Windows' cue
that you want a remote file.

Python will convert forward slashes ("/") into the backslashes ("\") which
windows requires, so you can do it three different ways.  You can:

1) use slashes, and let python convert:
>>> f=open("//remote_machine/folder1/file1.doc", "r")

2) use backslash escapes doubled, so you type four to get two:
>>> f=open("\\\\remote_machine\\folder1\\file1.doc", "r")

3) use a python "raw" string which eliminates backslash escapes entirely so
that you can type the string as windows will see it (note the letter "r"
before first quote):
>>> f=open( r"\\remote_machine\folder1\file1.doc", "r")
--
Vernon Cole

On Sun, Feb 22, 2009 at 11:43 PM, Gerdus van Zyl <gerdusvan...@gmail.com>wrote:

> Try using the normal file access functions, eg: open("file","r"), etc.
>
> ~G
>
> On Mon, Feb 23, 2009 at 6:14 AM, venu madhav <venutaurus...@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. Thank you in advance, Venu
> >
> > _______________________________________________
> > python-win32 mailing list
> > python-win32@python.org
> > http://mail.python.org/mailman/listinfo/python-win32
> >
> >
> _______________________________________________
> python-win32 mailing list
> python-win32@python.org
> http://mail.python.org/mailman/listinfo/python-win32
>
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to