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
--
http://mail.python.org/mailman/listinfo/python-list