Reputation: 3587
I have this program which works fine in the shell [ http://pastebin.com/qsfJt8eE ]
But when I try to generate a .exe using the py2exe I get this error.
Traceback (most recent call last):
File "test1.py", line 470, in <module>
NameError: name 'ACCOUNT' is not defined
Why is this happening?
Relevant block of code (the end of whole file) looks like:
# line 455
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
try:
acc = pickle.load(open("personal_account.p", "rb"))
ACCOUNT = Account() # line 460
MAIN = MainFrame()
BALANCE = BalanceFrame(MAIN)
LOANS = LoansFrame(MAIN)
BORROWS = BorrowsFrame(MAIN)
POPUP = PopUp(MAIN, BALANCE, LOANS, BORROWS)
MAIN.show()
sys.exit(app.exec_())
finally:
pickle.dump(ACCOUNT.data, open("personal_account.p", "wb")) # line 470
Upvotes: 0
Views: 97
Reputation: 44102
I would expect, that on line 459 the code fails to load pickle file thus does not set up ACCOUNT
variable on following line.
Then on line 470 you try to use that variable and fail.
Upvotes: 1