Edgewall Software
Modify

Opened 15 years ago

Closed 14 years ago

Last modified 3 years ago

#8596 closed defect (invalid)

TypeError: 'module' object is not callable

Reported by: gamial@… Owned by:
Priority: normal Milestone:
Component: general Version: 0.11
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

install discussion on track, and add a forum. so i got this

How to Reproduce

While doing a POST operation on /discussion, Trac issued an internal error.

(please provide additional details here)

Request parameters:

{'__FORM_TOKEN': u'0489f32d5c6fe840583f9e05',
 'description': u'h',
 'discussion_action': u'post-add',
 'group': u'1',
 'name': u'f',
 'subject': u'g',
 'submit': u'Submit',
 'subscribers': u'h'}

User Agent was: Mozilla/5.0 (X11; U; Linux i686; ru; rv:1.9.0.11) Gecko/2009060200 SUSE/3.0.11-0.1.1 Firefox/3.0.11

System Information

Trac 0.11
Python 2.5.2 (r252:60911, Oct 5 2008, 19:42:18)
[GCC 4.3.2]
setuptools 0.6c9
SQLite 3.5.9
pysqlite 2.4.1
Genshi 0.5
mod_python 3.3.1
Pygments 0.10
Subversion 1.5.1 (r32289)
jQuery: 1.2.3

Python Traceback

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/trac/web/main.py", line 423, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.5/site-packages/trac/web/main.py", line 197, in dispatch
    resp = chosen_handler.process_request(req)
  File "build/bdist.linux-i686/egg/tracdiscussion/core.py", line 108, in process_request
    template, data = api.process_discussion(context)
  File "build/bdist.linux-i686/egg/tracdiscussion/api.py", line 222, in process_discussion
    self._do_actions(context, actions)
  File "build/bdist.linux-i686/egg/tracdiscussion/api.py", line 712, in _do_actions
    listener.forum_created(context, context.forum)
  File "build/bdist.linux-i686/egg/tracdiscussion/notification.py", line 179, in forum_created
    notifier.invite(context, forum, None, forum['subscribers'])
  File "build/bdist.linux-i686/egg/tracdiscussion/notification.py", line 100, in invite
    NotifyEmail.notify(self, id, subject)
  File "/usr/lib/python2.5/site-packages/trac/notification.py", line 241, in notify
    Notify.notify(self, resid)
  File "/usr/lib/python2.5/site-packages/trac/notification.py", line 130, in notify
    self.send(torcpts, ccrcpts)
  File "build/bdist.linux-i686/egg/tracdiscussion/notification.py", line 126, in send
    header['Message-ID'] = self.get_forum_email_id(self.forum['id'])
  File "build/bdist.linux-i686/egg/tracdiscussion/notification.py", line 160, in get_forum_email_id
    digest = md5(s).hexdigest()
TypeError: 'module' object is not callable

Attachments (0)

Change History (4)

comment:1 by osimons, 15 years ago

Resolution: invalid
Status: newclosed

comment:2 by shubham_chakraborty@…, 14 years ago

Priority: normalhigh
Resolution: invalid
Status: closedreopened

I have setup discussion plugin on Apache-mod python + MYsql server and the Tracd standalone +Sqlite version. It gives the above error in Apache while it works perfectly on Tracd. What can be the problem??

comment:3 by Remy Blank, 14 years ago

Priority: highnormal
Resolution: invalid
Status: reopenedclosed

If you have the exact same error, then it's still a PluginIssue, please read that page and report the issue to the plugin maintainer. Also, please use the MailingList and/or IrcChannel for installation support.

comment:4 by anonymous, 5 years ago

This error statement TypeError: 'module' object is not callable is raised as you are being confused about the Class name and Module name. The problem is in the import line . You are importing a module, not a class. This happennd because the module name and class name have the same name .

If you have a class MyClass in a file called MyClass.py, then you should import :

from MyClass import MyClass

In Python , a script is a module, whose name is determined by the filename . So when you start out your file MyClass.py with import MyClass you are creating a loop in the module structure….example

In Python, everything (including functions, methods, modules, classes etc.) is an object , and methods are just attributes like every others. So,there's no separate namespaces for methods. So when you set an instance attribute, it shadows the class attribute by the same name. The obvious solution is to give attributes different names.

Last edited 5 years ago by Jun Omae (previous) (diff)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from (none) to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.