python2上的PythonWin知道如何执行启动文件,并将变量“注入”到解释器的本地作用域(到“立即窗口”)。
我用它来加载启动模块和变量进行测试(例如import x;I=2;s=“string”)
对于python 3,它不再工作了:
新语法,在交互.py,第299行
但是这些变量不再被注入解释器的locals/globals名称空间。
from threading import Timer import pywinauto def fff(): pywinauto.keyboard.SendKeys("exec(open(x.py)){ENTER}") Timer(1, fff).start()
有没有其他方法可以将变量注入PythonWin的作用域?