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 sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to