PyObjC on iPhone (iOS5) broken?
Asked Answered
A

1

23

Anybody knows how to fix PyObjC on iPhone 4s running iOS 5.0.1?

On my iPhone 4 with iOS 4.2.1 everything was working perfectly.
On the iPhone 4s with iOS 5.0.1 (and all the (same) packages installed) the PyObjC stuff does not work.

The error I get is:

File "/private/var/stash/Applications.pwn/MyPyObjC.app/MyPyObjC.py", line 9, in <module>
    import objc
  File "/usr/lib/python2.5/objc/__init__.py", line 17, in <module>
    _update()
  File "/usr/lib/python2.5/objc/__init__.py", line 14, in _update
    import _objc
ImportError: dlopen(/usr/lib/python2.5/lib-dynload/_objc.dylib, 2): Symbol not found: _OBJC_CLASS_$_Object
  Referenced from: /usr/lib/python2.5/lib-dynload/_objc.dylib
  Expected in: /usr/lib/libobjc.A.dylib

(files __init__.py & _objc.dylib are present in both devices, file libobjc.A.dylib, is missing in both devices)

Again, both iPhones have the same packages installed (but different iOS).
(as far as I know, Saurik's HelloPython.app has the same problem).

I guess they changed something in iOS 5 and the PyObjC files do not reflect the change (yet)...

I hope they will fix it... (I have 4-5 PyObjC based apps that do not work anymore) :-(

Until then, any ideas for a quick fix?

Anthropomorphize answered 9/2, 2012 at 12:48 Comment(13)
Is still still an issue for you? I have to the same problem :(Ironwood
I have the same problem. The problem is that Python (or the library-loader) trys to look in libobjc.A.dylib which is not present. I'm not familar with iOS or Unix, but if the lib-loader was looking in the actual _objc.dylib (which is the native python module) it would be able to find this symbol, as it is contained in this package (try nm _objc.dylib | grep _OBJC_CLASS_$_). Any idea how this can be achieved?Buller
@NiklasR The thing is, where can we find the "libobjc.A.dylib" file? I tried to copy the one from my Mac (as a desperate move), it did not work... And on my iPhone 4, it does not exist... :(Anthropomorphize
As _obj.dylib seems to expose those symbols, I have tried creating a symbolic link from /usr/lib/libobjc.A.dylib to .../_objc.dylib, but it didn't change anything. :(Buller
@NiklasR The thing is that in the (old) iOS, file /usr/lib/libobjc.A.dylib did not exist, but PyObjC was working fine!Anthropomorphize
Yes, because the library-loader that loads _objc.dylib suddenly wants to load a libobjc.A.dylib, which was not the case in previous OS versions.Buller
@NiklasR So it's "just" a mater of finding the "correct" libobjc.A.dylib? (Where do we find it?)Anthropomorphize
You could try contacting the developer, Ronald Oussoren, it seems he's more or less the only person working on it. The project page on SourceForge looks pretty dead, though. The latest files on sourceforge are for version 1.3.7 from 2005. Using easy_install you'd get version 2.3. To get a more recent version (2.4 beta), you'd have to get the subversion repository.Phobe
Yes, this is something for the developer(s), and not necessarily appropriate for SO.Tepic
OK, Who will undertake this task guys?Anthropomorphize
IIRC, PyObjC does not work for Cocoa as Apple doesn't support a bridge between Cocoa Objective-C and Python like they supported for Carbon. I didn't look at iOS to see what is used there.Concentrate
I messed up, PyObjC is for Cocoa. I don't remember where I found this information, but for some recent version of OS X, Apple dropped the Objective-C Python bridge. I am unable to verify this. One would need to verify that the bridge still exists for the version of iOS you are trying to use.Concentrate
What about ObjP? bitbucket.org/hsoft/objp Just stumbled upon it, as i need Python in an iOS(the best) project, too. Did someone get it to work with iOS? See also: https://mcmap.net/q/586750/-python-for-ios-interpreter-duplicateSallet
B
1

Sorry PyObjec is dead since the ios 2.0 Jay Freeman abandonned the project

(btw ios wasn't made for coders/hackers and geeks buy an android phone if you want to code on your phone using the amazing SL4A api on android :) )

Bettyebettzel answered 13/10, 2012 at 20:24 Comment(3)
Thanks for the "main" part of your answer. As for the second part, don't get me started! ... short answer: Why bother with a (new - to me) platform when I know the (almost) best platform around!? (if it was not "jailed" it would deserve the "best" title). (I would accept (and check) an answer saying: "Why don't you forget PyObjC and use the "real-thing" with XCode and Obj-C"...)Anthropomorphize
If you knew the python android api I think you wont recommend to code using java on android because its easier, faster, compilable and postable as well on google play I would love if ios had an equivalent to sl4aJoeyjoffre
Maybe, but I "invested" on XCode and I discovered a marvelous environment to code for (my) iPhone. After all, I am perfectly satisfied with my iPhone and I am not going to change it for an android (the same way I will not trade my Mac to (any) windows-pc). Anyway, the purpose of this thread/question was why PyObjC was broken on iOS5 (and not 2.0 - it was working fine up to 4.2.1)...Anthropomorphize

© 2022 - 2024 — McMap. All rights reserved.