Cross-platform file paths

Tim Roberts timr at probo.com
Sat May 8 22:47:33 EDT 2010


utabintarbo <utabintarbo at gmail.com> wrote:
>
>Until now, I have used the UNC under Windows (XP) to allow my program
>to access files located on a Samba-equipped *nix box (eg.
>os.path.normpath(r"\\serverFQDN\sharename\dir\filename")). When I try
>to open this file under Linux (Red Hat 5), I get a file not found
>error.
>
>Is there a cross-platform method for accessing files on a network
>share using Python 2.X?

No.  On Linux, you need to mount the share in some empty directory (using
mount or smbmount), then read the files from that directory.

It's kind of odd to use a Windows network protocol to access a Linux file
system from another Linux machine.
-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-list mailing list