TypeError: 'module' object is not callable

G

Gary Wessle

dear python users

I am not sure why I am getting

****************************************************************
Traceback (most recent call last):
File "my.py", line 3, in ?
urlparse('http://www.cwi.nl:80/~guido/Python.html')
TypeError: 'module' object is not callable
****************************************************************

with this code

****************************************************************
import urlparse

urlparse('http://www.cwi.nl:80/~guido/Python.html')
****************************************************************


thank you
 
J

John Machin

dear python users

I am not sure why I am getting

****************************************************************
Traceback (most recent call last):
File "my.py", line 3, in ?
urlparse('http://www.cwi.nl:80/~guido/Python.html')
TypeError: 'module' object is not callable
****************************************************************

with this code

****************************************************************
import urlparse

urlparse('http://www.cwi.nl:80/~guido/Python.html')
****************************************************************

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)

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top