[Pythonmac-SIG] question

Ronald Oussoren ronaldoussoren at mac.com
Tue Jul 10 07:43:13 CEST 2012


On 10 Jul, 2012, at 1:46, Ed Pataky wrote:

> i have a mac where i installed python, and tornado web server .. i used py2app and created an executable which wraps my tornado kickoff script into an executable .. works ok sometimes, but i am confused about a couple things: 
> 
> 1) when i run the app, since it is essentially a command line script with no GUI, i see nothing, although i is running ... how can i create the  app so that it opens the terminal and shows the output?

You cannot do that using py2app unless you capture stdout/stderr yourself and forward them a Window you create yourself. I don't know how easy it would be to this with Tornado.

> 
> 2) sometimes it gets blocked by the firewall and sometimes it does not .. i have manually gone in and added it to he allowed list in the firewall, then as soon as it tries to open a port, the firewall blocks it ... i am not sure how i did it but i got it work a few times, then sometimes it is blocked .. how can i make sure when i run the app, it has full permission without having to mess with the firewall setting ... for example, is there an admin option when making the executable?

Signing the generated app should help with this, although it should work without signing as well (although you'll have to reconfirm the firewall restriction every time you change the app when you don't sign).

You don't need to use an Apple-provided key for this, any code-signing certificate should work including self-signed.

> 
> 3)  Finally, i am not sure what is actually wrapped in the executable, using basic standard options without specifying libraries to load, etc .. will the executable have the tornado related libraries already there, or it will only run on a mac with tornado already installed ... ?  my macs have tornado so i cannot test this unless i uninstall it ... i guess my question is, is it smart enough to know to include all the tornado stuff too?

Py2app includes all dependencies it can detect. I don't know if anyone has tried using py2app with tornado before.

Py2app basicly looks for import statements in your script and includes all those modules as dependencies. It then does the same for all included modules as well until there is nothing more to add. At the end a seperate process looks for binary dependencies (that is, include the shared libraries used by python extension modules). 

There are 2 common ways this might fail to include everything you need:

1) Python module uses '__import__' or 'execfile' to load modules, those are hard to detect using the bytecode scanner used by py2app

2) C library uses data/configuration files

Ronald
> 
> ed
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
> unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4788 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20120710/9662ad77/attachment.bin>


More information about the Pythonmac-SIG mailing list