IDLE vs Command Line

Mark Hadfield m.hadfield at niwa.co.nz
Tue Aug 10 19:43:18 EDT 2004


Jesse B. wrote:
> I like to work with xemacs, so I've been coding modules with xemacs and
> running them using the dos prompt (using windows port of xemacs). Some
> scripts that work fine with IDLE don't work at the dos prompt. For example:
> 
> import random
> 
> for i in range(10):
>     x = random.random()
>     print x
> 
> This simple script doesn't work if  I use the command prompt, with this
> syntax: python random.py
> 
> I am just wondering why that is.

Because you have given the script the same name as the module you're 
importing, so the script tries to import itself?


-- 
Mark Hadfield            "Ka puwaha te tai nei, Hoea tatou"
m.hadfield at niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)

xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx




More information about the Python-list mailing list