At Thursday 14/12/2006 17:13, rich murphy wrote:

Thanks to everyone who responded with valuable suggestions. I
appreciate them all. I found the exact reason why "import" command
fails.

At the beginning I created my script file with MS Notepad. After
studying all the advice, I realized that I did not try other text
editors just becuase the tutorial says: "use your favorite text editor
to create a file called fibo.py in the current directory with the
following contents:"

I bet your file is actually called fibo.py.txt then.
(Perhaps some advise should be provided for Windows users, about enclosing the name inside "double quotes", or selecting "All files (*.*)" on the file type list)

Then I created another file with the same stuff in it using WordPad.
The behaviour of the "import" command improved a lot but still not
good.

Uhm... either the import was successful, or not. Care to explain what you mean?

>>> fibo.fib2(100)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "C:\Python24\fibo.py", line 11, in fib2
    while b < n:
UnboundLocalError: local variable 'b' referenced before assignment

Compare your function with the version shown in the tutorial. Variable 'b' is assigned on the previous line.


--
Gabriel Genellina
Softlab SRL
__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to