Thread: [SQLObject] No module named sqlite
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Alexei V. <ale...@gm...> - 2005-08-04 19:37:12
|
Hello, I'm new to SQLObject 0.6.1 and trying to get it to work with pysqlite 2.0 and Python 2.4.1 on Windows XP SP1. I am trying to run this code from the Python shell: from sqlobject import * import os conn = connectionForURI("sqlite:/" + os.getcwd() + "/database.db") The code above gives the error "No module named sqlite". The full traceback is as follows: Traceback (most recent call last): File "<pyshell#3>", line 1, in ? conn = connectionForURI("sqlite:/" + os.getcwd() + "/database.db") File "D:\Python24\Lib\site-packages\sqlobject\dbconnection.py", line 658, in connectionForURI conn = self.schemeBuilders[scheme]().connectionFromURI(uri) File "D:\Python24\lib\site-packages\sqlobject\sqlite\sqliteconnection.py", line 28, in connectionFromURI return cls(filename=path, **args) File "D:\Python24\lib\site-packages\sqlobject\sqlite\sqliteconnection.py", line 13, in __init__ import sqlite ImportError: No module named sqlite What am I doing wrong? Thanks. -- Best regards, Alexei Vinidiktov |
From: Todd G. <tgr...@ya...> - 2005-10-13 23:20:13
|
I am having troubles with sqlite/sqlobject: REPRO: - start python - import sqlite - close python - launch turbogear admin util - turbogear craps out b/c SQLObject is trying to import sqlite - (details below) - i have tried this with both the SQLObject-0.7rc1-py2.4.egg that comes when you easyinstall turbogears as well as the .tar.gz version and running python setup.py install, same results QUESTION: - why does the manual import work, and not from sqliteconnection.py ? - why does sqliteconnection.py assume that i only have pysqlite2 installed? i have both: $:~/working/turbogear/wiki20$ dpkg -l | grep sqlite ii libsqlite0 2.8.16-1 SQLite shared library ii libsqlite3-0 3.2.7-1 SQLite 3 shared library ii libsqlite3-dev 3.2.7-1 SQLite 3 development files ii python-sqlite 1.0.1-4 python interface to SQLite 2 ii python2.3-pysqlite2 2.0.4-1 python interface to SQLite 3 ii python2.3-sqlite 1.0.1-4 python interface to SQLite 2 ii python2.4-pysqlite2 2.0.4-1 python interface to SQLite 3 ii python2.4-sqlite 1.0.1-4 python interface to SQLite 2 ii sqlite 2.8.16-1 command line interface for SQLite ii sqlite3 3.2.7-1 A command line interface for SQLite 3 -- DETAILS $:~/bin/SQLObject-0.7rc1$ sqlite SQLite version 2.8.16 Enter ".help" for instructions sqlite> $:~/bin/SQLObject-0.7rc1$ sqlite3 SQLite version 3.2.7 Enter ".help" for instructions sqlite> $:~/working/turbogear/wiki20$ python Python 2.4.2 (#2, Sep 29 2005, 00:23:59) [GCC 4.0.2 (Debian 4.0.1-9)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import sqlite >>> dir(sqlite) ['BINARY', 'Binary', 'Connection', 'Cursor', 'DATE', 'DBAPITypeObject', 'DataError', 'DatabaseError', 'Error', 'INT', 'IntegrityError', 'InterfaceError', 'InternalError', 'NUMBER', 'NotSupportedError', 'OperationalError', 'PgResultSet', 'ProgrammingError', 'ROWID', 'STRING', 'TIME', 'TIMESTAMP', 'UNICODESTRING', 'Warning', '__all__', '__builtins__', '__doc__', '__file__', '__name__', '__path__', '__revision__', '_sqlite', 'apilevel', 'connect', 'decode', 'encode', 'main', 'paramstyle', 'threadsafety', 'version', 'version_info'] >>> $:~/working/turbogear/wiki20$ tg-admin sql create Using database URI sqlite:///home/tgreenwo/working/turbogear/wiki20/wiki20_db Traceback (most recent call last): File "/usr/local/bin/tg-admin", line 7, in ? sys.exit( File "/usr/local/lib/python2.4/site-packages/TurboGears-0.8a1-py2.4.egg/turbogears/command/__init__.py", line 186, in main command.run() File "/usr/local/lib/python2.4/site-packages/TurboGears-0.8a1-py2.4.egg/turbogears/command/__init__.py", line 106, in run command.the_runner.run(sys.argv) File "/usr/local/lib/python2.4/site-packages/SQLObject-0.7rc1-py2.4.egg/sqlobject/manager/command.py", line 102, in run runner.run() File "/usr/local/lib/python2.4/site-packages/SQLObject-0.7rc1-py2.4.egg/sqlobject/manager/command.py", line 233, in run self.command() File "/usr/local/lib/python2.4/site-packages/SQLObject-0.7rc1-py2.4.egg/sqlobject/manager/command.py", line 543, in command for soClass in self.classes(require_some=True): File "/usr/local/lib/python2.4/site-packages/SQLObject-0.7rc1-py2.4.egg/sqlobject/manager/command.py", line 255, in classes conn = self.connection() File "/usr/local/lib/python2.4/site-packages/SQLObject-0.7rc1-py2.4.egg/sqlobject/manager/command.py", line 316, in connection return sqlobject.connectionForURI(self.options.connection_uri) File "/usr/local/lib/python2.4/site-packages/SQLObject-0.7rc1-py2.4.egg/sqlobject/dbconnection.py", line 913, in connectionForURI conn = self.schemeBuilders[scheme]().connectionFromURI(uri) File "/usr/local/lib/python2.4/site-packages/SQLObject-0.7rc1-py2.4.egg/sqlobject/sqlite/sqliteconnection.py", line 59, in connectionFromURI return cls(filename=path, **args) File "/usr/local/lib/python2.4/site-packages/SQLObject-0.7rc1-py2.4.egg/sqlobject/sqlite/sqliteconnection.py", line 21, in __init__ import sqlite ImportError: No module named sqlite |
From: Oleg B. <ph...@ma...> - 2005-10-14 09:49:44
|
On Thu, Oct 13, 2005 at 04:18:52PM -0700, Todd Greenwood wrote: > $:~/working/turbogear/wiki20$ python > Python 2.4.2 (#2, Sep 29 2005, 00:23:59) > [GCC 4.0.2 (Debian 4.0.1-9)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import sqlite What will be printed by print sqlite.__file__ ? > "/usr/local/lib/python2.4/site-packages/TurboGears-0.8a1-py2.4.egg/turbogears/command/__init__.py", Hmm, it seems you have python2.4 in /usr/local. Are you sure you haven't installed pysqlite into /usr ? Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2005-10-16 19:28:44
|
On Fri, Oct 14, 2005 at 10:10:53AM -0700, Todd Greenwood wrote: > >print sqlite.__file__ > > > /usr/lib/python2.4/site-packages/sqlite/__init__.pyc [skip] > >>"/usr/local/lib/python2.4/site-packages/TurboGears-0.8a1-py2.4.egg/turbogears/command/__init__.py", Look - you have installed pysqlite into /usr and TurboGears into /usr/local. This is why TurboGears canot find pysqlite. Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Jason P. <ce...@ic...> - 2005-08-04 19:42:32
|
looks like you need a more recent version of sqlobject. I had the same problem and it has since been fixed. On Fri, Aug 05, 2005 at 03:34:59AM +0800, Alexei Vinidiktov wrote: > Hello, > > I'm new to SQLObject 0.6.1 and trying to get it to work with pysqlite > 2.0 and Python 2.4.1 on Windows XP SP1. > > I am trying to run this code from the Python shell: > > from sqlobject import * > import os > conn = connectionForURI("sqlite:/" + os.getcwd() + "/database.db") > > The code above gives the error "No module named sqlite". > > The full traceback is as follows: > > Traceback (most recent call last): > File "<pyshell#3>", line 1, in ? > conn = connectionForURI("sqlite:/" + os.getcwd() + "/database.db") > File "D:\Python24\Lib\site-packages\sqlobject\dbconnection.py", line > 658, in connectionForURI > conn = self.schemeBuilders[scheme]().connectionFromURI(uri) > File > "D:\Python24\lib\site-packages\sqlobject\sqlite\sqliteconnection.py", > line 28, in connectionFromURI > return cls(filename=path, **args) > File > "D:\Python24\lib\site-packages\sqlobject\sqlite\sqliteconnection.py", > line 13, in __init__ > import sqlite > ImportError: No module named sqlite > > What am I doing wrong? Thanks. > > -- > Best regards, > Alexei Vinidiktov > > > > > ------------------------------------------------------- > SF.Net email is Sponsored by the Better Software Conference & EXPO > September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices > Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA > Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf > _______________________________________________ > sqlobject-discuss mailing list > sql...@li... > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss |
From: Jason P. <ce...@ic...> - 2005-08-04 19:44:17
|
Oleg puts out tarballs of subversion snapshots here: http://phd.pp.ru/Software/Python/misc/SQLObject On Thu, Aug 04, 2005 at 02:42:29PM -0500, Jason Pepas wrote: > looks like you need a more recent version of sqlobject. I had the same > problem and it has since been fixed. > > On Fri, Aug 05, 2005 at 03:34:59AM +0800, Alexei Vinidiktov wrote: > > Hello, > > > > I'm new to SQLObject 0.6.1 and trying to get it to work with pysqlite > > 2.0 and Python 2.4.1 on Windows XP SP1. > > > > I am trying to run this code from the Python shell: > > > > from sqlobject import * > > import os > > conn = connectionForURI("sqlite:/" + os.getcwd() + "/database.db") > > > > The code above gives the error "No module named sqlite". > > > > The full traceback is as follows: > > > > Traceback (most recent call last): > > File "<pyshell#3>", line 1, in ? > > conn = connectionForURI("sqlite:/" + os.getcwd() + "/database.db") > > File "D:\Python24\Lib\site-packages\sqlobject\dbconnection.py", line > > 658, in connectionForURI > > conn = self.schemeBuilders[scheme]().connectionFromURI(uri) > > File > > "D:\Python24\lib\site-packages\sqlobject\sqlite\sqliteconnection.py", > > line 28, in connectionFromURI > > return cls(filename=path, **args) > > File > > "D:\Python24\lib\site-packages\sqlobject\sqlite\sqliteconnection.py", > > line 13, in __init__ > > import sqlite > > ImportError: No module named sqlite > > > > What am I doing wrong? Thanks. > > > > -- > > Best regards, > > Alexei Vinidiktov > > > > > > > > > > ------------------------------------------------------- > > SF.Net email is Sponsored by the Better Software Conference & EXPO > > September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices > > Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA > > Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf > > _______________________________________________ > > sqlobject-discuss mailing list > > sql...@li... > > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss |
From: Bryan M. <bmu...@gm...> - 2005-08-04 21:10:44
|
On 8/4/05, Alexei Vinidiktov <ale...@gm...> wrote: > Hello, >=20 > I'm new to SQLObject 0.6.1 and trying to get it to work with pysqlite > 2.0 and Python 2.4.1 on Windows XP SP1. >=20 > I am trying to run this code from the Python shell: >=20 > from sqlobject import * > import os > conn =3D connectionForURI("sqlite:/" + os.getcwd() + "/database.db") Looks like you need another slash after sqlite:/ Other than that I have the above working with SQLObject 0.6.0 at home. From the traceback though it looks like you are missing pysqlite. Bryan |
From: Kevin D. <da...@gm...> - 2005-08-05 02:17:19
|
On 8/4/05, Bryan Murdock <bmu...@gm...> wrote: > On 8/4/05, Alexei Vinidiktov <ale...@gm...> wrote: > > from sqlobject import * > > import os > > conn =3D connectionForURI("sqlite:/" + os.getcwd() + "/database.db") >=20 > Looks like you need another slash after sqlite:/ >=20 > Other than that I have the above working with SQLObject 0.6.0 at home. > From the traceback though it looks like you are missing pysqlite. You must not be using pysqlite 2.0. They changed the package name (among many other things) in pysqlite 2.0, and that required some changes in SQLObject that won't be fully released until 0.7. Kevin |
From: Bryan M. <bmu...@gm...> - 2005-08-05 04:27:49
|
On 8/4/05, Kevin Dangoor <da...@gm...> wrote: > On 8/4/05, Bryan Murdock <bmu...@gm...> wrote: > > On 8/4/05, Alexei Vinidiktov <ale...@gm...> wrote: > > > from sqlobject import * > > > import os > > > conn =3D connectionForURI("sqlite:/" + os.getcwd() + "/database.db") > > > > Looks like you need another slash after sqlite:/ > > > > Other than that I have the above working with SQLObject 0.6.0 at home. > > From the traceback though it looks like you are missing pysqlite. >=20 > You must not be using pysqlite 2.0. They changed the package name > (among many other things) in pysqlite 2.0, and that required some > changes in SQLObject that won't be fully released until 0.7. Well, good thing I'm not using 2.0 then! I'll watch for 0.7 and maybe I'll upgrade them both. Bryan |
From: Oleg B. <ph...@ma...> - 2005-08-05 09:12:23
|
On Thu, Aug 04, 2005 at 10:17:12PM -0400, Kevin Dangoor wrote: > You must not be using pysqlite 2.0. They changed the package name > (among many other things) in pysqlite 2.0, and that required some > changes in SQLObject that won't be fully released until 0.7. And even then SQLObject wouldn't be fully compatible with PySQLite2. I need to find a way to stop PySQLite2 be so ubiquitous unicode aware. I think I know the way (register a dummy string converter), but I need time to implement and test the solution. Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |