os.join Windows action

Colin J. Williams cjw at sympatico.ca
Sat Mar 5 10:55:05 EST 2005


I am puzzled by the Windows XP usage below:

    C:\Python23\Lib\site-packages\PyMatrix>c:python23\python
    The system cannot find the path specified.

    C:\Python23\Lib\site-packages\PyMatrix>c:python23\python.exe
    The system cannot find the path specified.

    C:\Python23\Lib\site-packages\PyMatrix>c:\python23\python.exe
    Python 2.3.5 (#62, Feb  8 2005, 16:23:02) [MSC v.1200 32 bit
    (Intel)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
     >>> ^Z

    C:\Python23\Lib\site-packages\PyMatrix>c:\python23\python
    Python 2.3.5 (#62, Feb  8 2005, 16:23:02) [MSC v.1200 32 bit
    (Intel)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
     >>>

C:\XXX is required, C:XXX is not acceptable.

The os.path.join doc has:

    *join*( 	path1[, path2[, ...]])

        Joins one or more path components intelligently. If any
        component is an absolute path, all previous components are
        thrown away, and joining continues. The return value is the
        concatenation of path1, and optionally path2, etc., with exactly
        one directory separator (|os.sep|) inserted between components,
        unless path2 is empty. Note that on Windows, since there is a
        current directory for each drive, os.path.join("c:", "foo")
        represents a path relative to the current directory on drive C:
        (c:foo), not c:\\foo.

How should os.path.join('C:', 'ugh')  be treated?

Colin W.







More information about the Python-list mailing list