tags:

views:

50

answers:

1

Hi,

I cannot os.chdir(path) in Python 2.6.5 under WindowsXP SP2. It works fine under CygWin and MAC OS X, but for WinXP regardless of path format, I always get this error:

AttributeError: 'str' object has no attribute 'chdir'.

I thought it was the problem with format of path but after trying r"C:\WINDOWS", 'C:\WINDOWS' and combinations of \\, / or even "\"C:\Windows\"", I gave up. With formatting I'm using os.path.exists(path) works perfectly fine...

What I am missing here? What should I be aware of when working with paths consisting of white spaces?

Cheers, Martin

+5  A: 

It seems that problem is that in some place you redefine 'os'. Somewhere in your code you do something like this:

import os
os = 'some string'
Mykola Kharechko
You're correct, Mykola! Thank you very much. Anyway, big LOL on me... I'd probably overlook that redefinition and got myself more and more frustrated.
delirus