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

Bill address at is.invalid
Mon Mar 15 11:09:11 EST 2004


Pay up :-) Cut and pasted from script:

import random

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

Other ideas? Thanks!
Bill

"Tim Roberts" <timr at probo.com> wrote in message
news:vjka50dllikgbrmnel0b55ldrsq95tsvga at 4ax.com...
> "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