ipython / ipython/ipykernel

`sys.stdout` has no attribute `buffer`

Đang mở
#786 3 bình luận 2 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
734
Fork
412
Merge trung bình
1 ngày 5 giờ
Pull request đã merge (30 ngày)
8

Mô tả

If I run
```
import sys
sys.stdout.buffer
```
in a Python or a IPython shell, it works fine:

```python
In [1]: import sys

In [2]: sys.stdout.buffer
Out[2]: <_io.BufferedWriter name=''>
```

However, when running in a Jupyter Notebook, I get:
```python-traceback
AttributeError Traceback (most recent call last)
/var/folders/hp/166tdb592211tp23nb_rgmqw0000gp/T/ipykernel_3131/3028238189.py in
----> 1 sys.stdout.buffer

AttributeError: 'OutStream' object has no attribute 'buffer'
```

Some diagnostics:
```console
$ pip freeze | grep ipykernel
ipykernel==6.4.1
$ python --version
Python 3.9.6
```

---

Noticed when looking into https://github.com/psf/black/issues/2516

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.