Django報錯:OSError: raw write() returned invalid length 4 (should have been between 0 and 2) 在python中使

在使用Django時Django報錯:Django報錯:OSError: raw write() returned invalid length 4 (should have been between 0 and 2),以前是沒有問題的,因而百度緣由和解決辦法,最終有大神分析可能與win10系統的新版本有關係,是字符編碼的問題。html

 

解決方案:python

1.在dos終端使用 pip install win_unicode_console安裝win_unicode_console;post

2.在wiew.py插入下邊兩行代碼:編碼

 

1 import win_unicode_console
2 win_unicode_console.enable()

 

參考博客:在python中使用print()時,raw write()返回無效的長度:OSError: raw write() returned invalid length 254 (should have been between 0 and 127)url

相關文章
相關標籤/搜索