Python问题解决:OSError: raw write() returned invalid length 14 (should have been between 0 and 7)
2018-01-25 14:59
661 查看
一次偶然的bug,我发现在VS code终端运行Python程序,Python中的print函数会出现上述OSError问题,然而我在外部cmd中运行该Python程序却不会出现该问题,所以在网上找了一下解决办法:可以使用
参考博客:在python中使用print()时,raw write()返回无效的长度:OSError: raw write() returned invalid length 254 (should have been between 0 and 127)
pip install win_unicode_console安装win_unicode_console,在代码文件中添加以下两行代码解决:
import win_unicode_console win_unicode_console.enable()
参考博客:在python中使用print()时,raw write()返回无效的长度:OSError: raw write() returned invalid length 254 (should have been between 0 and 127)
相关文章推荐
- Centos中Python升级为3.X时yum出现except OSError, e: ^ SyntaxError: invalid syntax问题
- Uncaught RangeError: Invalid array length 问题解决
- golang map引发的 【fatal error: concurrent map read and map write】问题解决
- Fedora14开发android,eclipse报错:Failed to write core dump. Core dumps have been disabled 解决
- have error with saxParser on android(not well-formed (invalid token))问题解决
- Centos中Python升级为3.X时yum出现except OSError, e: ^ SyntaxError: invalid syntax问题
- android关于The connection to adb is down, and a severe error has occured.这个问题的解决办法
- 怎么解决这个问题“The connection to adb is down, and a severe error has occured”
- [问题解决]Error: ShouldNotReachHere() [整理]
- Error: ShouldNotReachHere() android工程类中main方法运行出错问题解决
- python问题:IndentationError:expected an indented block错误解决
- 错误 java.lang.ClassFormatError: Invalid method Code length 的解决办法
- E: Sub-process /usr/bin/dpkg returned an error code 问题的解决办法
- 解决数据库 Table 'content_tags' is marked as crashed and should be repaired 表损坏问题
- 解决数据库 Table 'content_tags' is marked as crashed and should be repaired 表损坏问题
- python中的invalid syntax问题的解决
- error: Error parsing XML: unbound prefix 与 error: Invalid start tag LinearLayout 问题解决
- cygwin This indicates that the /etc/passwd (and possibly /etc/group) files should be rebuilt 问题解决办法
- cygwin This indicates that the /etc/passwd (and possibly /etc/group) files should be rebuilt 问题解决办法
- 关于JCreator在编译程序时出现的"Error:Invalid path"问题的解决方法