sqlite3 und Umlaute im Pfad
Verfasst: Mittwoch 4. Juli 2007, 21:52
sqlite3.connect entfernt Umlaute anscheinend einfach. Hat man zum Beispiel ein (Unter-)Verzeichnis Jörg, so wird daraus ein Jrg - das klappt dann natürlich nicht...
Oder mache ich was falsch? Kann man irgendwie Pfade mit Umlauten verwenden?
Danke,
bords
Code: Alles auswählen
>>> ================================ RESTART ================================
>>> import os
>>> import sqlite3
>>> pth = "C:\projects\dump"
>>> os.listdir(pth)
['J\xf6rg']
>>> pth_db = os.path.join(pth, os.listdir(pth)[0],"my.db")
>>> pth_db
'C:\\projects\\dump\\J\xf6rg\\my.db'
>>> c = sqlite3.connect(pth_db)
Traceback (most recent call last):
File "<pyshell#46>", line 1, in <module>
c = sqlite3.connect(pth_db)
OperationalError: unable to open database file
>>> os.mkdir(os.path.join(pth,"Jrg"))
>>> c = sqlite3.connect(pth_db)
>>>
Danke,
bords