[Pythonmac-SIG] py2app basics

Bob Ippolito bob at redivi.com
Sat Feb 5 07:59:21 CET 2005


On Feb 4, 2005, at 9:16 PM, Chris Jerdonek wrote:

> Hi, I'm trying to use py2app on an open-source program that I 
> basically understand the workings of, but didn't write.
>
> I've tried "python setup.py py2app" several times, but it doesn't 
> work.  I get error messages like the one below, when I click on the 
> resulting app icon:
>
> 	An unexpected error has occurred during execution of the main script
> 	IOError: [Errno 2] No such file or directory: '-psn_0_42205185
>
> Where do I start?  I really don't know the principle behind the 
> setup.py file, what it does, what py2app does, what needs to be in 
> setup.py for things to work, etc.  How can I tell?  I've checked out a 
> few of the sample files, but I don't see how they apply to my 
> situation.  The program uses wxPython if that matters.  I'm using OSX 
> 10.3.7 and Python 2.3.
>
> I'm not an experienced programmer, but I can learn fast.  It's just 
> hard without documentation.  (Maybe py2app is intended for people that 
> already know what they're doing)  Anyways, I'm glad py2app is out 
> there for people.  Ok, thanks a lot for anything to help get me 
> started.

py2app doesn't have documentation yet[1] because I haven't had the time 
and interest to write it.  I'm more interested in implementing the 
features on my TODO list right now.  I released it because it's very 
useful and much better than the poorly documented and much more fragile 
and incorrect alternative(s).  If someone else writes such 
documentation, I will gladly accept it.

In your specific case you are trying to use a script that expects 
command-line arguments.  Mac OS X's LaunchServices does not provide 
command line arguments useful to anything but the Carbon/Cocoa 
runtimes, so you have two choices:
(a) don't use sys.argv
(b) use py2app with --argv-emulation, which will hide the -psn argument 
from Python and will convert any dropped files into command-line 
arguments.

[1] python setup.py py2app --help does yield some usage information, 
and there are quite a few examples between the py2app and PyObjC 
sources.

-bob



More information about the Pythonmac-SIG mailing list