UNC paths in file object open
Larry Bates
lbates at swamisoft.com
Fri Mar 12 12:57:49 EST 2004
Graham,
path=r"\\servername\sharr\folder\file.ext"
works on my machine (I use it all the time).
Remember that backslash is an "escape" character so
you must us r"<path>" or double the number of backslashes
without the "r":
path="\\\\servername\\share\\folder\\file.ext"
-Larry Bates
"Graham" <gsmith at oxfam.org.uk> wrote in message
news:4051f619$0$6547$ed9e5944 at reading.news.pipex.net...
> 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
>
>
>
More information about the Python-list
mailing list