Opening a pysqlite database with a pathname containing non-ANSI characters
David Hughes <dfh-SSyVZMUXQxBawGkVQGIbBlpr/1R2p/[email protected]>
| Newsgroups | gmane.comp.python.db.pysqlite.user |
|---|---|
| Message-ID | <[email protected]> |
Is it possible to pass a database path name to sqlite.connect that
contains non-ANSI characters?
Using PySqlite 2.3.0 with Windows XP SP2 I get:
Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from pysqlite2 import dbapi2 as sqlite
>>> import os
>>> os.chdir('c:\\')
>>> os.getcwd()
'c:\\'
>>> newdir = 'dir\x82'
>>> print newdir
diré
>>> os.mkdir(newdir)
>>> os.path.exists(newdir)
True
>>> newdb = os.path.join(os.getcwd(), newdir, 'mydb')
>>> print newdb
c:\diré\mydb
>>> sqlite.connect(newdb)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
pysqlite2.dbapi2.OperationalError: unable to open database file
>>>
In the real case, the directory name is based on a user name, which
contains accented characters.
--
Regards,
David Hughes
_______________________________________________
pysqlite mailing list
pysqlite-IAPFreCvJWPBWskQ1e/[email protected]
http://lists.initd.org/mailman/listinfo/pysqlite