...*work[s] 2009/5/16 Виктор Иконников <[email protected]>
> Hi Mike, > > Thank you very much. It's work. > > 2009/5/16 Mike Conley <[email protected]> > > I found that you need to call >> eng.dispose() >> to disconnect from the database before deleting the file. >> >> Not sure about what is happening under the covers at that point, but it >> seems to work. >> >> -- >> Mike Conley >> >> >> >> >> On Fri, May 15, 2009 at 1:35 PM, RusPython <[email protected]>wrote: >> >>> >>> Hi guys, >>> >>> I have next code: >>> >>> import os >>> from sqlalchemy import * >>> from sqlalchemy.orm import * >>> >>> metadata = MetaData() >>> engine = create_engine('sqlite:///temp.db', convert_unicode=True) >>> metadata.bind = engine >>> >>> branches = Table('branches', metadata, >>> Column('id', Integer, primary_key=True), >>> Column('name', String(100)), >>> Column('email', String(100)), >>> Column('pos', Integer), >>> ) >>> >>> class Branch(object): pass >>> >>> mapBranch = mapper(Branch, branches) >>> >>> metadata.create_all() >>> session = create_session() >>> >>> # Here I fill database >>> >>> session.close() >>> >>> # Here I want arch dbfile and then delete it >>> os.remove('.\temp.db') >>> >>> # And I get error :( >>> >>> Traceback (most recent call last): >>> File "G:\project\python\tgk\trunk\src\mail\viewer.py", line 37, in >>> onClick >>> converter.convert(branch) >>> File "G:\project\python\tgk\trunk\src\db\converter.py", line 44, in >>> convert >>> os.remove(paths.temp) >>> WindowsError: [Error 32] The process cannot access the file: 'G:\ >>> \project >>> \\python\\tgk\\trunk\\src\\temp.db' >>> >>> How I can close connection with db file? >>> >>> Thanks, >>> Viktor >>> >>> >>> >> >> >> >> > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---
