This is a continuation of https://stackoverflow.com/questions/37684111/ironpython-exe-file-closing-immediately-no-exception-thrown
I realized that my program did not work after compilation due to a problem with the Timer object in the thread library. I included the library in the \ Lib \ site-packages directory and added the directory to the path in the program. Here is the test code I use - 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 great in Interactive Interpreter in Visual Studio, but as soon as I use pyc.py to compile into an exe file, it does not start and just closes after ~ 5 seconds, an exception is not thrown.
As mentioned in the previous question, I have a program with a timer in it that I need to compile, since the source code contains confidential credentials. Are there any tricks needed for the timer to work in exe? Is it just incompatible?
Edit: 6 days unanswered. Unfortunately, there are no resources for this particular problem anywhere on the Internet. It's almost like I'm the only one who has this problem. This seems strange to me, because the problem is related to the Timer object itself, and I cannot imagine that no one else tried to deploy the application with a timer in it. Any insight would be helpful at this point, since I'm completely at a standstill.
python compilation timer ironpython pyc
Inagnikai
source share