Question

I'm using py2app to freeze a python app so I can distribute it under OSX.

For Windows, I use bbfreeze, and it has an option to say "keep the console around". This is very useful in debug situations, for catching exceptions early in the application startup on a user's machine where python is not installed.

I need to know how to do this for py2app in OSX.

I've tried wx.App(True), but the window that is thusly created doesn't stay open.

How can I construct my wxpython app in such a way that I can always see any error messages that might result at startup...

Thanks!

Était-ce utile?

La solution

The documentation for py2app does cover how to show the console. See the following:

I usually don't want the command window in my applications when I put them on a client's machine. It typically annoys the client. Instead I would create log file using Python's logging module. You could create the logger object before you call your wxPython code and just pass the logger in. Something like this:

frame = MyFrame(logger)

Then you can catch error messages and have them logged to the log file. To keep the log file from becoming overly large, I would recommend creating a rotating log. See the docs for more information:

There also appears to be another way to create app bundles on Mac that I've never heard of. It is called Platypus. You might want to check that out as well.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top