1. Ronald Oussoren
  2. pyobjc

Issues

Issue #37 resolved

import objc fails with Symbol not found: _PyMac_Error

Anonymous created an issue

I hope this is the correct place to post this - I would normally send to a users mailing list/forum, but I can't seem to find one.

I have installed PyObjC using pip, but when I try and import objc I get the following error:

import objc Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/PyObjC/objc/init.py", line 24, in <module> _update() File "/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/PyObjC/objc/init.py", line 21, in _update import objc._objc as _objc ImportError: dlopen(/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/PyObjC/objc/_objc.so, 2): Symbol not found: _PyMac_Error Referenced from: /Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/PyObjC/objc/_objc.so Expected in: dynamic lookup

The output from the pip install command doesn't seem to have any obvious errors in it (the output is available at https://gist.github.com/9e18a45a686203ec6d81).

I've got no idea what's going wrong here - does anyone have any idea where I can look?

Cheers,

Robin

Comments (11)

  1. robintw

    That seems to fix that error, but I get another error when trying to import Foundation:

    import Foundation Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/pyobjc_framework_Cocoa-2.4-py2.7-macosx-10.5-x86_64.egg/Foundation/init.py", line 26, in <module> import Foundation._Foundation ImportError: dlopen(/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/pyobjc_framework_Cocoa-2.4-py2.7-macosx-10.5-x86_64.egg/Foundation/_Foundation.so, 2): Symbol not found: _PyMac_GetOSType Referenced from: /Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/pyobjc_framework_Cocoa-2.4-py2.7-macosx-10.5-x86_64.egg/Foundation/_Foundation.so Expected in: dynamic lookup

    Might there may be a similar issue in pyobjc_Framework_Cocoa too?

  2. Ronald Oussoren repo owner

    That's correct, modules/_Foundation_typecode.m should also be changed,

    -#if PY_MAJOR_VERSION == 2 +#if PY_MAJOR_VERSION == 2 && defined(USE_TOOLBOX_OBJECT_GLUE)

    I haven't checked yet if other framework wrappers also suffer from this problem, I'll have to build a framework without USE_TOOLBOX_OBJECT_GLUE to ensure that that configuration also works.

  3. robintw

    Thanks for helping with this :-)

    It looks like there are issues with other framework wrappers - AppKit is the next one I've found that has a problem, but there are probably others too. What's the best way forward do you think?

  4. Ronald Oussoren repo owner

    I should have some time in the weekend to test with a python build that's comparable to EPD.

    If you have time to look into this yourself and know C: the link errors should all have resulted in a compile-time warning about undefined functions (there are no link errors due to the way python extensions are created). In all cases there should be a preprocessor block that enables some functionality for python 2 but not python 3, and the python 2 test should also test for the USE_TOOLBOX_OBJECT_GLUE macro.

    Again: I should have time to look into this over the weekend.

  5. robintw

    It's probably best for me to leave it until the weekend - otherwise I think I'll just generally mess up the code!

    If you need any help with testing anything then just let me know.

  6. robintw

    Thanks for the release.

    Unfortunately I get a number of errors when trying to compile and install this release. See https://gist.github.com/b1b1791b5fc2fe0a8c76 for the errors (I put the entire console output there - the errors are at the end).

    Just to check I did it right: I downloaded the zip of v2.5 from https://bitbucket.org/ronaldoussoren/pyobjc/downloads (I don't have mercurial installed on this system) and then ran 'sudo python install.py'. This managed to install pyobjc-core, but seemed to die on pyobjc-Cocoa, as detailed in the gist above.

  7. Ronald Oussoren repo owner

    The install problem seems to be the same as #41, and the workaround seems to be to run install.py again.

    I'm currently investigating that issue and don't understand yet what's going on here.

  8. Log in to comment