Re: import a module in a destructor of a class

2010-08-23 Thread Peter Otten
Navid Parvini wrote: > I have a python module named "book.py" I want to import it in a destructor > of a class. Why would you do that? > class Excel: > > def __init__( self, ... ): > . . . > > def __del__( self ): > import book > > but I got error. Would you please help me? Can I import a mo

Re: import a module in a destructor of a class

2010-08-23 Thread Chris Rebert
On Mon, Aug 23, 2010 at 5:00 AM, Navid Parvini wrote: > Dear All, > > I have a python module named "book.py" I want to import it in a destructor of > a class. > > class Excel: > >     def __init__( self, ... ): >     . . . > >     def __del__( self ): >   import book > > but I got

import a module in a destructor of a class

2010-08-23 Thread Navid Parvini
Dear All, I have a python module named "book.py" I want to import it in a destructor of a class. class Excel:       def __init__( self, ... ):     . . .     def __del__( self ):   import book but I got error. Would you please help me? Can I import a module in a destructor?