Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #87787
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!bcyclone04.am1.xlned.com!bcyclone04.am1.xlned.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <tim_grove@sil.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.005 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'subject:: [': 0.04; 'url:bitbucket': 0.05; 'attribute': 0.07; 'skip:" 60': 0.07; '__init__': 0.09; 'rescue': 0.09; 'suggestions.': 0.09; 'windows,': 0.09; 'python': 0.11; "wouldn't": 0.14; '(created': 0.16; 'grove': 0.16; 'received:192.168.1.4': 0.16; 'skip:" 100': 0.16; 'subject:PyQt': 0.16; 'url:95': 0.16; 'used:': 0.16; 'all.': 0.16; 'appropriate': 0.16; 'wrote:': 0.18; 'app': 0.19; 'pfxlen:0': 0.19; "skip:' 30": 0.19; 'thu,': 0.19; 'version.': 0.19; 'subject:] ': 0.20; 'foundation': 0.20; 'code,': 0.22; 'import': 0.22; 'installation': 0.23; 'header:User-Agent:1': 0.23; 'error': 0.23; 'keyboard': 0.24; 'skip:i 40': 0.24; 'question': 0.24; 'cc:2**0': 0.24; "i've": 0.25; 'source': 0.25; 'this:': 0.26; 'skip:_ 20': 0.27; 'header:In-Reply-To:1': 0.27; 'installed': 0.27; 'fixed': 0.29; 'michael': 0.29; 'points': 0.29; 'tim': 0.29; "i'm": 0.30; 'url:mailman': 0.30; 'trace': 0.31; 'anyone': 0.31; 'file': 0.32; 'run': 0.32; 'worked': 0.33; '(most': 0.33; 'updated': 0.34; 'skip:_ 10': 0.34; 'received:74.125.82': 0.34; 'problem': 0.35; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'url:listinfo': 0.36; "didn't": 0.36; 'thanks': 0.36; "i'll": 0.36; 'subject:?': 0.36; 'url:org': 0.36; 'list': 0.37; 'being': 0.38; 'skip:o 20': 0.38; 'skip:& 10': 0.38; 'problems': 0.38; 'apple': 0.38; 'to:addr :python-list': 0.38; 'pm,': 0.38; 'skip:_ 40': 0.38; 'recent': 0.39; 'received:74.125': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'mailing': 0.39; 'full': 0.61; 'you.': 0.62; 'hear': 0.63; 'personal': 0.63; 'skip:n 10': 0.64; 'great': 0.65; 'within': 0.65; 'reply': 0.66; 'latest': 0.67; 'mar': 0.68; '20,': 0.68; 'email,': 0.69; 'link:': 0.72; '2015': 0.84; 'received:74.125.82.172': 0.84; 'timothy': 0.84; 'subject:skip:w 20': 0.91; 'ports': 0.93 |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type; bh=XyOjGuQwvS1zS8nMisWPiM6vSAwB3Fy5TLD+5VmHMME=; b=PhIzWPc7OLG0Chjp9xWeqzIPgzPIVNcD63Vzhvu2fFPPxDwEXYZGRc4GpyL4SkE6X/ qSlxgiMKe3zhcqtkXE007sqTaCqDqbP75EHrxAAK/jZHNI2+GjJP/7wm85qZea8FcnHR w1+22rv3pT39ZHgsXTkqJHOwJvVcJQ990vfSon2jNsNIa5XHcbRo3wSj0+vG5e2DMTB5 3HqQjD8LUfJ4r6vXweDv51FnSmTt3q6v6MKIAaPazUnd1KOLlB9qlkvg7QddDe7dNfmq K/L/JdbLzejiPZ1TK4TqIhqRWmb1jBe1L1VyPVhG7EG8+0FAIIW9m/755YQeaf+101k2 zQOQ== |
| X-Gm-Message-State | ALoCoQlhGmwRABY+EgfcQ5+KI3RVjGniYtor/IAkgF+XyRaw8AMD+2wAr9/Mx+L2kkKvFl6f5TQB |
| X-Received | by 10.180.91.79 with SMTP id cc15mr25440095wib.37.1426871854991; Fri, 20 Mar 2015 10:17:34 -0700 (PDT) |
| Date | Fri, 20 Mar 2015 17:17:28 +0000 |
| From | "Timothy W. Grove" <tim_grove@sil.org> |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 |
| MIME-Version | 1.0 |
| To | Python <python-list@python.org> |
| CC | PyQT mailing list <pyqt@riverbankcomputing.com> |
| Subject | Re: [PyQt] win32api.LoadKeyboardLayout; any solutions for OSX? |
| References | <54F86D7B.60504@sil.org> <550B0559.60903@sil.org> <CAD0nt=H-uaO-oLs8OY0k=oW+qNSYX++DJx10gNiKG4ZPd+8Hog@mail.gmail.com> |
| In-Reply-To | <CAD0nt=H-uaO-oLs8OY0k=oW+qNSYX++DJx10gNiKG4ZPd+8Hog@mail.gmail.com> |
| Content-Type | multipart/alternative; boundary="------------040501050805080908070808" |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.19 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.43.1426871861.10327.python-list@python.org> (permalink) |
| Lines | 420 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1426871862 news.xs4all.nl 2907 [2001:888:2000:d::a6]:42315 |
| X-Complaints-To | abuse@xs4all.nl |
| X-Received-Bytes | 22760 |
| X-Received-Body-CRC | 3529835346 |
| Xref | csiph.com comp.lang.python:87787 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
Thanks again. Macports didn't have the latest pyobjc, but pip updated my
installation to the fixed version. Problem solved.
Tim
On 20/03/2015 00:18, michael h wrote:
> Did you see this:
>
> https://bitbucket.org/ronaldoussoren/pyobjc/issue/95/attributeerror-in-some-cases-when-checking
>
>
>
> On Thu, Mar 19, 2015 at 12:20 PM, Timothy W. Grove <tim_grove@sil.org
> <mailto:tim_grove@sil.org>> wrote:
>
> A personal reply to my question sent me to the following link:
> http://stackoverflow.com/questions/23729704/change-osx-keyboard-layoutinput-source-programmatically-via-terminal-or-appl.
> I seem to have found a solution that worked using PyObjC.
>
> I'm currently using Python 3.3 installed via macports, and I
> installed the appropriate ports for my setup (py33-pyobjc,
> py33-pyobjc-cocoa).
>
> For my import statement:
>
> from AppKit import NSTextInputContext
>
> To find the current keyboard being used:
>
> ic = NSTextInputContext.new()
> current_keyboard = ic.selectedKeyboardInputSource()
>
> To list the currently available keyboards:
>
> keyboards = ic.keyboardInputSources()
>
> To change the current keyboard (to 'Arabic', for example):
>
> ic.setValue_forKey_('com.apple.keylayout.Arabic',
> 'selectedKeyboardInputSource')
>
>
> Now, that is the good news! This all worked great in my source
> code, but as an app bundle (created with cx_Freeze 4.3.2) it
> wouldn't run at all. I'll include the full error trace at the end
> of this email, but the problems seem to start with the import of
> AppKit and end with objc/_lazyimport.py.
>
> I'm not sure if this points to a 'bug' in objc or something else
> which I've left out of my setup routine, but if anyone has any
> ideas, I would be interested to hear from you.
>
> Best regards,
> Timothy Grove
>
>
>
> On 05/03/2015 14:51, Timothy W. Grove wrote:
>> I was looking for a way to change keyboard layouts from within a
>> Python 3 / PyQt4 application. Win32api.LoadKeyboardLayout has
>> come to my rescue on Windows, but is anyone aware of a
>> cross-platform or OSX specific solution for Apple Mac? Thanks for
>> any suggestions.
>>
>> Best regards,
>> Tim
>
> Traceback (most recent call last):
>
> File
> "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/cx_Freeze/initscripts/Console3.py",
> line 27, in <module>
>
> exec(code, m.__dict__)
>
> File "soosl.py", line 6, in <module>
>
> File
> "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py",
> line 1565, in _find_and_load
>
> return _find_and_load_unlocked(name, import_)
>
> File
> "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py",
> line 1532, in _find_and_load_unlocked
>
> loader.load_module(name)
>
> File
> "/Users/timothygrove/Documents/workspace/SooSL/mainwindow.py",
> line 19, in <module>
>
> File
> "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py",
> line 1565, in _find_and_load
>
> return _find_and_load_unlocked(name, import_)
>
> File
> "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py",
> line 1532, in _find_and_load_unlocked
>
> loader.load_module(name)
>
> File
> "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/AppKit/__init__.py",
> line 9, in <module>
>
> import Foundation
>
> File
> "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py",
> line 1565, in _find_and_load
>
> return _find_and_load_unlocked(name, import_)
>
> File
> "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py",
> line 1532, in _find_and_load_unlocked
>
> loader.load_module(name)
>
> File
> "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/Foundation/__init__.py",
> line 9, in <module>
>
> import CoreFoundation
>
> File
> "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py",
> line 1565, in _find_and_load
>
> return _find_and_load_unlocked(name, import_)
>
> File
> "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py",
> line 1532, in _find_and_load_unlocked
>
> loader.load_module(name)
>
> File
> "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/CoreFoundation/__init__.py",
> line 20, in <module>
>
> }, ())
>
> File
> "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/objc/_lazyimport.py",
> line 82, in __init__
>
> if nm.startswith(pfx):
>
> AttributeError: 'NoneType' object has no attribute 'startswith'
>
> logout
>
>
> [Process completed]
>
>
>
> _______________________________________________
> PyQt mailing list PyQt@riverbankcomputing.com
> <mailto:PyQt@riverbankcomputing.com>
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
>
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: [PyQt] win32api.LoadKeyboardLayout; any solutions for OSX? "Timothy W. Grove" <tim_grove@sil.org> - 2015-03-20 17:17 +0000
csiph-web