[Pythonmac-SIG] MacPython 2.3a2 on OSX 10.1
Daniel Lord
wildpixel@mac.com
Fri, 28 Feb 2003 11:21:29 -0800
--Apple-Mail-2--566587316
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
format=flowed
I can verify that one can use and Applescript in an App bundle to call
a python script in it. I created an Applescript Studio GUI as a wrapper
for a recursive file renaming and moving Python script and it works
very well. You find the path to the script in the bundle and call it as
follows:
(* Find path to python script *)
set POSIXBasePath to POSIX path of (path to me)
set scriptPath to (POSIXBasePath & scriptName)
set theResult to do shell script ("/usr/local/bin/python " & "'" &
scriptPath & "' " & cmdStr & fileArg) as string
-- where cmdStr is your options and fileArg contains the
command-line args
-- this is how I call it, there are other ways
Daniel Lord
> From: Paul Berkowitz <berkowit@silcom.com>
> Date: Fri Feb 28, 2003 08:52:50 US/Pacific
> To: PythonMac <pythonmac-sig@python.org>
> Subject: Re: [Pythonmac-SIG] MacPython 2.3a2 on OSX 10.1
>
>
> On 2/28/03 7:48 AM, "Kevin Ollivier" <kevino@tulane.edu> wrote:
>
>>> I've tried a couple of #! scripts in .app bundles on 10.1, but they
>>> invariably give me an "Error -2857" on the console.
>>> So I guess this means that having a script as the main program in a
>>> .app bundle doesn't work under 10.1:-(
>>
>> Just a thought that crossed my mind - would an Applescript work? =) (I
>> thought Applescript for 10.1 supported sending commands to the shell.)
>
> Yes, it does. 'do shell script "whatever"'.
>
> I can't recall if 'quoted form of POSIX path' came in with OS 10.2 (AS
> 1.9)
> or earlier. I think it was AS 1.8.3, which is a free update to OS
> 10.1.5,
> but will work with all versions of 10.1.x. Maybe even AS 1.8.1, which
> shipped with OS 10.1.2. OS 10.1.0 shipped with AS 1.7, which is not a
> good
> version of AS, although I think it had 'do shell script' already. Best
> would
> be to require AS 1.8.3 and do all testing in OS 10.1 with that, but you
> could even go back to 10.1.0 and just not use 'quoted form' but always
> include all the "\"" or ' quotes yourself.
>
> --
> Paul Berkowitz
>
>
>
>
>
>
>
--Apple-Mail-2--566587316
Content-Transfer-Encoding: 7bit
Content-Type: text/enriched;
charset=US-ASCII
I can verify that one can use and Applescript in an App bundle to call
a python script in it. I created an Applescript Studio GUI as a
wrapper for a recursive file renaming and moving Python script and it
works very well. You find the path to the script in the bundle and
call it as follows:
<fontfamily><param>Geneva</param><smaller> (*<color><param>3333,3333,3333</param>
Find path to python script </color>*)
<color><param>DDDD,0000,0000</param>set</color>
<color><param>4040,8080,0000</param>POSIXBasePath</color>
<color><param>DDDD,0000,0000</param>to</color>
<color><param>0000,0000,FFFF</param>POSIX path</color>
<color><param>DDDD,0000,0000</param>of</color>
(<color><param>0000,0000,FFFF</param>path to</color>
<color><param>DDDD,0000,0000</param>me</color>)
<color><param>DDDD,0000,0000</param>set</color>
<color><param>4040,8080,0000</param>scriptPath</color>
<color><param>DDDD,0000,0000</param>to</color>
(<color><param>4040,8080,0000</param>POSIXBasePath</color> &
<color><param>4040,8080,0000</param>scriptName</color>)
<color><param>DDDD,0000,0000</param>set</color>
<color><param>4040,8080,0000</param>theResult</color>
<color><param>DDDD,0000,0000</param>to</color>
<color><param>0000,0000,FFFF</param>do shell script</color>
("/usr/local/bin/python " & "'" &
<color><param>403F,807F,0000</param>scriptPath</color> & "' " &
<color><param>4040,8080,0000</param>cmdStr</color> &
<color><param>4040,8080,0000</param>fileArg</color>)
<color><param>DDDD,0000,0000</param>as</color>
<color><param>0000,0000,FFFF</param>string
-- where cmdStr is your options and fileArg contains the
command-line args
-- this is how I call it, there are other ways</color>
</smaller></fontfamily>
Daniel Lord
<excerpt><bold>From: </bold>Paul Berkowitz <<berkowit@silcom.com>
<bold>Date: </bold>Fri Feb 28, 2003 08:52:50 US/Pacific
<bold>To: </bold>PythonMac <<pythonmac-sig@python.org>
<bold>Subject: </bold>Re: [Pythonmac-SIG] MacPython 2.3a2 on OSX 10.1
On 2/28/03 7:48 AM, "Kevin Ollivier" <<kevino@tulane.edu> wrote:
<excerpt><excerpt>I've tried a couple of #! scripts in .app bundles on
10.1, but they
invariably give me an "Error -2857" on the console.
So I guess this means that having a script as the main program in a
.app bundle doesn't work under 10.1:-(
</excerpt>
Just a thought that crossed my mind - would an Applescript work? =) (I
thought Applescript for 10.1 supported sending commands to the shell.)
</excerpt>
Yes, it does. 'do shell script "whatever"'.
I can't recall if 'quoted form of POSIX path' came in with OS 10.2 (AS
1.9)
or earlier. I think it was AS 1.8.3, which is a free update to OS
10.1.5,
but will work with all versions of 10.1.x. Maybe even AS 1.8.1, which
shipped with OS 10.1.2. OS 10.1.0 shipped with AS 1.7, which is not a
good
version of AS, although I think it had 'do shell script' already. Best
would
be to require AS 1.8.3 and do all testing in OS 10.1 with that, but you
could even go back to 10.1.0 and just not use 'quoted form' but always
include all the "\"" or ' quotes yourself.
--
Paul Berkowitz
</excerpt>
--Apple-Mail-2--566587316--