#145 full path cannot work? SQLObject 0.7.0

closed-wont-fix
nobody
SQLite (24)
5
2006-01-11
2006-01-06
Anonymous
No

I tried the following in windows XP using SQLObject
0.7.0, the path for DB is: C:\\Documents and
Settings\\guest\\My Documents\\test.db

sDBPath = os.path.abspath('test.db')
sqlhub.processConnection = connectionForURI('sqlite:%s'
% sDBPath)

it insists on having "/".

-------- exception -----------------
File "c:\program
files\python24\lib\site-packages\SQLObject-0.7.0-py2.4.egg\sqlobject\dbconnection.py",
line 80, in _parseURI

assert rest.startswith('/'), "URIs must start with
scheme:/ -- you did not include a / (in %r)" % rest

AssertionError: URIs must start with scheme:/ -- you
did not include a / (in 'C:\\Documents and
Settings\\tambrinc\\My Documents\\test.db')
------------------------------------

sqlhub.processConnection =
connectionForURI('sqlite:/%s' % sDBPath)

-------- exception -----------------
File "C:\Program
Files\Python24\Lib\site-packages\sqlite\main.py", line
445, in __init__
self.db = _sqlite.connect(database, mode)
_sqlite.DatabaseError: unable to open database file
------------------------------------

Discussion

  • Oleg Broytman

    Oleg Broytman - 2006-01-11
    • status: open --> closed-wont-fix
     
  • Oleg Broytman

    Oleg Broytman - 2006-01-11

    Logged In: YES
    user_id=4799

    Yes, this is an URI. It must has forward, not backward
    slashes. To convert fullpath to URI I use the following code:

    cwd = os.getcwd()
    cwd_uri = cwd.replace(os.sep, '/')
    if os.name == 'nt':
    cwd_uri = '/' + cwd_uri.replace(':', '|')

     
  • Nobody/Anonymous

    simple fix for win32:
    in dbconnection.py / class DBConnection / def _parseURI(uri):
    replace
    path = '/' + rest
    by
    path = rest

     
  • Nobody/Anonymous

    simple fix for win32:
    in dbconnection.py / class DBConnection / def _parseURI(uri):
    replace
    path = '/' + rest
    by
    path = rest

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks