# [ python-Bugs-1745533 ] Filename providing cross platform capability

Sun Jul 1 11:05:16 CEST 2007

Bugs item #1745533, was opened at 2007-06-29 23:05
Message generated for change (Settings changed) made by loewis
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1745533&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Documentation
Group: Python 2.4
>Status: Closed
>Resolution: Invalid
Priority: 5
Private: No
Submitted By: Damian (atagar)
Assigned to: Nobody/Anonymous (nobody)
Summary: Filename providing cross platform capability

Initial Comment:
The help section for the open method should note that a Unix style filename work in a cross platform fashion (like Java). After scouring several resources including two O'Reilly texts on Python, a dozen web pages, all reliant help pages, I finally got my answer from a mailing list. -Damian

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2007-07-01 10:34

Message:
Logged In: YES
user_id=21627
Originator: NO

I think that's what Damian says, but it's partially wrong. Python has not
taken any specific effort to make / work on all systems; it just happens to
work on Windows as well. However, it does so only in a limited manner: you
still might need to specify drive letters, and you cannot easily pass a
file name with forward slashes to an external program, as that may mistake
the slashes as command line options.

----------------------------------------------------------------------

Comment By: Damian (atagar)
Date: 2007-06-30 23:48

Message:
Logged In: YES
user_id=1613266
Originator: YES

No, I'm talking about the documentation when entering help(file) or
help(open). The filename parameter works in a cross platform fashion when
given a Unix path. For instance,
file = open("/path/to/content.xml", "r") # Cross platform
file = open("\\path\\to\\content.xml", "r") # Win32 only
This seemed to be an undocumented yet important detail (unless I'm
mistaken it means its advantageous to always use the former method when
coding paths). However, looking around some more I think this is largely a
misunderstanding on my part in terms of where the cross platform capability
came from (Windows accepting a forward slash rather than the open method
translating the path for the current OS). Sorry about the confusion.

----------------------------------------------------------------------

Comment By: Damian (atagar)
Date: 2007-06-30 23:38

Message:
Logged In: YES
user_id=1613266
Originator: YES

No, I'm talking about the documentation when entering help(file) or
help(open). The filename parameter works in a cross platform fashion when
given a Unix path. For instance,
file = open("/path/to/content.xml", "r") # Cross platform
file = open("\\path\\to\\content.xml", "r") # Win32 only
This seemed to be an undocumented yet important detail (unless I'm
mistaken it means its advantageous to always use the former method when
coding paths). However, looking around some more I think this is largely a
misunderstanding on my part in terms of where the cross platform capability
came from (Windows accepting a forward slash rather than the open method
translating the path for the current OS). Sorry about the confusion.

----------------------------------------------------------------------

Comment By: O.R.Senthil Kumaran (orsenthil)
Date: 2007-06-30 14:24

Message:
Logged In: YES
user_id=942711
Originator: NO

I am not getting as what you are indicating Damian. You mean to say use
'/' forward slashes in all documentation as they can work cross platform?

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1745533&group_id=5470