Hmm, OK. I can't reproduce this. I created a file called /home/giles/p27hashbang.py
with the following contents:
#!/usr/local/bin/python2.7
import sys
print(sys.version)
I made it executable and confirmed that the hashbang worked from a bash console:
14:56 ~ $ chmod +x p27hashbang.py
14:57 ~ $ ./p27hashbang.py
2.7.3 (default, Jun 7 2012, 18:18:02)
[GCC 4.4.5]
14:57 ~ $
Then I confirmed that if I specified the Python version on the command line, it used the specified version:
14:57 ~ $ /usr/local/bin/python3.2 p27hashbang.py
3.2.3 (default, Jun 7 2012, 18:25:14)
[GCC 4.4.5]
14:57 ~ $
Then I created a scheduled task that ran it, also specifying the Python version:
/usr/local/bin/python3.2 /home/giles/p27hashbang.py
The log output from this was:
3.2.3 (default, Jun 7 2012, 18:25:14)
[GCC 4.4.5]
2012-06-22 14:59:10 -- Completed task, took 2.00 seconds, return code was 0.
Would you like me to take a look at your scheduled tasks and see if there's a difference? We can switch to email if there's private stuff involved.