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

2006-08-15 Thread Charles Russell
Marc 'BlackJack' Rintsch wrote: > Here's the index of the reference manual: > > http://docs.python.org/ref/genindex.html > Thanks. When I go up a level from there, I find a pointer to the index right at the bottom of the table of contents, which I had overlooked. -- http://mail.python.org/m

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

2006-08-15 Thread Charles Russell
Charles Russell wrote: I haven't found the magic word to invoke a > .py script from the python prompt (like the command "source" in csh, > bash, tcl?) Seems to be execfile() -- http://mail.python.org/mailman/listinfo/python-list

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

2006-08-14 Thread Charles Russell
Charles Russell wrote: But why does the > conflict not occur when the code is run interactively from the python > prompt? Because, I now realize, I had not yet created glob.py when I tried that. -- http://mail.python.org/mailman/listinfo/python-list

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

2006-08-14 Thread Charles Russell
John Machin wrote: > > Contemplate the following: > > C:\junk>type glob.py > if __name__ == "__main__": > print "*** Being run as a script ..." > import glob > print "glob was imported from", glob.__file__ > print "glob.glob is", type(glob.glob) > print "glob.glob was importe

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

2006-08-14 Thread Charles Russell
Marc 'BlackJack' Rintsch wrote: > > Don't call your file `glob.py` because then you import this module and not > the `glob` module from the standard library. > > Ciao, > Marc 'BlackJack' Rintsch Yes, thanks. Renaming to myglob.py solved the problem. But why does the conflict not occur w

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

2006-08-14 Thread Charles Russell
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