嗨所有Python开发人员!
在使用PyDev的Eclipse中,可以在调试时编辑Python文件.在保存时,PyDev调试器会将更新的代码重新加载到正在运行的程序中并使用我的新代码.如何在JetBrains PyCharm(使用Community Edition)中执行相同的操作?
当我这样做时,Eclipse/PyDev会写出这样的输出:
pydev debugger: Start reloading module: "MyWidget" ...
pydev debugger: Updated function code: <function close at 0x055F4E70>
pydev debugger: reload finished
Run Code Online (Sandbox Code Playgroud)
我搜索了设置和网页,但找不到任何提示.任何想法都很高兴.谢谢.
编辑:我发现在Eclipse/PyDev中必须处于调试模式才能使用此功能.我在PyCharm中测试过,但没有重新加载.
我怎样才能启用这个"运行时调试"Notch 在Eclipse 中的这个视频中谈到了什么?
作为测试,我希望能够编辑以下代码的输出,并在运行时将其更改为"Hello Runtime Debugging".
public class HelloWorld {
public static void main(String[] args) throws InterruptedException {
doIt();
}
private static void doIt() throws InterruptedException {
for (int i = 0; i < 1000; ++i) {
System.out.println("Hello World " + i);
Thread.currentThread().sleep(100);
}
}
}
Run Code Online (Sandbox Code Playgroud)
编辑:我修改了代码,现在我得到了我正在寻找的结果.Suraj Chandran的回答解释了这一点.
private static void doIt() throws InterruptedException {
for (int i = 0; i < 1000; ++i) {
print(i);
Thread.currentThread().sleep(100);
}
}
private static void print(int i) {
System.out.println("Hello Sir …Run Code Online (Sandbox Code Playgroud)