UNC paths in file object open

Cary Coulter Cary_Coulter at hotmail.com
Fri Mar 12 21:35:34 EST 2004


works like a champ.

using
        '//server/share'
        '\\\\server\share'
        r'\\server\share'

C:\Documents and Settings\cary>python
ActivePython 2.3.2 Build 231 (ActiveState Corp.) based on
Python 2.3.2 (#49, Nov  6 2003, 10:18:20) [MSC v.1200 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.listdir('//pollux/hdc1')
['public', 'archive', 'store']
>>> os.listdir('\\\\pollux\\hdc1')
['public', 'archive', 'store']
>>> os.listdir(r'\\pollux\hdc1')
['public', 'archive', 'store']
>>>


BTW, thanks.  I hadn't thought of using UNCs




"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