Re: Getting Error: undefined symbol: sqlite3_enable_shared_cache

Jeremy Gillick <svn-guvI891tgwPqlBn2x/[email protected]>
Newsgroups gmane.comp.python.db.pysqlite.user
Message-ID <[email protected]>
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
    except ImportError:
        try:
            import sqlite3 as sqlite
            have_pysqlite = 2
        except ImportError:
            try:
                import sqlite
                have_pysqlite = 1
            except ImportError:
                have_pysqlite = 0


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
    except ImportError:
        try:
            import sqlite3 as sqlite
            have_pysqlite = 2
        except ImportError:
            try:
                import sqlite
                have_pysqlite = 1
            except ImportError:
                have_pysqlite = 0

This seemed to fix it.  Was my reasoning correct?  Can you explain to me 
why this would have happened?

Thanks,
Jeremy

_______________________________________________
pysqlite mailing list
pysqlite-IAPFreCvJWPBWskQ1e/[email protected]
http://lists.initd.org/mailman/listinfo/pysqlite
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.