View

TypeError: 'module' object is not callable.
---------------------------------------------------------------------------

Description

TypeError: 'module' object is not callable.


Suggested solutions

Posted by user:anonymous
The message "TypeError: 'module' object is not callable" means that the
"urlparse" that you are trying to call as a function is a module and is
thus not callable.

The module urlparse contains functions urlparse and urlsplit, among
others. I'm dragging urlsplit into the arena as its name is not the same
as the module name, and it might help you see what is happening. There
are two ways of calling them:

(1)
 >>> import urlparse
 >>> urlparse.urlparse('http://www.cwi.nl:80/%7Eguido/Python.html')
('http', 'www.cwi.nl:80', '/%7Eguido/Python.html', '', '', '')
 >>> urlparse.urlsplit('http://www.cwi.nl:80/%7Eguido/Python.html')
('http', 'www.cwi.nl:80', '/%7Eguido/Python.html', '', '')
 >>>

(2)
 >>> from urlparse import urlparse, urlsplit
 >>> urlparse('http://www.cwi.nl:80/%7Eguido/Python.html')
('http', 'www.cwi.nl:80', '/%7Eguido/Python.html', '', '', '')
 >>> urlsplit('http://www.cwi.nl:80/%7Eguido/Python.html')
('http', 'www.cwi.nl:80', '/%7Eguido/Python.html', '', '')
 >>>

Method (1) is probably better for you at the moment.

I suggest that you read the Modules section in the tutorial:
http://docs.python.org/tut/node8.html

*and* all the earlier sections if you haven't already.


Please Enter Security Code: