Question

I've installed IMDbPY and made a database via the IMDb files and imdb2py script. Now I'm not able to use that database in my script. When I try to use the databse, I get the following errors:

>>> from imdb import IMDb  
>>> i = IMDb('sql', uri='sqlite:/home/user/random/mov.db', useORM='sqlalchemy,sqlobject')  
2013-06-04 11:20:25,977 WARNING [imdbpy.parser.sql.alchemy] /usr/lib/python2.7/dist-packages/imdb/parser/sql/alchemyadapter.py:38: Unable to import migrate.changeset: Foreign Keys will not be created.  
Traceback (most recent call last):
  File "<input>", line 1, in <module>  
  File "/usr/lib/python2.7/dist-packages/imdb/__init__.py", line 199, in IMDb
    return IMDbSqlAccessSystem(*arguments, **keywords)  
  File "/usr/lib/python2.7/dist-packages/imdb/parser/sql/__init__.py", line 595, in __init__
    self._connection = setConnection(uri, DB_TABLES)  
  File "/usr/lib/python2.7/dist-packages/imdb/parser/sql/alchemyadapter.py", line 484, in setConnection  
    engine = create_engine(uri, **params)  
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/__init__.py", line 332, in create_engine  
    return strategy.create(*args, **kwargs)  
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/strategies.py", line 48, in create  
    u = url.make_url(name_or_url)  
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/url.py", line 154, in make_url  
    return _parse_rfc1738_args(name_or_url)  
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/url.py", line 196, in _parse_rfc1738_args  
    "Could not parse rfc1738 URL from string '%s'" % name)  
  ArgumentError: Could not parse rfc1738 URL from string 'sqlite:/home/user/random/mov.db'  
Was it helpful?

Solution

Try using a URI that specify the full path. Something like this should work:

sqlite:///home/user/random/mov.db

Notice the triple slashes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top