[Tutor] interactive questions
rick
rdole1 at cogeco.ca
Sat Dec 26 05:45:52 CET 2009
On Sat, 2009-12-26 at 03:03 +0100, tutor-request at python.org wrote:
> > which works "as advertised" in an interactive session, but not in a
> > script. Yes, I tried tossing the script to both versions of
> > interpreter, it doesn't work with either 2.6 or 3.1.
>
> Somehow you are picking up an older v2 interpreter.
> How are you running the script?
> >From within IDLE? Or from an OS command?
>
> If the latter try using the full path to the v3 Python interpreter.
>
> HTH,
>
>
Hi Alan,
from within geany.
The first line is either
#!/usr/bin/python
or
#!/usr/bin/python3
rick at rick-desktop:~$ file /usr/bin/python
/usr/bin/python: symbolic link to `python2.6'
rick at rick-desktop:~$ file /usr/bin/python3
/usr/bin/python3: symbolic link to `python3.1'
I just think it odd that there is one behaviour in an interactive
session, and a different behaviour when run from a script.
interesting again, running it right from bash, it works just fine, as
long as the first line calls v3.1.
Could geany be calling the 2.6 interpreter, even with v3 in the first
line? oh my, that is unexpected, just tried it.
#!/usr/bin/python3
import sys
print(sys.version)
from geany yields:
2.6.4 (r264:75706, Dec 7 2009, 18:43:55)
[GCC 4.4.1]
but from bash yields:
3.1.1+ (r311:74480, Nov 2 2009, 15:45:00)
[GCC 4.4.1]
Rick
More information about the Tutor
mailing list