I have written a program in Python with a tkinter GUI front-end. When this is run from the script there are no issues.
I packaged it using cx_freeze to an exe file and running it from there works for the majority of the program. However, it has a problem: when trying to assign a value to a StringVar
object in one of the functions an exception is raised and kills the program.
When the same function is accessed from a different point in the program it functions normally. Any idea what could be wrong?
The section of code that causes the issue is as follows (I added the messagebox so I could see what it failed on):
if keyDetail.get('default', False):
try:
self.entries[key].set(keyDetail['default'])
except Exception as err:
messagebox.showinfo('error', 'key: %s, default: %s, error: %s'%(key, keyDetail['default'], err))
self.entries[key]
is a tk.StringVar
.
When this is run, I get the following message in the messagebox:
key: orderNo, default: Order Number, error: can't set "PY_VAR16:0"