"import" not working?
lists at cheimes.de
Fri Mar 13 20:44:41 CET 2009
Scott David Daniels wrote:
> Aahz wrote:
>> In article <mailman.605.1235434737.11746.python-list at python.org>,
>> Rhodri James <rhodri at wildebst.demon.co.uk> wrote: ...
>> My preference:
>> This doesn't work if you need to add a trailing backslash, though.
> Also my preference (except, due to aging eyes and bad fonts, I prefer
> single quotes unless doubles are needed). I solve the trailing
> backslash problem as so:
> sys.path.append(r'C:\DataFileTypes' '\\')
Due to a known limitation in the Windows stat() function you MUST NEVER
add an entry to sys.path that ends with a slash or backslash.
sys.path.append('C:\\DataFileTypes') # works
sys.path.append('C:\\DataFileTypes\\') # will not work
Windows' stat() method does't recognize a path with a trailing slash as
a valid directory. You might be able to reproduce the issue with os.stat().
More information about the Python-list