Re: cross platform accessing paths (windows, linux ...)

2009-03-13 Thread David Smith
Vlastimil Brom wrote: > 2009/3/13 hendra kusuma : >> you may want to use os.sep to replace manually written "/" "\" ":" for each >> os >> I heard that unix/linux use "/" as directory separator while windows use "\" >> and mac os use ":" >> > Thanks for the notice about the ":" path separator on mac

Re: cross platform accessing paths (windows, linux ...)

2009-03-13 Thread Vlastimil Brom
2009/3/13 hendra kusuma : > you may want to use os.sep to replace manually written "/" "\" ":" for each > os > I heard that unix/linux use "/" as directory separator while windows use "\" > and mac os use ":" > Thanks for the notice about the ":" path separator on mac; windows uses "\" but normally

Re: cross platform accessing paths (windows, linux ...)

2009-03-12 Thread Vlastimil Brom
2009/3/12 Christian Heimes : > Vlastimil Brom wrote: >> def path_from_pardir(path): >>     return >> os.path.realpath(os.path.normpath(os.path.join(os.path.dirname(__file__), >> os.pardir, path))) >> #  __file__ is substituted with sys.path[0] if not present >> >> real_path = path_from_pardir("txt

Re: cross platform accessing paths (windows, linux ...)

2009-03-12 Thread Christian Heimes
Vlastimil Brom wrote: > def path_from_pardir(path): > return > os.path.realpath(os.path.normpath(os.path.join(os.path.dirname(__file__), > os.pardir, path))) > # __file__ is substituted with sys.path[0] if not present > > real_path = path_from_pardir("txt/text_1.txt") > > The above seems to

Re: cross platform accessing paths (windows, linux ...)

2009-03-12 Thread Vlastimil Brom
> On Thu, Mar 12, 2009 at 8:10 AM, Vlastimil Brom > wrote: >> >> Hi all, >> I'd like to ask for some advice on how to acomplish file access in a >> cross platform way. >> ... >> Any hints or comments are much appreciated; thanks in advance! >> >> regards, >>   Vlasta 2009/3/12 Mike Mazurek : > Y

Re: cross platform accessing paths (windows, linux ...)

2009-03-12 Thread Mike Mazurek
You might want to look at the path module: http://pypi.python.org/pypi/path.py/2.2 It will probably make your code more readable. On Thu, Mar 12, 2009 at 8:10 AM, Vlastimil Brom wrote: > Hi all, > I'd like to ask for some advice on how to acomplish file access in a > cross platform way. > My ap

cross platform accessing paths (windows, linux ...)

2009-03-12 Thread Vlastimil Brom
Hi all, I'd like to ask for some advice on how to acomplish file access in a cross platform way. My application is a kind of viewer of text and corresponding image files (stored in separate subdirectories) and I'm going to deploy it as binaries for windows and source files (again in separate direct