[Pythonmac-SIG] py2app - After building for distribution, No module named PyObjCTools

Jacob imagine512 at gmail.com
Wed Feb 11 05:19:42 CET 2009


Ronald,

Great to hear that you're working on better tests for PyObjCTools.  After
struggling for hours, I think I finally found the problem with the latest
py2app-devel (0.4.2) + pyobjc-cocoa (2.0.1) from MacPorts.  I found the
__init__.py file was missing from:

/opt/local/lib/python2.5/site-packages/PyObjCTools/

I downloaded the __init__.py file from the pyobjc SVN and plopped it in that
directory.  For reference, this file contains the following one line:

__import__('pkg_resources').declare_namespace(__name__)

Then, I modified my setup file so that it looks more like
install_requires=["pyobjc-core"].  Apparently PyObjC 2.0 broke the project
up into smaller packages and the name changed as well.  "pyobjc-core" and I
think "pyobjc-framework-cocoa" are the packages required to build the PyObjC
examples that were of interest to me.

Phew, I'm so glad this is finally working.  Good luck with the py2app
tests.  I for one will be grateful for your work

Thanks,
Jacob


On Tue, Feb 10, 2009 at 2:40 AM, Ronald Oussoren <ronaldoussoren at mac.com>wrote:

>
> On 8 Feb, 2009, at 17:25, s s wrote:
>
>  I have had similar problems with the "ImportError: No module named
>> PyObjCTools" and actually sent my entire project to someone who was
>> distributing a (beta) commercial product for some help.
>>
>> He spent 4 hours on it, hacked the hell out of the startup modules and
>> everything else and got it to build on his machine, then I couldn't
>> duplicate his results on mine.
>>
>> py2app needs some serious attention on the 10.5.6 stack and I'm willing to
>> help get it going -- I just don't have the domain knowledge to get the ball
>> rolling though I'm sure I could help keep it rolling once I knew where to
>> poke the stick.
>>
>
> One of the things I'd like to see is a set of functional tests for py2app,
> even if that only consists of a collection of sample applications that use
> the various libraries in common use, such as:
>
> * A PyObjC application
> * A wxWidgets application
> * ...
> * Applications using matplotlib
> * Applications using other libraries that sometimes cause problems.
>
> Lack of a proper testing infrastructure is a major issue for py2app at the
> moment, it is way to easy to accidently break something when  changing the
> py2app code base. Having a set of test applications would at least make it
> easier to ensure that nothing gets accidently broken.
>
> W.r.t. PyObjCTools issue: I'm currently working on better tests for the
> core functionality and framework wrappers for PyObjC and will work on fixing
> issues related to the examples when that's done (including fixing py2app
> where needed).
>
> Ronald
>
>
>>
>> S
>>
>>>
>>>  On Feb 8, 2009, at 2:32 AM, Jacob wrote:
>>
>>  Hi guys,
>>>
>>> I'm have a little trouble with py2app when building an app for
>>> distribution.  I'll give an example using one of the py2app/pyobjc2
>>> examples, ICSharingWatcher.  I setup Python 2.5.4 using MacPorts 1.7.0,
>>> along with the following packages:
>>>
>>> py25-bdist_mpkg @0.4.3_0 (active)
>>> py25-macholib-devel @1.2_0 (active)
>>> py25-modulegraph-devel @0.7.2_0 (active)
>>> py25-py2app-devel @0.4.2_1 (active)
>>> py25-pyobjc2 @2.0_1 (active)
>>> py25-pyobjc2-cocoa @2.0_1 (active)
>>> py25-setuptools @0.6c9_0 (active)
>>> py25-zlib @2.5.4_0 (active)
>>> python25 @2.5.4_0+darwin_9+macosx (active)
>>> python_select @0.2.1_0+darwin_9 (active)
>>> * Some other modules were removed for brevity.
>>>
>>> With the MacPorts version selected, in the ICSharingWatcher example, if I
>>> execute "python setup.py py2app", I get the following error message:
>>>
>>> pkg_resources.DistributionNotFound: pyobjc
>>>
>>> If I modify "setup.py" and change "install_requires=["pyobjc"]," to
>>> "install_requires=["pyobjc-core"]," or just comment out the line, then I can
>>> successfully build the example.  However, on startup it complains
>>> "ImportError: No module named PyObjCTools".
>>>
>>> I can clean up the build and dist directories, execute "python setup.py
>>> py2app -A" with this modified setup.py and the example runs just fine.  I
>>> can run MacPort's python and import PyObjCTools without a problem.  So, it
>>> seems that I'm just not telling py2app how to correctly include PyObjCTools.
>>>
>>> Any ideas why the "pyobjc" package cannot be found?  I'm running 10.5.6
>>> and have XCode 3.1.2 installed.
>>>
>>> Thanks,
>>> Jacob
>>>
>>> --------------------------------------------------
>>> For reference, the setup.py in the example looks like:
>>>
>>> from setuptools import setup
>>>
>>> setup(
>>>  data_files=['MainMenu.nib'],
>>>  app=['ICSharingWatcher.py'],
>>>  install_requires=["pyobjc"],
>>>  setup_requires=["py2app"],
>>> )
>>> _______________________________________________
>>> Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
>>> http://mail.python.org/mailman/listinfo/pythonmac-sig
>>>
>>
>> _______________________________________________
>> Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
>> http://mail.python.org/mailman/listinfo/pythonmac-sig
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20090210/6bc5f74a/attachment.htm>


More information about the Pythonmac-SIG mailing list