Python Hello World in PyObjC on iPhone?
Asked Answered
S

1

1

I installed the iphone-python package from Cydia, but the HelloPython app closes immediately when I run it from Springboard.

This may be a red herring, but I found the .py file in Terminal and tried to run it with python and got a python error:

$ python /private/var/stash/Applications.pwn/HelloPython.app/HelloPython.py
Traceback (most recent call last):
  File "/private/var/stash/Applications.pwn/HelloPython.app/HelloPython.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

I'm running 4.3.3.

How can I get this app working, so I'll have a working example of PyObjC?

Snazzy answered 14/5, 2011 at 2:2 Comment(5)
Looks like you need to install PyObjC separately from iphone-python. You've done that? No error messages in the log when the app crashes?Palla
Cydia reports that PyObjC is installed and version 1946-4. Where are the logs I should be checking?Snazzy
If you hook the phone up to Xcode, you should be able to find the logs in the Device Organizer. They're also synced to your computer and put in ~/Library/Logs/CrashReporter/MobileDevice/ I'm not sure where they're stored on the device itself; probably a similar location.Palla
I didn't see any logs with sudo find / -mmin 1. I just synced and found the CrashReporter directory, but there was nothing that seemed to be related to HelloPython in there. I don't know my way around Xcode, but I do have access to it.Snazzy
You're getting a traceback from within the python environment, so it's probably not a crash from CrashReporter's point of view. But I get the same error under 4.3.3, with the same _objc.dylib that works fine under 4.1.Daedalus
B
0

Well due to the changes in the way executables on the new ios run, the dynamic library has become corrupt. The mach-o will no longer run due to the upgraded objective-c so a workaround would be to compile pyobjc from source and run normaly. The only ptoblem with that is that the iphone's version of pyobjc is built for uikit so you would need to find saurik's (Jay Freeman) source code and compile it. I might do that for myself so ill post back with a deb file if i do.

Bagpipe answered 17/12, 2012 at 16:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.