[wxpython-users] App does not close down - py2exe - work around

Werner F. Bruhin werner.bruhin at free.fr
Wed May 28 01:39:14 PDT 2008


Hi Andrea,

Andrea Gavana wrote:
> Hi Werner,
>
> On Wed, May 28, 2008 at 8:41 AM, Werner F. Bruhin wrote:
>   
>> Just an update in case anyone else runs into this.
>>
>> The problem seems to come from sqlalchemy, but I am not yet sure how to
>> resolved it nicely, but in the mean time I am using the following work
>> around.
>>
>> self.engine = db.sa.create_engine(dburl, encoding='utf8', echo=False)
>> self.Session = db.sao.sessionmaker(autoflush=True, transactional=True)
>> self.Session.configure(bind=self.engine)
>> self.ds = self.Session()
>> ...
>> self.ds.Close()
>>
>> # adding the following allows the app to close down correctly
>> del self.ds
>> del self.Session
>> del self.engine
>>
>>
>> Mentioned it on the SA list, but had no feedback yet.
>>     
>
> I am using SQLAlchemy as well in one of my apps,
What version of SA are you using?  I am currently on 0.4.3, but I hope 
that 0.5 will be out before I am ready to release my new version.  If I 
read the doc for 0.5 I see that some Session related stuff is 
changed/clean-up, so maybe the problem is already dealt with in 0.5 
(will try it as soon as an alpha or beta version is available).

I also like the auto expire after commit in 0.5 as I have to do a lot of 
expire or refresh calls to get the correct data displayed (i.e. update a 
relation and if you then display the master of the relation the data is 
not updated).
>  and I didn't have
> this kind of problems... I suspect you are using a different "backend"
> in SQLAlchemy (i.e., I use it to access SQLite, while I think you are
> using Firebird or whatever is its name :-D ).
Yes you remember correctly I do use Firebird SQL.
>  Could Firebird be the
> problem (or its links to SQLAlchemy)?
>   
I moved from another ORM over to SA, didn't see the problem in there and 
looking at the SA Firebird code I don't see anything which jumps out at 
me.  But frankly  the SA internals are way over my head and I hope that 
some of the SA dev's will look at this at some point.

Werner


More information about the wxpython-users mailing list