Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Python, CGI and Sqlite3

4 views
Skip to first unread message

Tim Chase

unread,
Apr 13, 2010, 2:36:17 PM4/13/10
to Majdi Sawalha, pytho...@python.org
On 04/13/2010 12:41 PM, Majdi Sawalha wrote:
> import sqlite3
>
> statement? and it gives the following error
> ImportError: No module named sqlite3,
>
> i tried it on python shell and all statements are work well.

A couple possible things are happening but here are a few that
pop to mind:

1) you're running different versions of python (sqlite was
bundled beginning in 2.5, IIRC) so when you run from a shell, you
get python2.5+ but your CGI finds an older version. Your CGI can
dump the value of sys.version which you can compare with your
shell's version

2) the $PYTHONPATH is different between the two. Check the
contents of sys.path in both the shell and the CGI program to see
if they're the same. You might also dump the results of
os.environ.get('PYTHONPATH', None) to see if an environment
variable specifies the $PYTHONPATH differently

3) while it reads correctly above, it's theoretically possible
that you have a spelling error like "import sqllite3"? I've been
stung once or twice by this sort of problem so it's not entirely
impossible :)

-tkc

Ahmed, Shakir

unread,
Apr 13, 2010, 2:54:30 PM4/13/10
to Majdi Sawalha, pytho...@python.org

-tkc

Tim is right, following import works fine with me.

import sqlite3


--
http://mail.python.org/mailman/listinfo/python-list

0 new messages