I am getting an "Illegal characters in path" error when doing chdir commands in Iron Python. This is happening in run time with my code, but even in the Iron Python console it has this issue. I'm using the nt module because in code the os module does not work (appears to be a known issue).
Doing a little bit of playing around it turns out the "illegal characters" is actually the word bin. Below is the text from the console that shows me getting the error only when i navigate to the bin directory.
Here is the example
>>> nt.chdir('c:\Users\xxxxx\Documents\Visual Studio 2010\Projects\xxx')
>>> nt.chdir('c:\Users\xxxxx\Documents\Visual Studio 2010\Projects\xxx\Directory')
>>> nt.chdir('c:\Users\xxxxx\Documents\Visual Studio 2010\Projects\xxx\Directory\bin')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: Illegal characters in path.
Whats worse is I'll navigate to a totally different directory (that doesn't even have a bin directory) and try to navigate to a subdirectory "bin" and i'll still get that error!
Any Ideas?
The \
path separator is also a python escape character. Double them, or better yet, use r''
raw python literals instead:
r'c:\Users\xxxxx\Documents\Visual Studio 2010\Projects\xxx'
'c:\\Users\\xxxxx\\Documents\\Visual Studio 2010\\Projects\\xxx'
For example, \n
is a newline character, and \t
is interpreted as a TAB. In your specific case, \b
is interpreted as a backspace.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With