On Oct 22, 9:00 pm, Michael Bayer <mike...@zzzcomputing.com> wrote:
> what happens if you say:
>
> import sqlite3
> import os
> sqlite3.connect(os.path.abspath("test.db"))
>
> ?
>
> thats essentially what SQLA 0.7 does in order to guard against os.chdir() 
> changes as subsequent connections occur.
>

OK, you nailed it. The problem comes from some nasty text encoding
issues I've been having. os.path.abspath returns 'C:\\Users\\Jo\xe3o'.
This generates wonderful headscratchers such as this:

  >>> import sqlite3
  >>> import os
  >>> path = os.path.abspath('test.db')
  >>> path
  'C:\\Users\\Jo\xe3o\\test.db'
  >>> os.path.exists('test.db')
  False
  >>> sqlite3.connect(path)
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  sqlite3.OperationalError: unable to open database file
  >>> x = open(path, 'w')
  >>> x.write('bla')
  >>> x.close()
  >>> os.path.exists('test.db')
  True

I don't recall having this kind of problem on any computer I've had
before and I've spent way too much time trying to sort out these
encoding issues, so... that's what the 'Dev' user in this machine is
for. Thanks.

-- 
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