You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AttributeError: 'FakeOutput' object has no attribute 'encoding' #622
Hm, I guess this should just be a property that returns whatever sys.stdout.encoding is, since that's how strings are actually being decoded. What are you using this for? (asking to try to understand if this is the right solution)
I ran into the problem in bpython import as well.
I would look at what idle does in its code base:
see cpython run.py PseudoFile class for example. if FakeOutput only encodes 'utf-8' then just return that.
$ python3
Python 3.7.2 (default, Feb 12 2019, 08:16:38)
[Clang 10.0.0 (clang-1000.11.45.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pipenv
>>>
$ bpython
bpython version 0.17.1 on top of Python 3.7.2 /usr/local/opt/python/bin/python3.7
>>> import pipenv
Traceback (most recent call last):
File "<input>", line 1, in <module>
import pipenv
File "/Users/ryan.delaney/Library/Python/3.7/lib/python/site-packages/pipenv/__init__.py", line 47, in <module>
from .cli import cli
File "/Users/ryan.delaney/Library/Python/3.7/lib/python/site-packages/pipenv/cli/__init__.py", line 3, in <module>
from .command import cli
File "/Users/ryan.delaney/Library/Python/3.7/lib/python/site-packages/pipenv/cli/command.py", line 19, in <module>
from .options import (
File "/Users/ryan.delaney/Library/Python/3.7/lib/python/site-packages/pipenv/cli/options.py", line 11, in <module>
from .. import environments
File "/Users/ryan.delaney/Library/Python/3.7/lib/python/site-packages/pipenv/environments.py", line 7, in <module>
from ._compat import fix_utf8
File "/Users/ryan.delaney/Library/Python/3.7/lib/python/site-packages/pipenv/_compat.py", line 96, in <module>
OUT_ENCODING, ERR_ENCODING = force_encoding()
File "/Users/ryan.delaney/Library/Python/3.7/lib/python/site-packages/pipenv/_compat.py", line 60, in force_encoding
stdout_encoding = sys.stdout.encoding
AttributeError: 'FakeOutput' object has no attribute 'encoding'
>>>
The encoding issue exists in bpython 0.19 and Python 3.8.0
$ bpython
bpython version 0.19 on top of Python 3.8.0
>>> import sys
>>> sys.stdout.encoding
Traceback (most recent call last):
File "<input>", line 1, in <module>
sys.stdout.encoding
AttributeError: 'FakeOutput' object has no attribute 'encoding'
`
Activity
thomasballinger commentedon Jul 29, 2016
Hm, I guess this should just be a property that returns whatever sys.stdout.encoding is, since that's how strings are actually being decoded. What are you using this for? (asking to try to understand if this is the right solution)
goetzc commentedon Jul 29, 2016
This is a much better solution!
I don't remember that :D
goetzc commentedon Jul 30, 2016
I found another AttributeError for 'FakeOutput', this time for 'fileno'. I was using PyQtGraph. Issue #628.
thomasballinger commentedon Aug 5, 2016
Proposed solution in #629
gerryjenkinslb commentedon Dec 16, 2017
I ran into the problem in bpython import as well.
I would look at what idle does in its code base:
see cpython run.py PseudoFile class for example. if FakeOutput only encodes 'utf-8' then just return that.
rpdelaney commentedon Mar 14, 2019
Here's my +1:
tiffanyb commentedon Jun 13, 2020
The
encodingissue exists in bpython 0.19 and Python 3.8.0alisianoi commentedon Aug 17, 2020
The
encodingissue still exists in bpython0.19and Python3.8.2, my use case is Z3 solver:The Z3 example comes from here: https://theory.stanford.edu/~nikolaj/programmingz3.html#sec-logical-interface
deadeert commentedon Sep 7, 2020
Hello, I confim @alisianoi I have the same issue with python 3.8.5 and bpython 0.19.
itsfarseen commentedon Sep 28, 2020
I was trying to use Z3 and is affected by this.
I am using this as a workaround:
sebastinas commentedon Oct 11, 2020
Fixes by #629.