I can't print from Python IDLE in Windows 10

匆匆过客 提交于 2019-12-11 10:39:41

问题


Since upgrading to Windows 10 I can no longer print from the IDLE Python IDE. The "print to default printer" box comes up as usual, but nothing is sent to the print queue ... I checked in Devices & Printers.

Printing from other applications works fine.


回答1:


I confirmed on my Win10 machine. However for me, the problem is not with Win 10. It is a stupid bug that I introduced in 2.7.11, 3.4.4, and 3.5.1. I am assuming that you must have upgraded Python also. You can test if you have the same cause by running python -m idlelib (or idlelib.idle on 2.7) in a console. After IDLE starts, try to print and you should see a traceback ending with NameError: name 'idleConf' is not defined.

My apologies for the blunder. I will fix this for future releases as soon as I finish improving the test so it would have caught this.

To fix it in the meanwhile, carefully edit <python-dir>/Lib/idlelib/IOBinding.py. Move this line

from idlelib.configHandler import idleConf

from about line 530, after a tkinter import, to line 13, after an askstring import. Remove the indent when you do so.



来源:https://stackoverflow.com/questions/35021370/i-cant-print-from-python-idle-in-windows-10

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!