On Mar 24, 3:13 pm, pythonnubie <[EMAIL PROTECTED]> wrote:
> > > i  have  come across my first exeption using randrange . The exeption
> > > is " no such  attribute " in  module random
>
> > > platform  is xp  home  and the python  build is activestate 2.5
>
> > Welcome aboard!
>
> > There's definitely a randrange function in the random module, so
> > something else must be wrong. To get the most out of this list and
> > minimize wasted bandwidth, the most effective way usually consists of
> > copying and pasting:
> > 1. The offending code (or just the relevant part if it's too big).
> > 2. The full traceback of the raised exception.
>
> > Regards,
> > George
>
> Hwere is the complete traceback ! >>> The word is:  index
>
> Traceback (most recent call last):
>   File "F:\Python25\Lib\site-packages\pythonwin\pywin\framework
> \scriptutils.py", line 307, in RunScript
>     debugger.run(codeObject, __main__.__dict__, start_stepping=0)
>   File "F:\Python25\Lib\site-packages\pythonwin\pywin\debugger
> \__init__.py", line 60, in run
>     _GetCurrentDebugger().run(cmd, globals,locals, start_stepping)
>   File "F:\Python25\Lib\site-packages\pythonwin\pywin\debugger
> \debugger.py", line 631, in run
>     exec cmd in globals, locals
>   File "F:\Documents and Settings\Mark\My Documents\rand.py", line 5,
> in <module>
>     import random
>   File "F:\Documents and Settings\Mark\My Documents\random.py", line
> 13, in <module>
>     distributions on the real line:
> AttributeError: 'module' object has no attribute 'randrange'
>
> Why  would it say  it can't find the function ?

Because you named your file 'random.py' and it shadows the standard
random module! Change the name to something else, say foo.py, and try
it again.

George

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to