Re: os.join Windows action
Michael Hoffman wrote: > Colin J. Williams wrote: > > > C:\XXX is required, C:XXX is not acceptable. > > C:XXX is acceptable, it just means something entirely different from > C:\XXX. There is a current working directory on each drive. C:XXX is > file XXX in the current directory on drive C:. Further notes for Colin: On *x, /xxx is the xxx file in the root directory and xxx is the xxx file in the current directory. Same perceived problem. This is not a new feature in Windows XP; it has been as Michael described ever since directories were introduced in MS-DOS 2.0. And of course it applies to all file paths, irrespective of whether you want to execute / read /write / etc. As a matter of interest, do you normally run python with "site-packages" as the current directory? Most folk would not do that, with any software package, preferring the installed software to be just that, and not "polluted" with their own data etc which should be kept elsewhere in appropriately named and structured directories. HTH, John -- http://mail.python.org/mailman/listinfo/python-list
Re: os.join Windows action
Colin J. Williams wrote: C:\XXX is required, C:XXX is not acceptable. C:XXX is acceptable, it just means something entirely different from C:\XXX. There is a current working directory on each drive. C:XXX is file XXX in the current directory on drive C:. How should os.path.join('C:', 'ugh') be treated? Exactly as it is? If you want other behavior, you want os.path.join('C:\\', 'ugh'). -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list
os.join Windows action
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. -- http://mail.python.org/mailman/listinfo/python-list