#26839: Migrate: TypeError: 'module' object is not callable ---------------------------------+-------------------------------------- Reporter: Henrique Chehad | Owner: nobody Type: Uncategorized | Status: closed Component: Migrations | Version: 1.9 Severity: Normal | Resolution: invalid Keywords: | Triage Stage: Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 ---------------------------------+--------------------------------------
Comment (by cronywalls): This error statement [http://net-informations.com/python/iq/typeerror.htm 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 happend 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. 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. -- Ticket URL: <https://code.djangoproject.com/ticket/26839#comment:7> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/072.2cc16ef11acfee684a0c9989dc4f13c9%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.