RusPython
unread,May 15, 2009, 1:35:35 PM5/15/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sqlalchemy
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