This is a follow up to https://stackoverflow.com/questions/37684111/ironpython-exe-file-closing-immediately-no-exception-thrown
I figured out that my program is not working once compiled due to an issue with the Timer object in the threading library. I've included the library in my \Lib\site-packages directory and added the directory to the path in the program. Here is the test code I'm using - a simple counting program:
import sys
from threading import Timer
sys.path.append('C:\Users\[user]\Documents\Visual Studio 2015\Projects\Testing Timer Compilation issue\Testing Timer Compilation issue')
sys.path.append('C:\Users\[user]\Documents\Visual Studio 2015\Projects\Testing Timer Compilation issue\Testing Timer Compilation issue\Lib')
class Chron():
def __init__(self):
self.t = Timer(2, self.count)
self.t.start()
self.i = 0
def count(self):
print(self.i)
self.i += 1
if self.i <= 15:
self.t = Timer(2, self.count)
self.t.start()
c = Chron()
Works perfectly in the Interactive Interpreter within Visual Studio, but once I use pyc.py to compile to an exe file, it will not run, and simply closes after ~5 seconds, no exception thrown.
As mentioned in the previous question, I have a program with a Timer in it that I need compiled, as the source code contains sensitive credentials. Are there any tricks necessary to make the Timer work within an exe? Is it simply incompatible?
Edit: 6 days without an answer. Unfortunately, there doesn't seem to be any resources for this specific issue anywhere on the internet. It's almost as if I'm the only one having this issue. This seems strange to me, since the problem seems to be with the Timer object itself, and I can't imagine that no one else has tried to deploy an application with a Timer in it. Any insight would be helpful at this point, as I am completely stumped.
c = Chron()
? Do you see the expected output at that point? – Plath