Don't understand error message

Michael Hudson mwh21 at
Tue Apr 25 13:22:03 EDT 2000

"Lars Lundstedt" <lars.lundstedt at> writes:

> I'm halfway through "Learning Python" and I'm stuck on the example on page
> 255.
> It goes like this:
> import sys, glob, operator
> print sys.argv[1:]
> sys.argv = reduce(operator.add, map(glob.glob, sys.argv))
> print sys.argv[1:]
> When called with "python *.py" on Win98 I'm supposed to get a list
> of all .py files in the current directory but instead I get:
> Traceback (innermost last):
>   File "", line 1, in ?
>     import sys, glob, operator
>   File "", line 3, in ?
>     list = reduce(operator.add, map(glob.glob, '*.py'))
> TypeError: call of non-function (type module)
> Anyone know why?

"Works here".  Is that *really* your *entire* script?  You haven't
snuck a module called "reduce" in anywhere?

Mind you, I'm on Linux - but that's shouldn't really affect this.


  "declare"?  my bogometer indicates that you're really programming
  in some other language and trying  to force Common Lisp into your
  mindset.  this won't work.           -- Erik Naggum, comp.lang.lisp

More information about the Python-list mailing list