我无法在 Windows 10 中从 Python IDLE 打印 [英] I can't print from Python IDLE in Windows 10

查看:42
本文介绍了我无法在 Windows 10 中从 Python IDLE 打印的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自从升级到 Windows 10 后,我无法再从 IDLE Python IDE 进行打印.打印到默认打印机"框照常出现,但没有任何内容发送到打印队列......我检查了设备和;打印机.

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.

推荐答案

我在我的 Win10 机器上确认.但是对我来说,问题不在于 Win 10.这是我在 2.7.11、3.4.4 和 3.5.1 中引入的一个愚蠢的错误.我假设您也必须升级 Python.您可以通过在控制台中运行 python -m idlelib(或 2.7 上的 idlelib.idle)来测试您是否有相同的原因.IDLE 启动后,尝试打印,您应该看到以 NameError: name 'idleConf' is not defined 结尾的回溯.

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.

要同时修复它,请仔细编辑/Lib/idlelib/IOBinding.py.移动这条线

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

from idlelib.configHandler import idleConf

从大约第 530 行,在 tkinter 导入之后,到第 13 行,在 askstring 导入之后.这样做时删除缩进.

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

这篇关于我无法在 Windows 10 中从 Python IDLE 打印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆