Problem solved. :-) The reason this was not taking place is because if an exception took place then Py_Finalize() was not called. I have checked in changes to Subversion that ensure that Py_Finalize() is called at all times and then the __del__ methods are called as expected.
Anthony On Fri, Apr 17, 2009 at 1:13 PM, Smith, Jeff <[email protected]> wrote: > As a test case this is easy to reproduce. Try the following > > nodel.py: > class NoDel: > def __del__(self): > print 'running __del__ for class NoDel' > nodelinst = NoDel() > > both the frozen and unfrozen apps yield: > running __del__ for class NoDel > > Now try: > nodel.py: > class NoDel: > def __del__(self): > print 'running __del__ for class NoDel' > nodelinst = NoDel() > raise AttributeError > > and the unfrozen app gives > Traceback (most recent call last): > File "nodelraise.py", line 7, in <module> > raise AttributeError > AttributeError > running __del__ for class NoDel > > while the frozen app gives: > Traceback (most recent call last): > File "c:\Python25\lib\site-packages\cx_Freeze\initscripts\Console.py", > line 29 > , in <module> > exec code in m.__dict__ > File "nodelraise.py", line 7, in <module> > raise AttributeError > AttributeError > > Note that the destructor is not called. > > Jeffery G. Smith > MedPlus, A Quest Diagnostics Company | Senior SCM Specialist | 4690 Parkway > Drive | Mason, OH 45040 USA | phone +1.513.204.2601 | fax +1.513.229.5505 | > mobile +1.513.335.1517 | [email protected] | www.MedPlus.com > > Please think about resource conservation before you print this message > > > ________________________________ > From: Smith, Jeff [mailto:[email protected]] > Sent: Friday, April 17, 2009 3:03 PM > To: [email protected] > Subject: [cx-freeze-users] __del__ not getting called in frozen app > > I have a __del__ method on a class that doesn't get called on my frozen app > when the app throws an exception. I am using cx_Freeze 4.0.1 with Python > 2.5.4 and see this on Windows and Linux. > > Oddly enough, I see the same thing on Mac OS X with py2app. > > Has anyone seen similar behavior? > > > Jeffery G. Smith > MedPlus, A Quest Diagnostics Company | Senior SCM Specialist | 4690 Parkway > Drive | Mason, OH 45040 USA | phone +1.513.204.2601 | fax +1.513.229.5505 | > mobile +1.513.335.1517 | [email protected] | www.MedPlus.com > > Please think about resource conservation before you print this message > > > > > Confidentiality Notice: The information contained in this electronic > transmission is confidential and may be legally privileged. It is intended > only for the addressee(s) named above. If you are not an intended recipient, > be aware that any disclosure, copying, distribution or use of the > information contained in this transmission is prohibited and may be > unlawful. If you have received this transmission in error, please notify us > by telephone (513) 229-5500 or by email ([email protected]). After > replying, please erase it from your computer system. > > > Confidentiality Notice: The information contained in this electronic > transmission is confidential and may be legally privileged. It is intended > only for the addressee(s) named above. If you are not an intended recipient, > be aware that any disclosure, copying, distribution or use of the > information contained in this transmission is prohibited and may be > unlawful. If you have received this transmission in error, please notify us > by telephone (513) 229-5500 or by email ([email protected]). After > replying, please erase it from your computer system. > ------------------------------------------------------------------------------ > Stay on top of everything new and different, both inside and > around Java (TM) technology - register by April 22, and save > $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. > 300 plus technical and hands-on sessions. Register today. > Use priority code J9JMT32. http://p.sf.net/sfu/p > _______________________________________________ > cx-freeze-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/cx-freeze-users > > ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensign option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects _______________________________________________ cx-freeze-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/cx-freeze-users
