Jam*_*ner 2 operating-system module pycharm python-3.7
Ubuntu 18.04.2 LTS 上的 Python 3.7.1
使用 Pycharm 版本:
PyCharm 2019.1.3 (Professional Edition)
Build #PY-191.7479.30, built on May 30, 2019
Linux 4.18.0-22-generic
Run Code Online (Sandbox Code Playgroud)
我的os.get_terminal_size()函数调用有问题
从终端窗口运行命令有效:
Python 3.7.1 (default, Oct 22 2018, 11:21:55)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.get_terminal_size()
os.terminal_size(columns=223, lines=18)
Run Code Online (Sandbox Code Playgroud)
但是从 Python 控制台窗口运行它不会
>>>import os
>>>os.get_terminal_size()
Traceback (most recent call last):
File "<input>", line 1, in <module>
OSError: [Errno 25] Inappropriate ioctl for device
Run Code Online (Sandbox Code Playgroud)
我的谷歌搜索没有产生太多针对我手头问题的信息。OSError: [Errno 25] Inappropriate ioctl for device实际上是什么意思,我该如何解决?
小智 5
您对 Python 的实现依赖于终端是否符合操作系统对终端大小的请求。在CPython 实现中,系统调用ioctl()将失败,因为设备(终端)无法识别命令。你可以尝试设置
-Drun.processes.with.pty=true
Run Code Online (Sandbox Code Playgroud)
在Help/Edit Custom VM Options...按照这个答案。
| 归档时间: |
|
| 查看次数: |
1066 次 |
| 最近记录: |