AttributeError: 'Environment' object has no attribute 'get_read_db'
|Reported by:||Gustavo Rubio||Owned by:||Christopher Paredes|
Hi, I compiled and installed the plugin and then did the trac instance upgrade as pointed by the installation. The "Projects" link appears in the admin panel but as soon as I click on it a message appears:
Trac detected an internal error: AttributeError: 'Environment' object has no attribute 'get_read_db'
First let me say that I actually don't know if this plugin is intended to be only used in trac 0.12.x instances. I have 0.11.7 installed running on FastCGI with SQLite. The reason I'm reporting this issue is because I did not find any information regarding the versio needed on the hacks page. That being said, I googled a little bit about the error, which is shown as a general Trac, error and found something similar for another hack in #8854, I followed the instructions on one of the comments to do this:
import trac trac.__version__ # verify that this returns a trac 12 version >> '0.12.3dev-r10639' # verify you can connect to the database from python import trac.env e = trac.env.Environment('/var/trac/test') # enter your trac instance directory db = e.get_read_db() cur = db.cursor() cur.execute("SELECT 1") data = cur.fetchone()
Then, as soon as I get to the db = e.get_read_db() line I get this exception:
Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'Environment' object has no attribute 'get_read_db'
Which is of course the same as the exception shown on the Trac page itself when clicking the Projects link. I just want to clear this since the guy on the #8854 ticket got something different after trying the same.
My thoughts are that this is actually a 0.12 > plugin and it won't work on my trac. If this is the case please disregard my ticket but it would be good if the required version was mentioned on the hack page. I've seen some other tickets reported for this plugin with the 0.11 version selected so I still have hopes :)
If you need anything else please let me know.
Thanks in advance.