TypeError: 'module' object is not callable (newby question)

Charles Russell SPAMworFREEwor at bellsouth.net
Mon Aug 14 13:29:02 EDT 2006


Why does this work from the python prompt, but fail from a script?
How does one make it work from a script?

#! /usr/bin/python
import glob
# following line works from python prompt; why not in script?
files=glob.glob('*.py')
print files

Traceback (most recent call last):
   File "./glob.py", line 2, in ?
     import glob
   File "/home/cdr/python/glob.py", line 5, in ?
     files=glob.glob('*.py')
TypeError: 'module' object is not callable



More information about the Python-list mailing list