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

No sys.stdout.encoding in kernel based IPython #2220

Closed
bfroehle opened this issue Jul 30, 2012 · 6 comments · Fixed by #2500
Closed

No sys.stdout.encoding in kernel based IPython #2220

bfroehle opened this issue Jul 30, 2012 · 6 comments · Fixed by #2500
Labels
Milestone

Comments

@bfroehle
Copy link
Contributor

As originally reported by @tkf in #2207.

Kernel-based IPython

% ./ipython.py console                       
Python 2.7.2+ (default, Oct  4 2011, 20:06:09) 
Type "copyright", "credits" or "license" for more information.

IPython 0.14.dev -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.
[IPKernelApp] To connect another client to this kernel, use:
[IPKernelApp] --existing kernel-8616.json

In [1]: import sys

In [2]: sys.stdout.encoding
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-18fba92f6a6c> in <module>()
----> 1 sys.stdout.encoding

AttributeError: 'OutStream' object has no attribute 'encoding'

Normal IPython

Same in pure Python console.

% ./ipython.py        
Python 2.7.2+ (default, Oct  4 2011, 20:06:09) 
Type "copyright", "credits" or "license" for more information.

IPython 0.14.dev -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import sys

In [2]: sys.stdout.encoding
Out[2]: 'UTF-8'
@ghost
Copy link

ghost commented Oct 7, 2012

Seems like this has stalled and it's a shame. b7dcbc4 is a perfectly adequate
solution to the original problem, and I'd like to see it merged.
The more general issue can wait for someone else who cares about it.

Pandas was bitten by this bug: pandas-dev/pandas@7bbc4e0.

@minrk , how about it?

@minrk
Copy link
Member

minrk commented Oct 7, 2012

I don't have time to deal with this, but I don't see anything wrong with the proposed fix.

@ghost
Copy link

ghost commented Oct 7, 2012

thank you.

@ipython - would any commiter kindly merge 5f38795?
the property decorator is optional but harmless.

@Carreau
Copy link
Member

Carreau commented Oct 8, 2012

Github does not seem to recognize 5f38795 has a commit sha it knows about.
Could you be a little more specific like user/repo/branch or PR number ?

@ghost
Copy link

ghost commented Oct 8, 2012

My bad. 0a83b1b adds an 'encoding' property to OutStream.
That's the one I meant.

@bfroehle
Copy link
Contributor Author

Closed by #2500.

minrk added a commit that referenced this issue Mar 5, 2013
This means that `sys.stdout.encoding` returns something useful instead of raising an AttributeError.

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

Successfully merging a pull request may close this issue.

3 participants