Re: Failed to run the HotKey Example

Jake Wang <[email protected]> Thu, 9 Jan 2014 21:28:35 +0800
Newsgroups gmane.comp.python.pyobjc.devel
Message-ID <CALtF2503EWw+zFtub6FveZAHsR=61=vQ_Lp2uB9NqAPJUh3Lwg@mail.gmail.com>
I just ran this:

python -c "import Cocoa; print(Cocoa.__file__)"

and I got:

/Library/Python/2.7/site-packages/pyobjc_framework_Cocoa-2.5.1-py2.7-macosx-10.8-intel.egg/AppKit/_AppKit.so

Thanks for the analysis regarding the PyQT question. As long as the hotkey
registration code doesn't rely on NSApplication and can co-exist with PyQT,
it should work. I will do more investigation on this later.

Cheers,
Jake


On Thu, Jan 9, 2014 at 9:15 PM, Ronald Oussoren <[email protected]>wrote:

>
> On 09 Jan 2014, at 14:06, Jake Wang <[email protected]> wrote:
>
> Hi Ronald,
>
> I just tried your new version of the example code.
>
> 1. When I built via: python setup.py py2app
>
> and run it with
>
> arch -i386 dist/HotKey.app/Contents/MacOS/HotKey
>
> 'print(sys.prefix)' printed the following line:
>
> /Users/jakew/Desktop/HotKeyPython/dist/HotKey.app/Contents/Resources
>
>
> and the app could be run correctly.
>
> 2. But if I built via: python setup.py py2app -A
>
> and run it with
>
> arch -i386 dist/HotKey.app/Contents/MacOS/HotKey
>
> 'print(sys.prefix)' printed the following line:
>
> /Library/Frameworks/Python.framework/Versions/2.7
>
> and the app failed to start duo to an error: 'ImportError: No module
> named Cocoa’
>
>
> That’s odd. What is printed if you run “python -c ‘import Cocoa;
> print(Cocoa.__file__)’’?
>
>
> It's good that the non-alias way worked! Thanks a lot.
>
> I would like to use this HotKey feature with a PyQT application, so is it
> possible
> to not use NSApplication to RegisterEventHotKey, and instead, do it in
> PyQT application
> class? Or, is there other ways to make the HotKey function work with PyQT?
>
>
> I don’t know because I’ve never used PyQt on OSX. The registration code in
> finishLaunching should work just as well in a Qt application (that just
> uses the Carbon package to register a hotkey), but I don’t know how you’d
> inspect native events in PyQt (the code in sendEvent_).
>
> Ronald
>
>

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk

_______________________________________________
Pyobjc-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyobjc-dev