Question

I'm making a Python/PyObjC bundle to use some Twisted features from an Objective-C application.

I need to install a Core Foundation reactor in my Python App:

from twisted.internet import cfreactor
cfreactor.install()

The problem is that when I build a bundle with py2app, the required CFNetwork framework never appears inside my bundle and when I load the bundle from my Objetive-C application it crash.

There is any way to force link the CFNetwork framework? Why this framework is not added automatly?

Était-ce utile?

La solution

Including packages that aren't automaticly detected is easy: just add the missing modules to your setup.py file:

setup(
   ...
   options=dict(
      py2app=dict(
        includes=["module1", "module"],
      ),
   ),
   ...
)

I don't know why CFNetwork isn't automaticly included, the code for cfreactor shouldn't confuse py2app this way (that is, the imports are done using regular import statements and aren't hidden in C code or import calls).

Can you reproduce that problem using a small sample project (for example a trivial SystemPreferences plugin)? That would make it a lot easier to debug the issue.

Also, which versions of Twisted, PyObjC and py2app do you use?

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