长 运行 脚本在 eclipse 中自动终止

Long running scripts automatically terminated in eclipse

Eclipse 似乎会自动终止长 运行ning 脚本。 我有一个用 Python 编写的简单脚本,它在空闲时 运行 很好,但是当我 运行 它在 eclipse 中时,程序终止而没有在控制台中打印任何输出值。 我可以在设置中修改一些东西来控制它吗?

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()

这是我的新问题,但您遇到了 Eclipse 中一个我从来不知道的长期存在的错误:Bug 23406

事实证明,在 Windows 上,即使有文本,一些很长的行也无法正确显示。

作为解决方法,尝试将 print 行从 print(i, end=" ") 更改为 print(i),您应该会看到输出。