ipython/ipython — Issue #1006: ls crashes when run on a UNC path or with non-ascii args
Author: jstenar
Created: 2011-11-16 18:38:09+00:00
State: open

ls crashes when run on a UNC path or with non-ascii args.

I believe it is because os.system requires a str and will try to convert using ascii.
See #1005 for a quick fix. @takluyver how should this be done in a python3 compatible way?

In [3]: ls åäö/
---------------------------------------------------------------------------
UnicodeEncodeError Traceback (most recent call last)
C:\python\bugreports\ipython\ in ()
----> 1 get_ipython().system(u"dir /on Ã¥Ã¤Ã¶/")

c:\python\external\ipython\IPython\core\interactiveshell.pyc in system_raw(self, cmd)
2083 if path is not None:
2084 cmd = '"pushd %s &&"%s' % (path, cmd)
-> 2085 ec = os.system(cmd)
2086 else:
2087 ec = os.system(cmd)

UnicodeEncodeError: 'ascii' codec can't encode characters in position 8-10: ordinal not in range(128)