[Tutor] [OSX] "Executable" .py or pyc script (stuck at Applescript)

learner404 learner404 at gmail.com
Thu Nov 10 16:20:05 CET 2011

On Thu, Nov 10, 2011 at 2:14 PM, Steven D'Aprano <steve at pearwood.info>wrote:

> learner404 wrote:
>> Hello list!
>> - myapp.py is in a "myfolder" folder that the "users" will be able to
>> download and put anywhere on their Mac.
> [...]
>  In both cases OSX complains it can't find the file.
> Do you mean that AppleScript can't find the file, or that Python can't
> find the file?

When I double click on the AppleScript the terminal opens with

$ python myapp.py
$ python: can't open file 'avcOsxLinux.py': [Errno 2] No such file or

myapp.py and the AppleScript are both in the same directory. If I open
manually a shell in this directory "python myapp.py" works.

It all seems like the Python invoked in the AppleScript have his current
directory in root (and not the folder where i'm executing the AppleScript).
I don't see how I can change this from the AppleScript or simply find a
general solution to execute a .py script on Mac within the constrains I
mentioned above.

> Please don't summarize or paraphrase errors. Please copy and paste the
> EXACT error message that is shown.
> If this is a problem with AppleScript being unable to find the file, you
> will be better off asking on an AppleScript mailing list.
> In general, on Unix-like systems (and that includes Mac OS X), you can't
> expect a command like:
> python myapp.py
> to work unless myapp.py is in the current directory.
> --
> Steven
> ______________________________**_________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/**mailman/listinfo/tutor<http://mail.python.org/mailman/listinfo/tutor>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20111110/62912049/attachment.html>

More information about the Tutor mailing list