Re: Getting Error: undefined symbol: sqlite3_enable_shared_cache
Christian Boos <[email protected]>
| Newsgroups | gmane.comp.python.db.pysqlite.user |
|---|---|
| Message-ID | <[email protected]> |
Jeremy Gillick wrote: > OK, I figured out how to get Trac to work. Looking at the error > "global name 'sqlite' is not defined", I thouch that it could be a > scope thing (please remember I don't know Python). The error > originated in site-packages/trac/db/sqlite_backend.py which imports > sqlite like this: > > > try: > import pysqlite2.dbapi2 as sqlite > have_pysqlite = 2 > ... > Well, the above code works for everybody else... it first tries to get an installed pysqlite2, then tries to revert to the packaged sqlite3 module that comes with Python 2.5, finally tries to get the pysqlite1 module. The try/except clauses are essential to be able to attempt those imports in sequence, until one succeeds (if none succeed, have_pysqlite == 0 and the rest of the code shouldn't produce an error either). > > Figuring that somehow the try block put sqlite out of the global > scope, I decided to add the import line above the try block: > > *import pysqlite2.dbapi2 as sqlite* > try: > import pysqlite2.dbapi2 as sqlite > have_pysqlite = 2 > ... And I really have no clue why the latter would work but not the former... If someone figures out, I'm very much interested in the answer ;-) -- Christian