Pyscripter是python下一个非常流行的开源IDE,笔者一直使用Pyscripter来来编写python脚本。
关于IDE的一些特性本文不在赘述,主要是分享一下今天遇到的一个问题。
笔者的程序有两个模块,分别列为A 和 B,B模块是程序入口并将引入A模块的类和函数
笔者更新A模块后,在B模块中运行程序,发现调用A模块还是之前的内容,并没有更新,只有在重启Pyscripter的时候才会更新,这个给我的调试带来了很大的困难,每次都要重启让整个过程变的效率低下。
于是我决定找出问题的根本原因,是程序的bug还是设置的问题,在翻阅了Pyscripter的官方文档之后,我发现了一个关键的段落:
Remote Interpreter and Debugger
In addition to using the internal integrated Python engine, PyScripter offers you the option to use one of three remote Python engines. These remote engines run in a separate process, so, when using them, script errors should not affect the stability of PyScripter. You can select the python engine that will be active from the Python Engine submenu of the Run menu. Here is a brief explanation of the Python engine options:
Python Engines:
Internal
This Python engine is faster than the other options however if there are problems with the scripts you are running or debugging they could affect the reliability of PyScripter and could cause crashes. Another limitation of this engine is that it cannot run or debug GUI scripts nor it can be reinitialized.
Remote
This the default Python engine of PyScripter and is the recommended engine for most Python development tasks. It runs in a child process and communicates with PyScripter using rpyc. It can be used to run and debug any kind of script including GUI scripts. However if you run or debug GUI scripts you may have to reinitialize the engine after each run.
官方文档描述在使用Internal Engine的时候script有可能不能被重新初始化,我当前的Python设置的正是Internal Engine, 当我将Engine设置为Remote Engine的时候问题解决
将Pyscripter Engine设为Remote Engine
以上是笔者一些浅显的认识,欢迎各位批评指点。