UNC paths in file object open

Peter Kropf pkropf at legato.com
Fri Mar 12 13:06:51 EST 2004


You need a few more \'s:

d:\>python
Python 2.3.2 (#49, Oct  2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> f = open( '\\centipede\space\gandalf.zip', 'r' )
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
IOError: [Errno 2] No such file or directory:
'\\centipede\\space\\gandalf.zip'
>>> f = open( '\\\\centipede\\space\\gandalf.zip', 'r' )
>>>

- Peter



> -----Original Message-----
> From: Graham [mailto:gsmith at oxfam.org.uk] 
> Sent: Friday, March 12, 2004 9:41 AM
> To: python-list at python.org
> Subject: UNC paths in file object open
> 
> 
> I ma trying to open a file on a network share
> 
> ie \\servername\share\folder\file
> 
> afile = open( \\server\share\folder\file, "r" )
> 
> have also tried
> afile = open( //server/share/folder/file, "r" ) # as per the 
> Python cookbook advice on page 113 namely " use / regardless 
> of the proclivities of the underlying operating system".
> 
> Neither work.
> 
> I am running python on XP and accessing win 2000 share.
> 
> Thanks for any help
> 
> Graham Smith
> 
> PeopleSoft Technical Team Leader
> OXFAM GB
> +44 (1865) 313255
> gsmith at oxfam.org.uk
> 
> 
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20040312/8e2bf292/attachment.html>


More information about the Python-list mailing list