Re: applescript/python question

2008-08-02 Thread Diez B. Roggisch

[EMAIL PROTECTED] schrieb:

I can't seem to figure this out.  I just installed Python 2.5.2 a few days ago 
on my OS X 10.4.11
system.  It runs fine and if I type Python -V in the Terminal it outputs Python 
2.5.2 which is
correct.  However, if I try to run a 'do shell script' in AppleScript which I'm 
wanting to run a Python
program, it reverts to using Python 2.3.  For example, if I run this code in 
AppleScript:


set p to #!/usr/bin/python
import sys
print sys.version[:3]
set x to do shell script Python -c \  p  \
return x


I get 2.3.  Does anyone have any ideas why AppleScript is using the older 
version of Python?
Is there a way to fix this?


I guess the shebang is simply ignored - the actual interpreter is 
fetched from the Python -c-line.


It's a bit weird that there is Python with a capital P, but what happens 
if you change that to Python2.5 for example?


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


RE: applescript/python question

2008-08-02 Thread jyoung79
Hi Diez,

Thanks for your reply.  I gave this a try too, but it doesn't seem to work 
either.

However, a gentleman just emailed me off-list recommending to use the full path 
to Python that is in /usr/local/bin.  This is where Python 2.5 looks to be 
installed rather than Python 2.3 which is in /usr/bin.  I ran the following 
code below and it works great!

 
 set p to #!/usr/bin/python
 import sys
 print sys.version[:3]
 set x to do shell script /usr/local/bin/python -c \  p  \
 return x
 

Thank you all again for your thoughts and replies.  I really appreciate it!!

Jay

 I guess the shebang is simply ignored - the actual interpreter is 
 fetched from the Python -c-line.
 
 It's a bit weird that there is Python with a capital P, but what happens 
 if you change that to Python2.5 for example?
 
 Diez
--
http://mail.python.org/mailman/listinfo/python-list


applescript/python question

2008-08-01 Thread jyoung79
I can't seem to figure this out.  I just installed Python 2.5.2 a few days ago 
on my OS X 10.4.11
system.  It runs fine and if I type Python -V in the Terminal it outputs 
Python 2.5.2 which is
correct.  However, if I try to run a 'do shell script' in AppleScript which I'm 
wanting to run a Python
program, it reverts to using Python 2.3.  For example, if I run this code in 
AppleScript:


set p to #!/usr/bin/python
import sys
print sys.version[:3]
set x to do shell script Python -c \  p  \
return x


I get 2.3.  Does anyone have any ideas why AppleScript is using the older 
version of Python?
Is there a way to fix this?

Thanks.

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


Re: applescript/python question

2008-08-01 Thread Sean DiZazzo
On Aug 1, 5:41 pm, [EMAIL PROTECTED] wrote:
 I can't seem to figure this out.  I just installed Python 2.5.2 a few days 
 ago on my OS X 10.4.11
 system.  It runs fine and if I type Python -V in the Terminal it outputs 
 Python 2.5.2 which is
 correct.  However, if I try to run a 'do shell script' in AppleScript which 
 I'm wanting to run a Python
 program, it reverts to using Python 2.3.  For example, if I run this code in 
 AppleScript:

 
 set p to #!/usr/bin/python
 import sys
 print sys.version[:3]
 set x to do shell script Python -c \  p  \
 return x
 

 I get 2.3.  Does anyone have any ideas why AppleScript is using the older 
 version of Python?
 Is there a way to fix this?

 Thanks.

 Jay

Change the first line to

set p to #!/usr/bin/env python

That will execute the default python installation...assuming 2.5.2 is
the default.  Otherwise, you can change that to the absolute path of
the 2.5.2 version.

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