Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnicodeDecodeError #4615

Closed
zunayed opened this issue Dec 1, 2013 · 12 comments · Fixed by #4624
Closed

UnicodeDecodeError #4615

zunayed opened this issue Dec 1, 2013 · 12 comments · Fixed by #4624
Milestone

Comments

@zunayed
Copy link

zunayed commented Dec 1, 2013

I am receiving an error running ipython from the shell. Everything was running fine a few days ago but recently I have been unable to get it running.

I'm on osx mavericks and have pip installed everything in a virualenv. I have also created a new virtualenv and have the same error. Tried both V 1.1 and 1.0 but no luck

this is my python version

Python 2.7.5 (default, Aug 25 2013, 00:04:04)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
here is what is installed

Jinja2==2.7.1
MarkupSafe==0.18
brewer2mpl==1.3.2
ipython==1.1.0
matplotlib==1.3.1
nose==1.3.0
numpy==1.8.0
pandas==0.12.0
prettyplotlib==0.1.3
pyparsing==2.0.1
python-dateutil==2.2
pytz==2013.8
pyzmq==14.0.0
seaborn==0.1
six==1.4.1
tornado==3.1.1
wsgiref==0.1.2

-----------------error from terminal-------------------------------------

(pyData)Zunayeds-MacBook-Pro:pyData zunayed$ ipython
Traceback (most recent call last):
File "/Users/zunayed/pyData/bin/ipython", line 9, in
load_entry_point('ipython==1.1.0', 'console_scripts', 'ipython')()
File "/Users/zunayed/pyData/lib/python2.7/site-packages/IPython/init.py", line 118, in start_ipython
return launch_new_instance(argv=argv, *_kwargs)
File "/Users/zunayed/pyData/lib/python2.7/site-packages/IPython/config/application.py", line 544, in launch_instance
app.initialize(argv)
File "", line 2, in initialize
File "/Users/zunayed/pyData/lib/python2.7/site-packages/IPython/config/application.py", line 89, in catch_config_error
return method(app, *args, *_kwargs)
File "/Users/zunayed/pyData/lib/python2.7/site-packages/IPython/terminal/ipapp.py", line 323, in initialize
self.init_shell()
File "/Users/zunayed/pyData/lib/python2.7/site-packages/IPython/terminal/ipapp.py", line 339, in init_shell
ipython_dir=self.ipython_dir, user_ns=self.user_ns)
File "/Users/zunayed/pyData/lib/python2.7/site-packages/IPython/config/configurable.py", line 349, in instance
inst = cls(_args, *_kwargs)
File "/Users/zunayed/pyData/lib/python2.7/site-packages/IPython/utils/traitlets.py", line 424, in new
value.instance_init(inst)
File "/Users/zunayed/pyData/lib/python2.7/site-packages/IPython/utils/traitlets.py", line 255, in instance_init
self.set_default_value(obj)
File "/Users/zunayed/pyData/lib/python2.7/site-packages/IPython/utils/traitlets.py", line 275, in set_default_value
newdv = self._validate(obj, dv)
File "/Users/zunayed/pyData/lib/python2.7/site-packages/IPython/utils/traitlets.py", line 323, in _validate
return self.validate(obj, value)
File "/Users/zunayed/pyData/lib/python2.7/site-packages/IPython/utils/traitlets.py", line 1028, in validate
return unicode(value)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 7: ordinal not in range(128)

If you suspect this is an IPython bug, please report it at:
https://github.com/ipython/ipython/issues
or send an email to the mailing list at ipython-dev@scipy.org

You can print a more detailed traceback right now with "%tb", or use "%debug"
to interactively debug it.

Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
c.Application.verbose_crash=True

@takluyver
Copy link
Member

Have you set any options in IPython config files? Does the working directory have any non-ascii characters in?

@zunayed
Copy link
Author

zunayed commented Dec 2, 2013

I can replicate the error in a clean virtualenv with no files in the workding directory other then the files created form virtualenv. Also I did not modify the Ipython config files

An interesting thing is you can still run a fully functional ipython notebook using : ipython notebook -pylab inline

@minrk
Copy link
Member

minrk commented Dec 2, 2013

what is the output of ipython --debug?

@zunayed
Copy link
Author

zunayed commented Dec 2, 2013

(pyData)Zunayeds-MacBook-Pro:pyData zunayed$ ipython --debug
[TerminalIPythonApp] Config changed:
[TerminalIPythonApp] {'TerminalIPythonApp': {'log_level': 10}}
[TerminalIPythonApp] Using existing profile dir: u'/Users/zunayed/.ipython/profile_default'
[TerminalIPythonApp] Searching path [u'/Users/zunayed/pyData', u'/Users/zunayed/.ipython/profile_default'] for config files
[TerminalIPythonApp] Attempting to load config file: ipython_config.py
[TerminalIPythonApp] Config file ipython_config.py not found
Traceback (most recent call last):
  File "/Users/zunayed/pyData/bin/ipython", line 9, in <module>
    load_entry_point('ipython==1.1.0', 'console_scripts', 'ipython')()
  File "/Users/zunayed/pyData/lib/python2.7/site-packages/IPython/__init__.py", line 118, in start_ipython
    return launch_new_instance(argv=argv, **kwargs)
  File "/Users/zunayed/pyData/lib/python2.7/site-packages/IPython/config/application.py", line 544, in launch_instance
    app.initialize(argv)
  File "<string>", line 2, in initialize
  File "/Users/zunayed/pyData/lib/python2.7/site-packages/IPython/config/application.py", line 89, in catch_config_error
    return method(app, *args, **kwargs)
  File "/Users/zunayed/pyData/lib/python2.7/site-packages/IPython/terminal/ipapp.py", line 323, in initialize
    self.init_shell()
  File "/Users/zunayed/pyData/lib/python2.7/site-packages/IPython/terminal/ipapp.py", line 339, in init_shell
    ipython_dir=self.ipython_dir, user_ns=self.user_ns)
  File "/Users/zunayed/pyData/lib/python2.7/site-packages/IPython/config/configurable.py", line 349, in instance
    inst = cls(*args, **kwargs)
  File "/Users/zunayed/pyData/lib/python2.7/site-packages/IPython/utils/traitlets.py", line 424, in __new__
    value.instance_init(inst)
  File "/Users/zunayed/pyData/lib/python2.7/site-packages/IPython/utils/traitlets.py", line 255, in instance_init
    self.set_default_value(obj)
  File "/Users/zunayed/pyData/lib/python2.7/site-packages/IPython/utils/traitlets.py", line 275, in set_default_value
    newdv = self._validate(obj, dv)
  File "/Users/zunayed/pyData/lib/python2.7/site-packages/IPython/utils/traitlets.py", line 323, in _validate
    return self.validate(obj, value)
  File "/Users/zunayed/pyData/lib/python2.7/site-packages/IPython/utils/traitlets.py", line 1028, in validate
    return unicode(value)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 7: ordinal not in range(128)

If you suspect this is an IPython bug, please report it at:
    https://github.com/ipython/ipython/issues
or send an email to the mailing list at ipython-dev@scipy.org

You can print a more detailed traceback right now with "%tb", or use "%debug"
to interactively debug it.

Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
    c.Application.verbose_crash=True

@takluyver
Copy link
Member

Do you have $EDITOR set?

@zunayed
Copy link
Author

zunayed commented Dec 2, 2013

Yes! In my .bashrc file I have

export EDITOR="subl -w"  

Commenting that line out lets python again! Thanks takluyver! Curious why this happens.

@takluyver
Copy link
Member

Does the value of EDITOR have any non-ascii characters in? I.e., if you uncomment that again, and in Python, do:

import os
os.environ['EDITOR']

What do you see

@zunayed
Copy link
Author

zunayed commented Dec 2, 2013

So I ran those commands

>>> import os
>>> os.environ['EDITOR']
'subl -w\xc2\xa0\xc2\xa0'
>>>

Turns out there was some spaces after the
export EDITOR="subl -w"

Removing them now allows yields

>>> import os
>>> os.environ['EDITOR']
'subl -w'

That pretty much solved all my issues!

@zunayed zunayed closed this as completed Dec 2, 2013
@takluyver
Copy link
Member

Reopening because I'm going to work on at least having a better error message for this ;-)

@takluyver
Copy link
Member

With #4624, it should print a warning and carry on working in this case.

@zunayed
Copy link
Author

zunayed commented Dec 3, 2013

Awesome!

minrk added a commit that referenced this issue Dec 3, 2013
Fix crash when $EDITOR is non-ASCII

closes #4615
@brentpayne
Copy link

I had this same issue in version ipython==1.2.1, EDITOR was set to '\xe2\x80\x98emacs\xe2\x80\x99'

mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014
Fix crash when $EDITOR is non-ASCII

closes ipython#4615
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants