random.random - Interpreter works, Script doesn't?

Tim Roberts timr at probo.com
Mon Mar 15 01:52:27 EST 2004


"Bill" <> wrote:

>Hello,
>If I type the following code directly into the interpreter, it works. If I
>run it from a script, it generates the following error. Can someone help?
>Thanks!
>
>------------------------
>
>import random
>
>for i in range(10):
>    x = random.random()
>    print x
>
>------------------------
>
>TypeError: 'module' object is not callable

I'll wager money that your script actually says this:

  import random

  for i in range(10):
      x = random()
      print x

...which IS trying to call a module.
-- 
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-list mailing list