简体   繁体   English

长时间运行的脚本自动在Eclipse中终止

[英]Long running scripts automatically terminated in eclipse

Eclipse seems to terminate long running scripts automatically. Eclipse似乎会自动终止长时间运行的脚本。 I have this simple script written in Python and it runs fine on IDLE, however when I run it in eclipse the program terminates without printing any output values in the console. 我有一个用Python编写的简单脚本,它在IDLE上运行良好,但是当我在Eclipse中运行它时,该程序将终止,而不会在控制台中打印任何输出值。 Is there something that I could modify in the settings to control this? 我可以在设置中进行一些修改来控制它吗?

def main():
    max = 8000
    for i in getPrimes():
        if(i <= max):
            print(i, end=" ")
        else:
            return


def getPrimes():
    testNum = 2
    isPrime = True
    while True:
        for i in range(2, testNum):
            if testNum % i == 0:
                isPrime = False
                continue

        if isPrime:
            yield testNum
        else:
            isPrime = True

        testNum += 1


if __name__ == "__main__": main()

This is a new one on me, but you have hit a long standing bug in Eclipse I never knew about: Bug 23406 这是我的新手,但是您遇到了一个我从未知晓的长期存在的Eclipse错误: 错误23406

It turns out that on Windows some very long lines are not displayed properly even though the text is there. 事实证明,在Windows上,即使文本很长,也无法正确显示一些很长的行。

As a workaround, try changing your print line from print(i, end=" ") to print(i) and you should see your output. 解决方法是,尝试将print行从print(i, end=" ")更改为print(i) ,您应该会看到输出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM