[Tutor] python newbie need help
Kalle Svensson
kalle@gnupung.net
Sat, 22 Sep 2001 15:02:20 +0200
[Rino Mardo]
> hi. i have debian2.2r0 system with python-1.5.2 installed. i went
> thru the info doc of my python install and just can't seem to find out
> why my code only runs in interactive mode and not from the shell.
>
> Here is my code sample:
>
> #! /usr/bin/python
> # Euclid's method for finding a common factor of two numbers
>
> def faktor(a,b):
> while b != 0:
> a, b = b, a % b
> return a
There are som indentation problems here:
def faktor(a,b):
while b != 0:
a, b = b, a % b
return a
is probably what you want.
> the code is named "test2.py" from the shell and i was able to import
> it from the interactive python and was able to call and run it. what
> i want to do is run it from my shell. what could i be missing?
Have you set the executable bit (chmod +x test2.py)? Otherwise I don't know.
What happens when you try to run it from the shell?
Peace,
Kalle
--
[ Thought control, brought to you by the WIPO! ]
[ http://anti-dmca.org/ http://eurorights.org/ ]