Re: [Pyobjc-dev] Failed to run the HotKey Example
Brought to you by:
ronaldoussoren
From: Jake W. <del...@gm...> - 2014-01-04 04:30:44
|
Thank you Ronald. I will try it again, and look forward to seeing if you can run it successfully. Jake On Fri, Jan 3, 2014 at 10:51 PM, Ronald Oussoren <ron...@ma...>wrote: > Hi, > > This example like all pyobjc examples with a setup.py file needs to be run > from an application bundle (run "python setup.py -A"). > > This particular example has some other restrictions (which aren't > documented on the website right now): > > * It requires python 2.x because it uses the Carbon package that was > removed in Python 3.0 > > * It requires a 32-bit build of python 2.x because the Carbon package is > ancient and uses functions that Apple hasn't made available in 64-bit code. > > > The last restriction makes using py2app harder, because the app bundle > will happily try to run in 64-bit mode when you build using a python that > supports 64-bit code. The easiest workaround is to disable 64-bit through > the finder (for this application). > > I'm not sure why the application gives an ImportError exception when you > try to run it. The usual problem is that the python you're using to run > py2app is a different one than you expect (e.g. one without pyobjc > installed), but that doesn't seem to be the problem here because you don't > get an ImportError when running the script from the command-line. > > Ronald > > P.S. I haven't tried to run this example in a long while, I'll try to do > so tonight. > > On Jan 03, 2014, at 03:02 PM, Jake Wang <del...@gm...> wrote: > > Hi, > > I was trying to run the sample PyObjc HotKey example app downloaded from > this link: > http://pythonhosted.org/pyobjc/_downloads/PyObjCExample-HotKeyPython.zip > > (My environment: Mac OS X 10.8.5, Python 2.7.5) > > After I unpacked the file, I tried to: > > 1) run it via: > > python HotKey.py > > and got the following error: > > Traceback (most recent call last): > File "HotKey.py", line 18, in <module> > from Carbon.CarbonEvt import RegisterEventHotKey, > GetApplicationEventTarget > ImportError: cannot import name RegisterEventHotKey > > 2) run it in 32bit mode, as I thought this might only be supported in > 32bit. > > arch -i386 python HotKey.py > > and got another error: > > 2014-01-03 21:57:41.083 Python[2047:f0b] No Info.plist file in application > bundle or no NSPrincipalClass in the Info.plist file, exiting > > 3) Then I thought I might have to package it as an xx.app to run, then I > executed the following command to package it: > > python setup.py py2app -A > > (also tried 'arch -i386 python setup.py py2app -A') > > The app couldn't be run, and then ran it from console, I got the following > errors: > > Traceback (most recent call last): > File > "/Users/jiakuanwang/opensource/PyObjCExample-HotKeyPython/dist/HotKey.app/Contents/Resources/__boot__.py", > line 69, in <module> > _run() > File > "/Users/jiakuanwang/opensource/PyObjCExample-HotKeyPython/dist/HotKey.app/Contents/Resources/__boot__.py", > line 62, in _run > exec(compile(source, script, 'exec'), globals(), globals()) > File > "/Users/jiakuanwang/opensource/PyObjCExample-HotKeyPython/HotKey.py", line > 16, in <module> > from AppKit import * > ImportError: No module named AppKit > 2014-01-03 22:00:41.775 HotKey[2126:707] HotKey Error > > Is it possible to run it in some way? Thanks in advance! > > Thanks, > Jake > > ------------------------------------------------------------------------------ > Rapidly troubleshoot problems before they affect your business. Most IT > organizations don't have a clear picture of how application performance > affects their revenue. With AppDynamics, you get 100% visibility into your > Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics > Pro! > http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev > > |