[IPython-user] unicode and change directory problem

Jörgen Stenarson jorgen.stenarson@bostream...
Tue Jan 20 14:46:01 CST 2009


Vicent Mas skrev:
> Hi,
> 
> I'm a newbie having problems with the cd command. My platform is
> windows xp. I want to change to a directory whose unicode
> representation is u'para\u0140lel'. If I issue a ls command that
> directory is properly listed.
> 
> However I don't know how to change to the directory using the cd
> command because the U'0140 character is not mapped to any key in the
> keyboard. I've tried several things: passing the unicode string to cd
> fails, passing the unicode string encoded with sys.stdin.encoding
> fails too. Passing the unicode string encoded with
> sys.getfilesystemencoding() fails again. So what have I to do for
> changing to that directory?
> 
> TIA
> 
> Vicent
Vicent,

I believe Paul's suggestion is the easiest workaround at this time. 
Unfortunately unicode is not used throughout ipython at this time and 
the argument handling of the magic commands have lots unicode problems. 
Unfortunately I do not think this will be fixed any time soon.

To simplify working with non-ascii characters, I set the console 
encoding to be the same as is used by the filesystem in my case
that is 1252. This means I always have cmd.exe issue the command "chcp 
1252" on startup. I have also changed the default font of the console 
window to Lucida Console otherwise åäö won't show up properly in the 
console window. Then I can use åäöé and other characters I can type 
directly on my keyboard in ipython.

/Jörgen




More information about the IPython-user mailing list