#5012 closed defect (worksforme)
'module' object has no attribute 'connect'
| Reported by: | Owned by: | Christopher Lenz | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | web frontend/mod_python | Version: | 0.10.3.1 |
| Severity: | normal | Keywords: | mysql |
| Cc: | Branch: | ||
| Release Notes: | |||
| API Changes: | |||
| Internal Changes: | |||
Description
When this error happens, I would leave my Trac site Idle for a while.
Later, my Trac site is suddenly back to normal. Then, I start working with Trac, post some Tickets, add some Wiki. Then, this error starts to show up again.
So guess what I did, yup, I leave my Trac site Idle for a while. So it goes in a loop.
Please help!!
Traceback (most recent call last):
File "/usr/lib/python2.3/site-packages/mod_python/importer.py", line 1537, in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)
File "/usr/lib/python2.3/site-packages/mod_python/importer.py", line 1229, in _process_target
result = _execute_target(config, req, object, arg)
File "/usr/lib/python2.3/site-packages/mod_python/importer.py", line 1128, in _execute_target
result = object(arg)
File "/usr/lib/python2.3/site-packages/trac/web/modpython_frontend.py", line 87, in handler
gateway.run(dispatch_request)
File "/usr/lib/python2.3/site-packages/trac/web/wsgi.py", line 87, in run
response = application(self.environ, self._start_response)
File "/usr/lib/python2.3/site-packages/trac/web/main.py", line 377, in dispatch_request
env = _open_environment(env_path, run_once=run_once)
File "/usr/lib/python2.3/site-packages/trac/web/main.py", line 58, in _open_environment
env_cache[env_path] = open_environment(env_path)
File "/usr/lib/python2.3/site-packages/trac/env.py", line 435, in open_environment
if env.needs_upgrade():
File "/usr/lib/python2.3/site-packages/trac/env.py", line 313, in needs_upgrade
db = self.get_db_cnx()
File "/usr/lib/python2.3/site-packages/trac/env.py", line 182, in get_db_cnx
return DatabaseManager(self).get_connection()
File "/usr/lib/python2.3/site-packages/trac/db/api.py", line 75, in get_connection
return self._cnx_pool.get_cnx(self.timeout or None)
File "/usr/lib/python2.3/site-packages/trac/db/pool.py", line 101, in get_cnx
cnx = self._connector.get_connection(**self._kwargs)
File "/usr/lib/python2.3/site-packages/trac/db/mysql_backend.py", line 40, in get_connection
return MySQLConnection(path, user, password, host, port, params)
File "/usr/lib/python2.3/site-packages/trac/db/mysql_backend.py", line 139, in __init__
cnx = MySQLdb.connect(db=path, user=user, passwd=password,
AttributeError: 'module' object has no attribute 'connect'
Attachments (0)
Change History (10)
comment:1 by , 19 years ago
| Keywords: | needinfo added |
|---|
comment:2 by , 19 years ago
| Version: | → 0.10.3.1 |
|---|
comment:4 by , 19 years ago
Plugins I have installed:
- TracAccountManager 0.1.3dev-r2063
- TracDiscussion 0.5
- TracNav 3.92
- TracNavHider 1.0
- TracWebAdmin 0.1.2dev-r4429
comment:5 by , 19 years ago
| Component: | general → mod_python frontend |
|---|---|
| Milestone: | → 0.10.5 |
| Owner: | changed from to |
Can you try to add:
PythonInterpreter main_interpreter
in your <Location> section?
comment:6 by , 19 years ago
Also, what mod_python version are you using?
Do you also have PHP active in that setup? (see possibly related #4459)
In order to sort out what's happening, can you make the following changes?
Index: trac/db/mysql_backend.py
===================================================================
--- trac/db/mysql_backend.py (revision 5135)
+++ trac/db/mysql_backend.py (working copy)
@@ -145,6 +145,9 @@
def __init__(self, path, user=None, password=None, host=None,
port=None, params={}):
import MySQLdb
+ print `MySQLdb`
+ from pprint import pprint
+ pprint(MySQLdb.__dict__)
if path.startswith('/'):
path = path[1:]
comment:7 by , 19 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Your suggestion PythonInterpreter main_interpreter reminded me I probably have multiple versions of python laying around because previously I did a yum install on python & mysql-python and didn't find it quite right. So I recompiled them from source but didn't remove the old one.
I might be wrong but my guess is Trac was randomly using either one of the interpreter, that's why this happens once in a while.
Thanks a lot for the input cboos though I didn't follow your suggestions. I just removed all python & mysql-python and recompiled them.
My Trac is site is working fine now.
comment:8 by , 19 years ago
| Keywords: | needinfo removed |
|---|---|
| Milestone: | 0.10.5 |
| Resolution: | fixed |
| Status: | closed → reopened |
comment:9 by , 19 years ago
| Keywords: | mysql added |
|---|---|
| Resolution: | → worksforme |
| Status: | reopened → closed |
Ok, I'm glad it works for you now. However we missed the opportunity to know a little more about this kind of strange error messages. If someone else experiences this in the future, please follow-up on #4459 instead of reopen this ticket, thanks!
comment:10 by , 6 years ago
In my case there is chmod (access rights to installed module, there was only 0700) after I've fix it, I've get full functionality.



Which version of Trac, which version of MySQLdb are you using?
Have you installed some plugins?