Re: [Pythonmac-SIG] How to include or install a Python runtime in an AppleScript applet
On 9/28/21 1:12 AM, Vincentius Vincentius wrote: Can anyone help me with advice on how to create and distribute a Python runtime (with my applet) ? Point your users to the installer for the Mac version of Python: https://www.python.org/ftp/python/3.9.7/python-3.9.7-macosx10.9.pkg There is no simple way to embed a Python installation within an AppleScript applet. If you're doing that, you might as well all the way and deploy your script as a full Mac application with Python libraries bundled using a tool like py2app. --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org https://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] PMPrinterPrintWithProvider
On 1/25/19 5:44 AM, Ronald Oussoren via Pythonmac-SIG wrote: These APIs are not available through PyObjC at this time. Why do you want these APIs instead of the higher level APIs in AppKit? Since these are C API's, it should be possible to access them through ctypes, yes? -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org https://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG
[Pythonmac-SIG] py2app error
A Tkinter app I am building on 10.13 with py2app 0.14 is crashing with this error: Traceback (most recent call last): File "/Users/kevin/Programming/quickwho/dist/QuickWho.app/Contents/Resources/__boot__.py", line 98, in _run() File "/Users/kevin/Programming/quickwho/dist/QuickWho.app/Contents/Resources/__boot__.py", line 82, in _run exec(compile(source, path, 'exec'), globals(), globals()) File "/Users/kevin/Programming/quickwho/dist/QuickWho.app/Contents/Resources/QuickWho.py", line 8, in from tkinter import * File "", line 961, in _find_and_load File "", line 950, in _find_and_load_unlocked File "", line 646, in _load_unlocked File "", line 616, in _load_backward_compatible File "tkinter/__init__.pyc", line 36, in ValueError: character U+6573552f is not in range [U+; U+10] I am not certain of how to proceed. Please advise. -- Kevin Walzer Code by Kevin/Mobile Code by Kevin http://www.codebykevin.com http://www.wtmobilesoftware.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org https://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Tkinter and PyObjC
Ronald, On 9/6/17 4:57 PM, Ronald Oussoren wrote: I’ve done some quick browsing of the Tk source code and it appears that Tk assumes that -[NSApplication sharedApplication] returns an instance of a Tk-specific private subclass of NSApplication and that won’t be true when the Tk runloop is started before the Cocoa one. My question: is my analysis correct? And has anyone successfully mixed PyObjC and Tkinter in this way? I guess this issue could be avoided by initialising Tk before calling into Cocoa. I'd say your analysis is more or less correct. The previous maintianer of Tk/Mac, Daniel Steffen, noted this in a bug report at https://core.tcl.tk/tk/tktview/3033786f. I've had success embedding Cocoa widgets from within Tk (Quicklook views, NSToolbar, etc.) where Tk has no direct knowledge of the Cocoa bits. But the Tk event loop has to be in charge for this to work because of Tk's architecture. I don't think that calling Tk from Cocoa is feasible. --Kevin -- Kevin Walzer Code by Kevin/Mobile Code by Kevin http://www.codebykevin.com http://www.wtmobilesoftware.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org https://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] py2app .app crashes... but only when downloaded (quarantine)
On 2/2/17 10:22 AM, Jack Jansen wrote: My guess is that this could be caused by some early dialog that triggers a bug in your initialization code, or more precisely: the order in which you initialize things. I think Jack's diagnosis is sound. I see you are linking to the system Tk on Mac OS, which is very old and buggy in terms of event loop integration; these kinds of overloads were not uncommon with that version (8.5). Try updating your build to 8.6.6 and see what happens; it's a lot more stable. --Kevin -- Kevin Walzer Code by Kevin/Mobile Code by Kevin http://www.codebykevin.com http://www.wtmobilesoftware.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org https://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Build Applet with 2.7.13 (64-bit) on 10.10.5 (and 10.6.x)
On 1/22/17 6:13 PM, Pascal Oberndörfer wrote: I have been using Build Applet quite extensively in the past. I now wanted to use them with 2.7.13, but if I actually build the Applet -- even for the simplest script -- the resulting Applet will not start. All I see is an entry in the system.log saying: " com.apple.xpc.launchd[1]: (logging2.257336[4974]) Service exited with abnormal code: 1". I can't speak to the specific error you are seeing, but I don't think Build Applet has been maintained for years--it's a legacy tool that certainly isn't part of Python 3x and probably won't even run in 64-bit Python 2.7.x, as it depends on the deprecated (32-bit only) Carbon modules. Is there any reason you can't move to a more modern bundling tool like py2app, which is actively developed and certainly is more robust than Build Applet? (I say this as one who used Build Applet back in the day, but it's probably been 10 years). --Kevin -- Kevin Walzer Code by Kevin/Mobile Code by Kevin http://www.codebykevin.com http://www.wtmobilesoftware.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org https://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Phantom Dock menu entries for tkinter dialogs on Mac
On 12/6/16 9:43 PM, Mark Lutz wrote: A simple demo of the problem is attached below: every "destroy" popup lingers on in the launcher's Dock menu after it's closed (whether by the red "X" or the widget.destroy() callback), and remains in the Dock menu until the main window is closed (by widget.quit() or otherwise). This happens whether the script is run by click or command line. I can't reproduce this using Tkinter built against Tk 8.6.6. There were a lot of issues with menus, the event loop, and so on that have been fixed--I don't recall seeing this exact issue but I did see similar things with "ghost windows" hanging around in a system menu after being destroyed. You may want to update your installation of Tk. --Kevin -- Kevin Walzer Code by Kevin/Mobile Code by Kevin http://www.codebykevin.com http://www.wtmobilesoftware.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org https://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] codesigning py2app/wxPython app failing
On 8/23/15 8:09 AM, Brendan Simon (eTRIX) wrote: Thanks for the help :) Unfortunately I haven't made any progress :( I've tried singing some of the binaries and frameworks from a bash script (and manually) but I still get errors :( I don't quite understand codesign_allocate and why you are using it instead of codesign, but in my experience setting a signature size, i.e. --signature-size 9400, sometimes fixes codesign failures. --Kevin -- Kevin Walzer Code by Kevin/Mobile Code by Kevin http://www.codebykevin.com http://www.wtmobilesoftware.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org https://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] codesigning py2app/wxPython app failing
On 8/23/15 12:11 AM, Glyph wrote: I was /going/ to say something about how "codesigning" certificates have different X509 extensions in them, but then I clicked the link to "sslstart.com <http://sslstart.com>" and I got redirected to mac-protect dot info (not in URL syntax because it looks to be malware) saw this popup: I saw that too, but I suspect Brendan simply mistyped the domain. startssl.com is a valid CA for codesigning certs, and they have the lowest-cost certificates in the business. --Kevin -- Kevin Walzer Code by Kevin/Mobile Code by Kevin http://www.codebykevin.com http://www.wtmobilesoftware.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org https://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] codesigning py2app/wxPython app failing
On 8/22/15 10:44 PM, Brendan Simon (eTRIX) wrote: $ codesign - -f --deep -s dist/.app The "deep" flag doesn't work anymore. Pretty much every binary object must be signed. Here's what I use to codesign one of my apps (the specific example is Perl, my current Python project is awaiting an update, but I'll roll something similar for the Python project). First I start with the dylibs: find build/FileMorph.app -type f -name "*.bundle" -exec codesign --verbose --signature-size 9400 -f -s "My Credentials" {} \; find build/FileMorph.app -type f -name "*.dylib" -exec codesign --verbose --signature-size 9400 -f -s "My Credentials" {} \; Next, the frameworks and executables: codesign --verbose --signature-size 9400 -f -s "My Credentials" build/FileMorph.app/Contents/Frameworks/Tk.framework/Versions/8.6/Resources/Wish.app/Contents/MacOS/Wish codesign --verbose --signature-size 9400 -f -s "My Credentials" build/FileMorph.app/Contents/Frameworks/Tk.framework/Versions/Current codesign --verbose --signature-size 9400 -f -s "My Credentials" build/FileMorph.app/Contents/Frameworks/Tcl.framework/Versions/Current codesign --verbose --signature-size 9400 -f -s "My Credentials" build/FileMorph.app/Contents/MacOS/perl Finally, the app itself: codesign --signature-size 9400 -f -s "My Credentials" --verbose=2 build/FileMorph.app Is it a certificate issue perhaps? I purchased a class2 cert from sslstart.com. I was a renewed one and I'm not 100% sure I'm using the correct private key for the certificate. Would that cause the above errors? I don't know if that's the specific issue here, but I do know that Gatekeeper does not recognize certificates from authorities other than Apple--not sure if codesign itself would flag a signature as non-valid if the cert was not issued by Apple's developer group. --Kevin -- Kevin Walzer Code by Kevin/Mobile Code by Kevin http://www.codebykevin.com http://www.wtmobilesoftware.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org https://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] New page on wiki about system Python
On 8/2/14, 8:13 PM, Matthew Brett wrote: Hi, I just put up a new wiki page on why system Python can be incovenient to use: https://github.com/MacPython/wiki/wiki/Which-Python I'd be very happy for feedback as to whether this is still the standard advice, For heavy development and projects that will deployed elsewhere, it's probably better to use a new installation. However, for casual programming, the system Python is fine. --Kevin -- Kevin Walzer Code by Kevin/Mobile Code by Kevin http://www.codebykevin.com http://www.wtmobilesoftware.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org https://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Code signing py2app generated apps
On 6/7/14, 9:31 AM, Brendan Simon (eTRIX) wrote: Is there anything special one needs to do to sign py2app generated apps ? I've tried: codesign -s but I when verifying it with "codesign -v" I get: src/dist/SureAnalysis.app: Unknown format in import. In architecture: i386 The certificate is a .p12 file that was imported with KeyChain.app to the System destination keychain. This works for me: codesign --deep --signature-size 9400 -f -s "Developer ID Application: Kevin Walzer" cbk/QuickWho.app I use cx_freeze in this app, not py2app, but this also worked for me with py2app. --Kevin -- Kevin Walzer Code by Kevin/Mobile Code by Kevin http://www.codebykevin.com http://www.wtmobilesoftware.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org https://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Pythonmac-SIG Digest, Vol 129, Issue 1
On 1/5/14, 1:13 PM, Tony Cappellini wrote: I'm going to install all my Python packages via macports- from now on. I haven't checked if wx 3.0 is supported there yet or not. I suspect not because it's too new. I also would like to stick with wx 2.x- to avoid API changes. Can I just delete the wx installation folder to cleanly remove that old wx installation, or is manual cleanup required? Thanks I'd run the "remove" script from the download I pointed you to--it will clean everything up. I'm sure you understand that using MacPorts for wx will require using their Python as well. --Kevin -- Kevin Walzer Code by Kevin/Mobile Code by Kevin http://www.codebykevin.com http://www.wtmobilesoftware.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org https://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Pythonmac-SIG Digest, Vol 129, Issue 1
On 1/5/14, 8:34 AM, Tony Cappellini wrote: Now- to get back to a clean slate- if I just delete the wxPython directory that was installed, will that remove everything needed to cleanup, or are there other steps involved in removing a bad wx installation? wxPython 3.0 has just been released. I'd download the one that supports Cocoa from http://wxpython.org/download.php#osx (wxPython3.0-osx-cocoa-py2.7). The disk image includes a script to remove previous installations of wxPython. Running this script and then installing 3.0 will accomplish two things: cleaning up your old installation; and supporting 64-bit Python. I bet you can run the installer package from the GUI, as well, since it's not an old package like wxPython 2.8. Hope this helps, Kevin -- Kevin Walzer Code by Kevin/Mobile Code by Kevin http://www.codebykevin.com http://www.wtmobilesoftware.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org https://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Bad installer for wxPython2.8-osx-ansi-2.8.12.1-universal-py2.7
On 1/4/14, 10:44 PM, Tony Cappellini wrote: -- Forwarded message -- From: Ned Deily mailto:n...@acm.org>> To: pythonmac-sig@python.org <mailto:pythonmac-sig@python.org> Cc: Date: Sat, 28 Dec 2013 15:15:55 -0800 Subject: Re: [Pythonmac-SIG] Bad installer for wxPython2.8-osx-ansi-2.8.12.1-universal-py2.7 In article mailto:nad-86dea0.13454428122...@news.gmane.org>>, Ned Deily mailto:n...@acm.org>> wrote: sudo installer -pkg /Volumes/wxPython2.9-osx-2.9.4.0-cocoa-py2.7/wxPython2.9-osx-cocoa-py2.7. pkg -target / Ok- thanks. This worked. I was able to run the installer- without problems. I do have one issue though. I am under the impression that "universal-py2.7" means it will run under both 32 & 64 bit systems. When I imported wx import wx Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/wxPython-ansi-2.8.12.1/lib/python2.7/site-packages/wx-2.8-mac-ansi/wx/__init__.py", line 45, in from wx._core import * File "/usr/local/lib/wxPython-ansi-2.8.12.1/lib/python2.7/site-packages/wx-2.8-mac-ansi/wx/_core.py", line 4, in import _core_ ImportError: /usr/local/lib/wxPython-ansi-2.8.12.1/lib/python2.7/site-packages/wx-2.8-mac-ansi/wx/_core_.so: no appropriate 64-bit architecture (see "man python" for running in 32-bit mode) I am using the default version of Python (2.7.5) that comes with Mavericks If you look at the version of wxPython referenced in the stack trace, it's 2.8, not the 2.9. one you installed. 2.8 is 32-bit only. Looks like Python is confused about which version to load. You may simply want to remove the 2.8 one altogether to avoid the conflict. --Kevin -- Kevin Walzer Code by Kevin/Mobile Code by Kevin http://www.codebykevin.com http://www.wtmobilesoftware.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org https://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Building extension modules with Xcode 5
On 10/24/13 7:50 PM, Andrew Barnert wrote: What should users be doing until this is fixed? Build Python yourself, in my view. Python is one of the easiest scripting languages to build. And once you do that, building extensions is just a matter of sudo easy_install foo. What we're seeing here is a conflict between Python's unfortunate insistence on using the same compiler toolchain for the main interpreter and any compiled extensions, and Apple's remorseless dropping of stuff it no longer supports. I don't believe there is a way to resolve this conflict. Eventually clang will have been the standard compiler for three or four versions of OS X, and that will resolve it. Until then there will be several different compilers in the wild--gcc-4.2, gcc-llvm, and clang, and we'll have these headaches with incompatibility. Ronald and Ned can speak in a more official capacity, as the maintainers, but that's my two cents. --Kevin -- Kevin Walzer Code by Kevin/Mobile Code by Kevin http://www.codebykevin.com http://www.wtmobilesoftware.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org https://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Fwd: Can any cross platform gui framework limitations be filled with ctypes / pyobjc or other?
On 7/10/13 5:35 AM, Paul Wiseman wrote: Do you know any Qt apps for mac? It would be quite useful to take a look at a few to help weigh up my options. There are lots of Qt apps with Mac ports; most are crappy because they make little effort to get the Mac UI details right. VirtualBox and Parallels are two Qt apps that do a better job with the UI. --Kevin -- Kevin Walzer Code by Kevin/Mobile Code by Kevin http://www.codebykevin.com http://www.wtmobilesoftware.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Can any cross platform gui framework limitations be filled with ctypes / pyobjc or other?
On 7/9/13 10:34 AM, Paul Wiseman wrote: Nope, they had a release today in fact (v1.2.0) so it's very much still active. But it supports Qt 4.8. Digia has just released Qt 5.1. Qt5 has some huge differences from 4.x, among them it's moving heavily into using QtQuick (a declarative markup spec) to draw UI's rather than native widgets. I've only just started looking into it so I'm not sure on the full story - so this is possibly wrong or inaccurate but I believe Nokia sold Qt to Digia, then they had licencing issues trying to use pyQt and couldn't come to an agreement with riverbank computing, so Nokia made their own bindings (PySide) and open sourced them. So there's now two sets of python bindings and from what I can tell PySide seems to release updates for new features of Qt before pyQt as well. I think PySide is purely a community project now, I don't think Nokia has much to do with it (again I could be wrong!) but still seems active. Phil Thompson earns his living dual-licensing PyQt (commercial and GPL), just as TrollTech did. Moving to LGPL would probably hurt his revenue. --Kevin -- Kevin Walzer Code by Kevin/Mobile Code by Kevin http://www.codebykevin.com http://www.wtmobilesoftware.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Can any cross platform gui framework limitations be filled with ctypes / pyobjc or other?
On 7/9/13 9:15 AM, Paul Wiseman wrote: It looks like you can get the native window handle which is promising: https://deptinfo-ensip.univ-poitiers.fr/ENS/pyside-docs/PySide/QtGui/QWidget.html#PySide.QtGui.PySide.QtGui.QWidget.winId Good to see. By the way, is PySide still being maintained after Digia took over Qt? My impression is that it was now an orphan. --Kevin -- Kevin Walzer Code by Kevin/Mobile Code by Kevin http://www.codebykevin.com http://www.wtmobilesoftware.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Can any cross platform gui framework limitations be filled with ctypes / pyobjc or other?
On 7/9/13 5:46 AM, Paul Wiseman wrote: But would anyone know if it would be possible to implement these platform specific bits whilst using PySide, using ctypes / pyobjc etc? (window animations, mac sheets etc.) This SO page has a few different examples of flipping windows in Cocoa: http://stackoverflow.com/questions/2490069/flipping-a-window-in-cocoa I have no idea how easy it is to call Objective-C using a C API like ctypes. Perhaps Ronald can weigh in on that. I'm not that familiar with PySide, but Qt (and PyQt) can convert a Mac window to a sheet just by applying a window flag. See http://doc.qt.digia.com/qq/qq18-macfeatures.html for particulars. --Kevin -- Kevin Walzer Code by Kevin/Mobile Code by Kevin http://www.codebykevin.com http://www.wtmobilesoftware.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] app won't quit?
Wxpython bug, that is. Sent from my iPhone On May 27, 2013, at 11:26 AM, Charles Hartman wrote: > I'm coming back to all of this after years away, so I'm sure I'm missing > something simple. I've brought an old app into the current world: > >Python 2.7.5 >OS 10.8.3 >wxPython 2.9.4.0 >py2app 0.7.3 > > and I rebuilt my setup.py to current specifications. The resulting app works > fine (though it's enormous!), but it won't respond to a Quit command > (keyboard or menu). The menu-bar header (with my app's name) flashes, but > nothing else happens. > > Thanks for any help. > > > -- > > Charles O. Hartman > Poet in Residence > Lucy Marsh Haskell '19 Professor of Literatures in English > oak.conncoll.edu/cohar > ___ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] app won't quit?
I've observed this with the wxPy demo...may be a ex bug. Sent from my iPhone On May 27, 2013, at 11:26 AM, Charles Hartman wrote: > I'm coming back to all of this after years away, so I'm sure I'm missing > something simple. I've brought an old app into the current world: > >Python 2.7.5 >OS 10.8.3 >wxPython 2.9.4.0 >py2app 0.7.3 > > and I rebuilt my setup.py to current specifications. The resulting app works > fine (though it's enormous!), but it won't respond to a Quit command > (keyboard or menu). The menu-bar header (with my app's name) flashes, but > nothing else happens. > > Thanks for any help. > > > -- > > Charles O. Hartman > Poet in Residence > Lucy Marsh Haskell '19 Professor of Literatures in English > oak.conncoll.edu/cohar > ___ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] NSSpeechSynthesizer from AppKit?
On 5/1/13 8:37 AM, Yuma Antoine Decaux wrote: Hi, I've been trying to find a way to have speech output on an assignment GUI i'm working on for uni in Tkinter (they are forcing me) and since none of the UI elements on it are accessible, i'm trying to use either pyobjc with AppKit and some event handlers in Tkinter to get speech synthesis. I've just successfully installed pyobjc and looked at the API notes. I couldn't find NSSynthesizer. Is this not available? Were you aware that this API can be called from the command line? The tool is /usr/bin/say and its documentation can be found via "man say". The overhead of pyobjc isn't necessary here. --Kevin -- Kevin Walzer Code by Kevin/Mobile Code by Kevin http://www.codebykevin.com http://www.wtmobilesoftware.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] How to make py2app app stub link to Cocoa framework?
On 3/30/13 7:37 PM, sameer wrote: Does anyone have any hints about how I can make this work? I am new to Mac Apps and sandboxing. This appears to be the error: 3/30/13 7:04:02.050 PM [0x0-0xb15b15].com.falkorsystems.defisheye: ImportError: dlopen(/Users/sameer/Documents/Falkor Systems/gopro_calibration/DeFisheye/dist/DeFisheye.app/Contents/Resources/lib/python2.7/lib-dynload/cv2.so, 2): Library not loaded: /usr/X11/lib/libpng15.15.dylib 3/30/13 7:04:02.050 PM [0x0-0xb15b15].com.falkorsystems.defisheye: Referenced from: /Users/sameer/Documents/Falkor Systems/gopro_calibration/DeFisheye/dist/DeFisheye.app/Contents/MacOS/../Frameworks/libopencv_highgui.2.4.4.dylib 3/30/13 7:04:02.050 PM [0x0-0xb15b15].com.falkorsystems.defisheye: Reason: no suitable image found. Did find: 3/30/13 7:04:02.050 PM [0x0-0xb15b15].com.falkorsystems.defisheye: /usr/X11/lib/libpng15.15.dylib: open() failed with errno=1 3/30/13 7:04:02.119 PM DeFisheye: DeFisheye Error Some linking error to libpng, apparently. This wouldn't seem to have anything to do with the Cocoa linking issue in py2app. --Kevin -- Kevin Walzer Code by Kevin/Mobile Code by Kevin http://www.codebykevin.com http://www.wtmobilesoftware.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Query Regarding IDE for python for GUI Apps
On 2/20/13 8:59 AM, Charlie Clark wrote: The port to Qt is underway. PyQt! Interesting. I hope the port is done with some attention to Mac UI conventions; Qt has excellent support for the Mac, but it does require some care with coding. Most PyQt apps that run on the Mac (such as the Eric IDE) follow Windows/Linux design patterns and jam every conceivable function into a toolbar button; the result is an incomprehensible, overwhelming mess. -- Kevin Walzer Code by Kevin/Mobile Code by Kevin http://www.codebykevin.com http://www.wtmobilesoftware.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Query Regarding IDE for python for GUI Apps
On 2/20/13 8:48 AM, Charlie Clark wrote: I'm a big fan of WingIDE for Python development. As it's still using X-Windows it's a bit ugly on Mac OS but it has a great attention to detail and fantastic deep integration with Python. It's a bit curious that they're still using the X11 version of Gtk...even Gimp now runs natively on OS X. -- Kevin Walzer Code by Kevin/Mobile Code by Kevin http://www.codebykevin.com http://www.wtmobilesoftware.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Query Regarding IDE for python for GUI Apps
On 2/19/13 9:07 PM, Vishal Ruhela wrote: I want to start App development in python for Windows and Mac OS platforms, so please suggest me some IDE to work on. I have gone through some like PyCharm. But, either they are expensive or it was hard to configure on my machine. I like IDLE myself. Simple but adequate for my needs. --Kevin -- Kevin Walzer Code by Kevin/Mobile Code by Kevin http://www.codebykevin.com http://www.wtmobilesoftware.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
[Pythonmac-SIG] Re-linking app with system Tk frameworks
Hi, To deploy my Tkinter app to the Mac App Store, it has to be linked against the system Tcl/Tk frameworks because Tk uses internal/private API calls. (You can't submit an app that makes such calls directly, but apparently system-installed libraries are exempt.) My last build of Python linked against /System/Library/Tcl.framework and friends, but a more recent build I'm using links against /Library/Frameworks/Tcl.framework et al. Is there an install_name_tool trick I can run with py2app to make sure my deployed Tkinter app links against the system framework rather than my own installation in /Library/Frameworks? I don't want to have to rebuild Python to achieve this effect, but my previous experience with py2app suggests that it's the only way to make sure py2app doesn't vaccum up the /Library/Framework bits. --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] KeyError: 'CFLAGS'
On 12/13/12 4:24 AM, Jean-Luc Régnier wrote: and the keyword "CFLAGS" indeed does not exist... Should I add something in my path directory ? (I am using windows XP) Best regards, I think the basic problem is that you can't build a Mac app on Windows...py2app is a Mac-specific tool. You should switch to the target platform and try building there. --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Getting control over the Apple menu
On 11/1/12 9:37 AM, w...@mac.com wrote: When running the script directly in the interpreter, that is, when I invoke is as $ ./CM_GUI_2.py in a terminal window (or as $ python CM_GUI_2.py) the first menu to the right of the Apple icon (the one I'd call the Application menu) remains named "Python" - although the menu under it now includes the items I've created. That's expected behavior. The application name in the app menu corresponds to the actual executable that is running the app. When you run the app in Terminal, the executable is Python. When it's wrapped with py2app, the executable is the actual app name (actually, the stub executable created by py2app, but which is renamed to match your app). You shouldn't expect to see anything but what you are seeing. -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Getting control over the Apple menu
On 10/31/12 9:49 PM, w...@mac.com wrote: Where should I have been looking to find that for myself, please? The Tk man pages discuss special menus, including the Apple menu; I figured it out in Tkinter by Googling for snippets. Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Getting control over the Apple menu
On 10/31/12 5:48 PM, w...@mac.com wrote: applemenu = Menu(menubar, tearoff = FALSE) Add the apple name to the menu object, cf: applemenu = Menu(menubar, tearoff = FALSE, name='apple') That works for me. -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] IDLE Crashes when Prefs are accessed on Python 3.3 on OSX 10.8.2
On 10/10/12 11:26 PM, Ned Deily wrote: A Python patch could go here: http://bugs.python.org/issue15853 Patch submitted. The preferences dialog no longer crashes for me. -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] IDLE Crashes when Prefs are accessed on Python 3.3 on OSX 10.8.2
On 10/10/12 10:02 PM, Kevin Walzer wrote: I've been stepping through the IDLE source code and it appears IDLE is crashing during the LoadConfigs() call of the config dialog. Still have more investigating to do, but I'm hopeful I can come up with a workaround that will keep things from crashing. I've traced the crash to this call in configDialog.py, around line 830 or so: def SetFontSample(self,event=None): fontName=self.fontName.get() if self.fontBold.get(): fontWeight=tkFont.BOLD else: fontWeight=tkFont.NORMAL ###This is where it crashes!! How to fix? self.editFont.config(size=self.fontSize.get(), weight=fontWeight,family=fontName) Specifically, the crash occurs in self.editFont.config, which configures the font-sample display in the preferences dialog. I haven't been able to develop a workaround yet--calls to "self.update," etc. haven't worked--and will revisit it in the next day or so. Any other suggestions are appreciated. --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] IDLE Crashes when Prefs are accessed on Python 3.3 on OSX 10.8.2
On 10/10/12 7:38 PM, Ned Deily wrote: Look at the dump file I attached to the Tk issue. It has a complete debug trace through Tk including C line numbers. http://sourceforge.net/tracker/?func=detail&atid=112997&aid=3575664&group _id=12997 I've been stepping through the IDLE source code and it appears IDLE is crashing during the LoadConfigs() call of the config dialog. Still have more investigating to do, but I'm hopeful I can come up with a workaround that will keep things from crashing. The stack trace that I posted earlier, in my own testing, indicates that the issue may be during the infernal event loop integration between Tk and Cocoa--there's been a lot of traffic on the Mac-Tcl list about that. Fortunately, while the low-level event loop issues are more or less unavoidable at this time, they can often be worked around at the script level with calls to update, after idle, etc. It may take some trial and error here to get that working. If I'm successful, where should I submit a patch? --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] IDLE Crashes when Prefs are accessed on Python 3.3 on OSX 10.8.2
On 10/10/12 7:38 PM, Ned Deily wrote: Look at the dump file I attached to the Tk issue. It has a complete debug trace through Tk including C line numbers. My stack trace is completely different, so I'm not sure where to look. -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] IDLE Crashes when Prefs are accessed on Python 3.3 on OSX 10.8.2
On 10/10/12 10:19 AM, Ronald Oussoren wrote: That odd. IDLE also uses '::tk::mac::ShowPreferences' for the configuration dialog. The only difference with your script is that the same command is also bound to '<>'. The code for this all is in idlelib.macosxSupport.overrideRootMenu in the stdlib. Indeed it's strange. The stack trace suggests the problem is coming from Tk, but I cannot reproduce the issue in Tk nor can I reproduce it with the simple sample Python script. As a result I am not sure what to do here. Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 Tk 0x0b0c2079 0xb00 + 794745 1 Tk 0x0b03e03d 0xb00 + 254013 2 Tk 0x0b0159e0 0xb00 + 88544 3 Tk 0x0b0159ec 0xb00 + 88556 4 Tk 0x0b0159ec 0xb00 + 88556 5 Tcl 0x0a0990fa TclServiceIdle + 63 6 Tcl 0x0a07c2f2 Tcl_DoOneEvent + 213 7 Tk 0x0b0386ab 0xb00 + 231083 8 Tcl 0x0a0990fa TclServiceIdle + 63 9 Tcl 0x0a07c2f2 Tcl_DoOneEvent + 213 10 Tk 0x0b00e59e 0xb00 + 58782 11 Tcl 0x0a00d4bb 0xa00 + 54459 12 Tcl 0x0a00e448 Tcl_EvalObjv + 66 13 _tkinter.so 0x00591b45 Tkapp_Call + 725 (_tkinter.c:1379) 14 org.python.python 0x0004acbc PyCFunction_Call + 92 15 org.python.python 0x000a2bcd PyEval_EvalFrameEx + 15277 16 org.python.python 0x000a585d PyEval_EvalCodeEx + 1885 17 org.python.python 0x000a5a19 fast_function + 297 18 org.python.python 0x000a2c6d PyEval_EvalFrameEx + 15437 19 org.python.python 0x000a585d PyEval_EvalCodeEx + 1885 20 org.python.python 0x00035b5b function_call + 331 21 org.python.python 0xcad1 PyObject_Call + 97 22 org.python.python 0x0001e80e instancemethod_call + 462 23 org.python.python 0xcad1 PyObject_Call + 97 24 org.python.python 0x0009e47e PyEval_CallObjectWithKeywords + 174 25 org.python.python 0x0001a837 PyInstance_New + 295 26 org.python.python 0xcad1 PyObject_Call + 97 27 org.python.python 0x000a2e79 PyEval_EvalFrameEx + 15961 28 org.python.python 0x000a585d PyEval_EvalCodeEx + 1885 29 org.python.python 0x00035b5b function_call + 331 30 org.python.python 0xcad1 PyObject_Call + 97 31 org.python.python 0x0009e47e PyEval_CallObjectWithKeywords + 174 32 _tkinter.so 0x00595820 PythonCmd + 224 (_tkinter.c:2074) 33 Tcl 0x0a00b6d5 TclInvokeStringCommand + 110 34 Tcl 0x0a00d4bb 0xa00 + 54459 35 Tcl 0x0a00dfb3 0xa00 + 57267 36 Tcl 0x0a00e334 Tcl_GlobalEval + 72 37 Tk 0x0b0bc7d8 0xb00 + 772056 38 Tk 0x0b0bc817 0xb00 + 772119 39 com.apple.CoreFoundation 0x97f8cd11 -[NSObject performSelector:withObject:] + 65 40 com.apple.AppKit 0x95a79663 -[NSApplication sendAction:to:from:] + 232 41 com.apple.AppKit 0x95cb3968 -[NSCarbonMenuImpl performMenuAction:withTarget:] + 247 42 com.apple.AppKit 0x95ae61e9 -[NSMenu _performKeyEquivalentWithDelegate:] + 374 43 com.apple.AppKit 0x95ae6325 -[NSMenu _performKeyEquivalentWithDelegate:] + 690 44 com.apple.AppKit 0x95ae5d94 -[NSMenu performKeyEquivalent:] + 79 45 com.apple.AppKit 0x95ae48e6 -[NSApplication _handleKeyEquivalent:] + 594 46 com.apple.AppKit 0x959da34f -[NSApplication sendEvent:] + 5772 47 Tk 0x0b0c591e 0xb00 + 809246 48 Tk 0x0b0c5ca6 0xb00 + 810150 49 Tcl 0x0a07c2d1 Tcl_DoOneEvent + 180 50 _tkinter.so 0x00593ef3 Tkapp_MainLoop + 355 (_tkinter.c:2638) -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] IDLE Crashes when Prefs are accessed on Python 3.3 on OSX 10.8.2
P.S. To fire the prefs dialog, type Command-, or command-comma. That is the default keybinding even though I did not explicitly enable it in the script. ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] IDLE Crashes when Prefs are accessed on Python 3.3 on OSX 10.8.2
On 10/9/12 5:26 AM, Ned Deily wrote: I've done some extensive building and bisecting of Fossil checkins to the tk-cocoa-8-5-backport branch and have isolated the regression to a particular checkin. I've opened Tk issue 3575664 with the details and provided a debug crash dump. I've done some additional testing of this in Tk, and cannot reproduce the crash. Also, this sample Tkinter script runs without any crash: ### from Tkinter import * root = Tk() w = Label(root, text="Hello, world!") w.pack() def showPreferences(): top = Toplevel() top.title("About this application...") root.createcommand('::tk::mac::ShowPreferences', showPreferences) root.mainloop() I think the culprit is somewhere in IDLE's internals, but I can't be sure. If the bug is in Tkinter's internals, this script should crash, but it doesn't. Please try it to confirm. At this point I'm not sure what else to suggest. --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] IDLE Crashes when Prefs are accessed on Python 3.3 on OSX 10.8.2
On 10/8/12 5:34 PM, Ned Deily wrote: As far as I can tell, the problem is not fixed in the source tree. The problem is trivial to reproduce with Python and IDLE. Try it with your own build of Tk 8.5 installed in /Library/Frameworks and with any of the current python.org 64-bit/32-bit installers (http://www.python.org/download/) or with the ActiveState Python installers. Launch the appropriate IDLE.app and select Preferences from the IDLE menu. I've done some further testing of this, and have run into something very odd. Just to be sure, I did a fresh checkout of Tk's core-8-5-branch and rebuilt it, and then rebuilt my installation of Python to link to it. (My recent Python apps have been linking to the Tk in /System/Library/Frameworks because of the Mac App Store, but as I'm moving away from the App Store that's no longer necessary.) After rebuilding and re-linking everything, I can indeed confirm the crash in IDLE. Running Command-, causes the app to crash instead of bringing up the preferences menu. However, I can't reproduce the crash in Tk itself. Running Wish, I define the standard tk::mac::ShowPrefrences procedure to print "foo" to standard output, and it works as expected. This is why I said I didn't see the error and wondered what version of Tk you were testing. What happens if something crashes in Tkinter but not in Tk directly? Is this considered a bug in Python/Tkinter? Because IDLE's preferences method is calling into tk::mac::ShowPreferences, then it shouldn't crash unless Wish is also crashing. I don't know what to say if something crashes in Python/Tkinter but not in Tk. --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] IDLE Crashes when Prefs are accessed on Python 3.3 on OSX 10.8.2
On 10/8/12 5:34 PM, Ned Deily wrote: As far as I can tell, the problem is not fixed in the source tree. The problem is trivial to reproduce with Python and IDLE. Try it with your own build of Tk 8.5 installed in /Library/Frameworks and with any of the current python.org 64-bit/32-bit installers (http://www.python.org/download/) or with the ActiveState Python installers. Launch the appropriate IDLE.app and select Preferences from the IDLE menu. I moved my own build of Python out of the way, and installed ActivePython 2.7.2, which links against my custom build of Tcl/Tk in /Library/Frameworks, based on a week-old checkout of the tip of the core-8-5-branch. Launching IDLE and typing Command-, brings up the preferences dialog without any crash. Again, I'm not sure what version of Tk you are testing against? If you're testing against the most recent build of ActiveTcl, you won't see this fix, because ActiveState hasn't incorporated it yet. The fix was committed in the past month or so, I believe, as part of the input method patch submitted by Adrian Robert. --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] IDLE Crashes when Prefs are accessed on Python 3.3 on OSX 10.8.2
On 10/8/12 4:22 PM, Ned Deily wrote: It has not been fixed yet. Is this statement based on a fresh checkout of the core-8-5-branch from http://core.tcl.tk/tk? Because my build of 8.5 dates from about a week ago, and the preferences menu issue is fixed. What I said before holds: the fix is now in the source tree, but ActiveState has not yet released an updated build of ActiveTcl to include the fix. The OP can certainly download and build the Tcl/Tk sources himself to get the fix; I agree that an alternative workaround would be to revert to an older build of ActiveTcl, assuming it's still available. --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] IDLE Crashes when Prefs are accessed on Python 3.3 on OSX 10.8.2
On 10/8/12 3:46 AM, Scott Clausen wrote: Could their be a need for an update that I'm not aware of? Yes, probably--there was a crash in Tk 8.5.12 that has since been fixed, but a binary release from ActiveState has not yet been made. When they release a new version the crash should go away. -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Tkinter ttk question
On 10/2/12 4:34 PM, w...@mac.com wrote: The problem I'm having is that this doesn't work. If I resize the window, the light gray background doesn't expand with the root window. I get a light gray patch the size of the original frame, but it is surrounded by white space. Can anyone tell me what I'm doing wrong. I prefer pack to grid. Try this: mainframe.pack(fill=BOTH, expand=YES) --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Tkinter/Mac newbie query
On 9/11/12 12:53 PM, William R. Wing (Bill Wing) wrote: Mac OSX 10.8.1, 2 x quad processor Intel MacPro, Python 2.7.3 from python.org. I've been programming in python for a couple of years (off and on), and I'm getting more and more comfortable with it. I'd like to start putting GUIs in front of some of my code, and have been looking at wx, Tkinter, and PyQt. Everything I read says that starting with Tkinter version 8.2 (or something like that) it is "themed" and Tkinter applications should look native on the various platforms. The version of Tkinter I have is 8.5, but when I code up some of the Tkinter demos, they all come out looking more like X11 applications than like native Mac apps. I assume the problem is because I'm not doing SOMETHING right in the initialization, but I'm scratching my head over what. The themed widgets use the ttk prefix, so you'll need to include an "import ttk" statement early on, and then (to avoid collisions with the standard Tk widgets) I suggest using dot notation, cf. ttk.Button. Also, remember that the ttk widgets are not drop-in replacements for the traditional Tk widgets; they have a similar API, but they are not identicial (cf. you can't set the foreground for them without creating an entirely custom stule; they pick up platform defaults much better, though). -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] wxCocoa no top menu
You may have better luck asking on a wxPython ML... Sent from my iPhone On Aug 15, 2012, at 12:24 PM, Mark Livingstone wrote: > No ideas? > > On 12 August 2012 13:31, Mark Livingstone wrote: >> Hi Guys, >> >> I finally dragged myself kicking and screaming into the current >> millennium, and loaded Macports py27-wxpython-devel 2.9.4. on my >> Mountain Lion machine. >> >> If I do a >> >> frame.Show() >> >> I get my program in a frame in the middle of the screen, and the usual >> top of screen menu. If I click the green LED, it resizes to take up >> most of the screen as expected. However, if I do >> >> frame.ShowFullScreen(True,False) >> >> I get the frame full screen, and I get the toolbar, but not the title >> bar with the 3 LEDs or the top menu. >> >> Has anyone else come across this behaviour? Is this a bug, my >> misunderstanding, or the way it works? >> >> I guess I could set the frame size to wx.DisplaySize() before showing >> it, but that seems messy unless it is the wxCocoa way of doing things? >> >> Thanks in advance, >> >> MarkL > ___ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Problems with /Library/ScriptingAdditions/Adobe Unit Types.osax
On 6/6/12 10:12 AM, William R. Wing (Bill Wing) wrote: But, it still leaves me wondering - why do wxPython and Tkinter need to look at stuff in the ScriptingAdditions area of the OS at all? That one leaves me stumped. There is nothing in your code that appears to be calling Scripting Additions, so I'm not sure. -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Problems with /Library/ScriptingAdditions/Adobe Unit Types.osax
On 6/5/12 10:36 PM, William R. Wing (Bill Wing) wrote: But, to be sure I understand… Is the reason I hadn't run into this problem earlier simply because Tk and wx need to check in with Apple Events so they can get things like mouse clicks, whereas more basic Python scripts don't? If you post a copy of your code, it would be easier to figure out what's going on. -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Problems with /Library/ScriptingAdditions/Adobe Unit Types.osax
On 6/5/12 8:43 PM, William R. Wing (Bill Wing) wrote: /Library/ScriptingAdditions/Adobe Unit Types.osax This osax is conflicting not with Python or Tk, but with the Apple Events framework. It's probably PPC or 32-bit only. An updater is available from Adobe. (I've run into this issue with my own apps, which crash when someone has an outdated osax installed--there's no workaround other than to ask the end user to remove or update the library.) -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] py2app bug with argv_emulation=True
On 6/2/12 9:24 PM, Michael O'Donnell wrote: Kevin, Seems we are not understanding each other. When a user double clicks on a document associated to the app, the app is launched. With argv emulation, I could read sys.argv to find which document was clicked on. With openDocument events, the double clicking on a document opens the application. The openDocument event is consumed (but at this point, there is only dummy code for this). Then my code is executed, overwriting the openDocument event handler. So, with this approach, there is no way to retrieve WHICH document was clicked on to open the application. Mick Mick, (ccing back to the list as well) This brute-force method works for me--I double-click a "ctpx" file and the test app launches and then displays a messagebox with the name of the launched file: import sys import time from Tkinter import * import tkMessageBox def doOpenFile(*args): for arg in args: tkMessageBox._show(message=str(arg), type="ok", icon=tkMessageBox.WARNING) tk = Tk() fr=Frame(tk, height=400, width=400, bg="red") fr.pack() time.sleep(2) tk.createcommand("::tk::mac::OpenDocument", doOpenFile) for idx, value in enumerate(sys.argv): print idx, value doOpenFile(sys.argv[1]) tk.mainloop() I'm not sure if this works because you set argv_emulation in py2app's options, since I don't structure my apps this way, and obviously the hard command of "doOpenFile(sys.argv[1])" needs to be wrapped in some sort of try statement to guard against the app being launched without a file argument, but clearly what you want to do can be done. The opendoc event is still useful for dragging the file to the app icon in the Dock, regardless. --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] py2app bug with argv_emulation=True
You may need to initialize the create command bits later in the app to avoid the open doc event getting swallowed up during startup... Sent from my iPhone On May 31, 2012, at 7:47 AM, "Michael O'Donnell" wrote: > Hi Kevin, Ronald, > > I must be missing something. I have inserted the discussed > code into a test file (test.py) as follows: > > -- > import sys > from Tkinter import * > import tkMessageBox > > def doOpenFile(*args): > for arg in args: > tkMessageBox._show(message=str(arg), type="ok", > icon=tkMessageBox.WARNING) > > tk = Tk() > tk.createcommand("::tk::mac::OpenDocument", doOpenFile) > fr=Frame(tk, height=400, width=400, bg="red") > fr.pack() > tk.mainloop() > --- > > Then I package this using py2app, specifying that it should launch > whenever a .ctpx file is double clicked: > > --- > from setuptools import setup > import sys > OPTIONS={'py2app': {'argv_emulation': True, 'resources': [], > 'plist': dict(CFBundleDocumentTypes = [dict( > CFBundleTypeExtensions = ["ctpx"], > CFBundleTypeName = "Test File", > CFBundleTypeRole = "Editor")])}} > sys.argv=[sys.argv[0]] > sys.argv.append("py2app") > setup( > app=['test.py'], > data_files=[], > options=OPTIONS, > setup_requires=['py2app']) > -- > > Running this creates an app: Test.app. > > If I then click on a file with a .ctpx extension, the application > opens, but doOpenFile is not called (not message pops up). > If I click on the .ctpx file again (while the app is open) the > message DOES appear. > > Now, this is all as I would expect, because my call of > tk.createcommand happens only AFTER my application > launches, and any openDocument event was probably > handled BEFORE the first line of my python code is > executed. > > So none of this is any help to me. My users expect to > double click on a .ctpx document to launch the application > AND open that document for editing. > > Have I missed something? > > Mick > > > > On Wed, May 30, 2012 at 8:29 PM, Kevin Walzer wrote: > > > IDLE can be opened by double clicking on python files, the code I linked > to should be responsible for implementing this. Also, the argv_emulation > code uses the openDocument event to do its work (argv_emulation basicly > runs a Carbon event loop until it has received some openDocument events > or until a timeout occurs). > > Also: > > *smacks head* > > Mick, I didn't realize that you were trying to have your app respond to a > file being dropped on the app icon. Ronald is right, argv_emulation is not > necessary for this. > > If the code sample Ronald pointed to isn't quite clear, let me explain it a > bit more: > > Tk on the Mac supports all of the basic Apple events (app launch, file open, > etc.) out of the box -- stub commands are included in the code that you can > fill out to trigger an action in response to one of the supported events. > > In the case of opening a file by dropping it on the app icon, or > double-clicking it, the relevant Tk command is "tk::mac::OpenDocument" . When > this command is defined in Tk, the code contained in the command will be > executed when an "odoc" ("open document") event is received. > > To access this functionality from Tkinter, you should use Tkinter's > createcommand() function. The "createcommand" functionality allows a Python > function/method to be mapped to a Tk command. Hence, in the IDLE example, you > have: > > root.createcommand("::tk::mac::OpenDocument", doOpenFile) > > which maps the following code to the "tk::mac::OpenDocument" command: > > def doOpenFile(*args): >for fn in args: > flist.open(fn) > > > Tk's support for this stuff on the Mac, out of the box, is actually quite > rich, but it's been poorly documented until quite recently. I contributed > documentation on all these commands to the Tk man pages: > > http://www.tcl.tk/man/tcl8.6/TkCmd/tk_mac.htm > > The commands are documented for Tk 8.6, but they are all present in the > Cocoa-based version of Tk 8.5 from ActiveState as well, so you may find some > useful things to look at here. > > Hope this helps, > Kevin > > -- > Kevin Walzer > Code by Kevin > http://www.codebykevin.com > ___ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG > > > ___ > Unlimited Disk, Data Transfer, PHP/MySQL Domain Hosting > http://www.doteasy.com > ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] py2app bug with argv_emulation=True
IDLE can be opened by double clicking on python files, the code I linked to should be responsible for implementing this. Also, the argv_emulation code uses the openDocument event to do its work (argv_emulation basicly runs a Carbon event loop until it has received some openDocument events or until a timeout occurs). Also: *smacks head* Mick, I didn't realize that you were trying to have your app respond to a file being dropped on the app icon. Ronald is right, argv_emulation is not necessary for this. If the code sample Ronald pointed to isn't quite clear, let me explain it a bit more: Tk on the Mac supports all of the basic Apple events (app launch, file open, etc.) out of the box -- stub commands are included in the code that you can fill out to trigger an action in response to one of the supported events. In the case of opening a file by dropping it on the app icon, or double-clicking it, the relevant Tk command is "tk::mac::OpenDocument" . When this command is defined in Tk, the code contained in the command will be executed when an "odoc" ("open document") event is received. To access this functionality from Tkinter, you should use Tkinter's createcommand() function. The "createcommand" functionality allows a Python function/method to be mapped to a Tk command. Hence, in the IDLE example, you have: root.createcommand("::tk::mac::OpenDocument", doOpenFile) which maps the following code to the "tk::mac::OpenDocument" command: def doOpenFile(*args): for fn in args: flist.open(fn) Tk's support for this stuff on the Mac, out of the box, is actually quite rich, but it's been poorly documented until quite recently. I contributed documentation on all these commands to the Tk man pages: http://www.tcl.tk/man/tcl8.6/TkCmd/tk_mac.htm The commands are documented for Tk 8.6, but they are all present in the Cocoa-based version of Tk 8.5 from ActiveState as well, so you may find some useful things to look at here. Hope this helps, Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] py2app bug with argv_emulation=True
On 5/30/12 3:12 AM, Ronald Oussoren wrote: IDLE can be opened by double clicking on python files, the code I linked to should be responsible for implementing this. Also, the argv_emulation code uses the openDocument event to do its work (argv_emulation basicly runs a Carbon event loop until it has received some openDocument events or until a timeout occurs). You can set a CFBundleTypeExtension key in your info.plist file to indicate that your app can handle a certain type of document via double-click. -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] py2app, system Python, and Mac App Store
On 5/4/12 9:42 PM, Kevin Walzer wrote: I'm getting quite frustrated with the app store's brain dead auto-scan tool that doesn't see proper symlinks in the framework, and I'm getting to the point where I am going to investigate other packaging tools that don't set up a framework structure--cx_freeze and/or pyinstaller. No blame to py2app here, of course. I appreciate your advice and support. I just thought I'd follow up with an update here... I was able to successfully get an update to my app submitted to the Mac App Store after switching from py2app to cx_freeze. cx_freeze doesn't bundle a framework but just moves all the Python bits into a single executable directory, so the issues with framework symlinks are side-stepped. cx_freeze development has recently resumed after a long period of inactivity, and somewhat to my surprise, it now includes good support for OS X, including running install_name_tool to make a self-contained binary. This tool seems to be very popular among PyQt developers for deploying apps on the Mac, and it also supports Python 3. I've submitted a few patches to tweak a few things, but I was able to get my own app bundled up with just a little additional work, which I'll chalk up to learning the specifics of how this tool works. Development of cx_freeze is now based at https://bitbucket.org/anthony_tuininga/cx_freeze, though it still has a SourceForge site; not sure if this new site represents the next generation, a fork, or what. In any event, I just thought I'd mention cx_freeze as a useful tool to look at. Thanks, Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] py2app, system Python, and Mac App Store
On 5/4/12 3:32 AM, Ronald Oussoren wrote: --semi-standalone without --site-packages should result in a build that doesn't access your site-packages directory (and that includes /Library/Frameworks/Python). The Apple provided bits are considered part of the stdlib for this (twisted, pyobjc, ...) because they cannot be copied into the application bundle. How do I make sure that binary packages from my site-packages directory are copied into (and found) in the app bundle, in lib-dyload? When I try a semi-standalone build and use the --site-packages flag, my app looks in /System/Library/Frameworks/Python.framework for the modules, and the app crashes. Poking around in the list archives, it seems that this type of configuration for py2app (semi-standalone but using some packages from the site-packages dir) is a bit delicate, though my research hasn't been comprehensive. What are the best practices here? I'm getting quite frustrated with the app store's brain dead auto-scan tool that doesn't see proper symlinks in the framework, and I'm getting to the point where I am going to investigate other packaging tools that don't set up a framework structure--cx_freeze and/or pyinstaller. No blame to py2app here, of course. I appreciate your advice and support. --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
[Pythonmac-SIG] py2app, system Python, and Mac App Store
My recent difficulties getting a Python app uploaded to the Mac App Store (owing to apparent issues with Apple's uploader, which seems to strip out symlinks in the embedded framework) have prompted me to look at deploying a version of my app linked to the system Python. I've never deployed a semi-standalone app, so I'm not sure what issues to be aware of. How does backward and forward compatibility work? (I'm on Lion.) If I have any extensions that I want wrapped (currently they are in my site-packages dir in /Library/Frameworks/Python), do I need to move them? On a related note, does anyone else have a Python app in the Mac App Store? Have you encountered issues with uploads or approvals? How are you setting up py2app? My recent headaches getting the app uploaded have been a real curveball, because I have had any issues previously. Thanks in advance, Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] py2app strips symlinks in frameworks, need to keep them
Ronald, On 5/2/12 5:57 AM, Ronald Oussoren wrote: I've filed a feature request in the py2app tracker that asks to always recreate the "Current" symlink:https://bitbucket.org/ronaldoussoren/py2app/issue/43/add-current-symlink-to-embedded-frameworks Thank you. Also, see the earlier e-mail: they also complain about a missing symlink to "Python" and "Resources," so py2app should address that also. I've manually added the symlinks, but it appears that they may be getting stripped out by Apple's upload/app submission tools (I think a zip archive is generated in the process though I can't be sure)--but that's a separate issue I'll have to take up with Apple. :-( Thanks, Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] py2app strips symlinks in frameworks, need to keep them
On 4/30/12 9:35 AM, Charlie Clark wrote: --semi-standalone (-s) depend on an existing installation of Python Not an option in my case, alas, but thanks for the suggestion. --K -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
[Pythonmac-SIG] py2app strips symlinks in frameworks, need to keep them
I've had an app rejected from the Mac App Store because required symlinks were not present in the bundled Python framework: Malformed Framework - The framework bundle Python (QuickWho.app/Contents/Frameworks/Python.framework/Versions/2.7) must contain a symbolic link 'Python' -> 'Versions/Current/Python'. Refer to the Anatomy of Framework Bundles for more information. Malformed Framework - The framework bundle Python (QuickWho.app/Contents/Frameworks/Python.framework/Versions/2.7) must contain a symbolic link 'Resources' -> 'Versions/Current/Resources'. Refer to the Anatomy of Framework Bundles for more information. Malformed Framework - The framework bundle Python (QuickWho.app/Contents/Frameworks/Python.framework/Versions/2.7) 'Versions' directory must contain a symbolic link 'Current' resolving to a specific version directory. Refer to the Anatomy of Framework Bundles for more information. These symlinks are present in the original framework on my system, but they appear to be stripped out by py2app. Is there a flag I can pass to py2app to retain these symlinks? I can try to add them manually later in my build script, but it's a pain and I'd rather have py2app not strip them out in the first place. --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] These modules are deprecated and have been removed in Python 3.x
On 4/18/12 9:44 AM, Leo wrote: On this page: http://docs.python.org/library/mac.html, so what replace these removed modules? Thanks. Leo Nothing did, really. Those modules are legacy ones dating back to the days of OS 9, and were automatically generated from the Carbon framework's headers by a tool (bgen) that few understood a decade ago and no one understands today. Many of the functions are not 64-bit, and untangling that would be a nightmare. There are various ways to get at the functionality that these modules offered: use PyObjC; use other functions from the standard library, since these functions pre-date OS X running on top of Unix; or, if you are really in need of specific functionality offered by one of the Carbon modules, code your own C wrapper library or use Ctypes. -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] shrink app bundle size (removing unused stuff)?
On 3/7/12 6:09 PM, Carlos Grohmann wrote: Hi there, I've been reasonably successful in building an app bundle with py2app. I'm running OS X Lion, python 2.7.2 (from python.org), wxpython 2.9beta, and my app uses matplotlib and numpy. Using py2exe, the final folder has 14MB, or 11MB compressed. Using py2app, the .app has 250MB (!) or 100MB compressed with Disk utility Examining the Contents of the .app, I can see that there's A LOT of stuff I don't need, like Editra (11MB), Locales, or Matplotlib "tests" folder (38MB) So, how could I remove these itens from my app? I tried the 'excludes' option in py2app setup.py, but without any luck. Also, what are those "codecs" in lib-dynload? I have no idea what they are. my setup.py follows. (BTW, I tried to run it without any reference to 'wx' but then the app crashes) many thanks Carlos I hope this isn't stating the obvious, but how about simply removing the unwanted bits after running setup.py? I run my py2app builds from a shell script because I have to do some additional manipulation of the app bundle. Here's an excerpt from my build script: #!/bin/sh echo "Starting dist process..." if [ -a cbk/Phynchronicity.dmg ] then rm cbk/Phynchronicity.dmg fi if [ -a cbk/Phynchronicity.app ] then rm -rf cbk/Phynchronicity.app fi python2.7 setup.py py2app mkdir dist/Phynchronicity.app/Contents/lib #copy the supporting libraries for lib in libs/* do echo "Copying $lib library..." cp -R -f $lib dist/Phynchronicity.app/Contents/lib done cp -rf dist/Phynchronicity.app cbk/Phynchronicity.app ditto --rsrc --arch i386 --arch x86_64 cbk/Phynchronicity.app cbk/Phynchronicity_intel.app rm -rf cbk/Phynchronicity.app mv cbk/Phynchronicity_intel.app cbk/Phynchronicity.app ...and so on. Hope this helps, Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] appscript dead?
On 3/8/12 10:05 AM, Christian Prinoth wrote: Hi, Â I just learned that appscript development has been halted. I use it a lot, especially in scripts that automate interactions between Office and various other aspects of OSX. Does anyone know if there is any alternative coming up? More generally, is there an official Apple roadmap on scripting in OSX? First, a caveat: while I haven't used the appscript library for its most popular use case (sending Apple Events to other scriptable apps from Python), I have made extensive use of has' work in making my own Python apps scriptable (via the "aemreceive" module in the appscript source tree), and I've also done some low-level work in modernizing bindings for AppleScript via another scripting language (Tcl). As I understand it, has decided to halt appscript development because Apple has recently categorized the low-level AppleEvent API's that appscript depends on as "legacy" API's. See this post in the "applescript-implementors" mailing list for details: http://lists.apple.com/archives/applescript-implementors/2010/Jan/msg00044.html Out of an abundance of caution, has now discourages use of appscript for new projects: "As appscript cannot be ported to the Apple-sanctioned Cocoa APIs, all cautions and caveats that apply to legacy OS X APIs effectively apply to appscript as well." I understand his caution, but I think you are still perfectly safe in using appscript, even going forward, as long as you are comfortable with using it as an essentially complete and mature library that will not undergo further development, in part because it no longer needs much refinement. My more positive assessment of the status of the Apple Events API rests, in part, on the language that the Apple engineer in the link above uses to describe it: "legacy," "superseded," but NOT the kiss of death: "deprecated." "Deprecated" means that Apple has marked the API not only for no further development, but eventual removal from the system. "Superseded" and "legacy" are a bit different in their emphasis: as I read them, they are older API's that are no longer promoted or developed much, but are not going to be removed in part because they are too foundational/critical to the system. As the Apple developer in the link above points out, the older "legacy" API's are still the basis of the shiny new Cocoa-based API's that Apple is now promoting for Apple Events. Apple is trying to steer developers to the newer API's for common functions, but the older, "legacy" API's are still there because they are the foundation for everything else. I've done some work with those low-level API's, and they are not fun to work with. If I were a Cocoa developer I would definitely use the higher-level stuff. But to *implement* the higher-level stuff (whether it is appscript, a more Cocoa-centric approach to Apple Events, or Tclapplescript, the library I've worked on), sometimes it's necessary to get your hands dirty with the low-level bits. The biggest risk of calling these API's "legacy" is that eventually fewer developers will understand how they work, and there will be less innovation along the lines of appscript. That's a real concern, but it still falls short of active deprecation and removal by Apple. To bring this back to your specific questions: 1. I am not aware of any significant change to AppleScript coming up. It's still there and still promoted by Apple. 2. Apple typically doesn't release a "roadmap" unless they are *actively* trying to steer developers in a specific direction. Removing 64-bit support from Carbon is an example of this. Marking the AppleEvent API as "legacy" is not, in my view. 3. There's no real alternative to appscript in Python, unless you shift to running AppleScripts via a shell command (osascript) or use one of the "approved" Cocoa API's via PyObjC. I'm not sure either of these approaches buys you anything that appscript does not. Hope this helps, Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] How to make py2app app stub link to Cocoa framework?
On 11/10/11 5:39 AM, Ronald Oussoren wrote: What kind of problem did you run into? Are those something that can be easily reproduced by signing a trivial application? It wouldn't display a save dialog. Under the hood Tkinter/Tk's save dialog calls into NSSavePanel. In a sandboxed app, the call to NSSavePanel is supposed to be intercepted by the Powerbox (sandbox save dialog), but no dialog would display. You'll have to rebuild the stubs, and as you already noticed you can do this by patching the setup.py in py2app/apptemplate. BTW. The reason py2app doesn't link with Cocoa is to avoid Cocoa's triggering backward compatibility modes. That is, when you link to Cocoa.framework with the 10.4 SDK a number of classes will behave slightly different than they do when linking to the 10.6 SDK. The precisedetails elude me at the moment though. It might be useful to add separate stubs for codesigning (possibly with additional flags in py2app to trigger codesigning from your setup.py file), or even replace the current stubs by ones that link to the Cocoa frameworks. Rebuilding the stubs was easy enough to do, and sufficient for my needs, but if you decide to add this capability to py2app, I'm sure other folks would find it useful. --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] How to make py2app app stub link to Cocoa framework?
On 11/8/11 11:41 PM, Kevin Walzer wrote: Is there any way I can get this executable linked to /System/Library/Frameworks/Cocoa.framework? I didn't think install_name_tool would do the trick, as that just rewrites links, rather than adding them. A Any suggestions are appreciated. I solved the problem by hacking the setup.py file in apptemplates (in the py2app source tree) to add an LDFLAGS parameter with a '-framework Cocoa' linker flag. Ugly, but it meets my needs. Probably not worth it to submit a patch. -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
[Pythonmac-SIG] How to make py2app app stub link to Cocoa framework?
I've been trying to get one of my Python-Tk applications to integrate with Lion's sandboxing framework (for Mac App Store submission) and have been having difficulty. Based on some feedback I received in the Apple Developer forums, it appears that part of the issue is that the executable stub created by py2app does not link to the Cocoa frameworks. A quick run of otool -L confirms this: Kevin-Walzers-MacBook:~ kevin$ otool -L /Users/kevin/Programming/quickwho/cbk/QuickWho.app/Contents/MacOS/QuickWho /Users/kevin/Programming/quickwho/cbk/QuickWho.app/Contents/MacOS/QuickWho: /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 832.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.10) Is there any way I can get this executable linked to /System/Library/Frameworks/Cocoa.framework? I didn't think install_name_tool would do the trick, as that just rewrites links, rather than adding them. A Any suggestions are appreciated. --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Trouble building against Tkinter on 64-bit python.org python
On 10/12/11 5:29 PM, Russell E. Owen wrote: objc[1083]: Class TKWindow is implemented in both /Library/Frameworks/Tk.framework/Versions/8.5/Tk and /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. Which one is undefined. Any idea how to deal with this? Google turned up others with this problem but no obvious solution. With Tk-Cocoa, typically you see this message when mixing libraries that are linked to the system Tk in /System/Library/Frameworks/Tk.framework and another installation (typically ActiveTcl) in /Library/Frameworks/Tk.framework. OS X gets confused and crashes with that error message. The only solution I've found is by making sure that all of your Tk-linked libraries link to one location or the other. You can do this by running otool -L on the relevant binaries and seeing where things are linked. If you're only seeing this issue now after building matplotlib, then it's logical to assume that matplotlib may have been linked to the wrong library. You can change the linking by running install_name_tool to get matplotlib to point to the correct version of Tk. --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] dialog always busy, not titled right
On 10/3/11 10:23 PM, Alex Hall wrote: 1. The app is based on a series of dialogs, and these do not seem to be titled correctly. At least, they are simply called "Python" when you switch to them. I can't speak to the VoiceOver part of your question, but "Python" suggests to me that you are not running the code as an application wrapped by py2app, but just in the bare Python interpreter--that's why the title is "Python." If you want the app name, try wrapping it with py2app. -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
[Pythonmac-SIG] "App" error--visit the MacPython website
I had a user report an error in one of my apps on startup, and he was presented with a dialog box that said " Error: Visit the MacPython website." I've seen this dialog msyelf (generated by py2app), and it takes us to Jack Jansen's old MacPython site. Shouldn't this dialog point somewhere else? If so, where? -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Ownership of installed Python on Mac
On 8/9/11 1:21 PM, Michael Foord wrote: This is a change from previous versions of OS X. Is this known, and is it an issue? (I chown'd everything back to me to get round it.) I don't believe it is a change. /Library and /System/Library are owned by the system, not you. -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] no app found
On 5/19/11 3:54 PM, Carl Aksynczak wrote: Thanks for your answer Russell, I did what you wrote for py2app and It works well for Mac OS 10.4 (power pc) But an other thing appends when I've try to build on 10.6. I get a 64 bit error. I've change the var VERSIONER_PYTHON_PREFER_32_BIT to yes. And still not compiling. This is an issue because argv_emulation is set to true. Thanks Carl IIRC, argv_emulation doesn't work in 64-bit because it depends on deprecated API's in Carbon that were not ported to 64-bit. -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
[Pythonmac-SIG] Tkinter app in Mac App Store
Hi all, I'm just writing to mention that I've had a Tkinter app approved in the Mac App Store, QuickWho (http://www.codebykevin.com/quickwho.html). I'm pretty sure it's not the first Python app included in the App Store (I believe there are a few PyObjC apps there), but there has been little discussion of the App Store on this list, so I wanted to share a few experiences, in case anyone is planning to submit a Tkinter-based program to the App Store. Most of my challenges revolved around the fact that Tk-Cocoa uses numerous calls into private methods and API's (or SPI, I guess), and so you can't bundle the Tcl/Tk frameworks with your application. The workaround for this is to link your application to the Tcl/Tk Cocoa frameworks that are bundled with OS X in /System/Library. As has been well-documented, this build of Tk is rather buggy, so proceed with caution. Using this approach requires a custom build of Python that links to the frameworks in /System/Library rather than in /Library; the simplest way to make sure of this is to move other installations of Tcl/Tk in /Library/Frameworks to another location. I outline some details about this in more depth here: http://www.codebykevin.com/opensource/app-store.html. This article doesn't mention Python (it focuses instead on Tk), but most of it is applicable, and can be supplemented by what I've outlined in this e-mail. Hope others find this useful, Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Simple PyObjC question: real or vapor?
On 4/6/11 4:33 PM, Ronald Oussoren wrote: But at least wxWidgets isn't Tk, the OSX port of Tk seems to get worse over time:-(. We've moved from IDLE not looking quite right to IDLE just crashing with TkCocoa (for example when using a number of keyboard shortcuts). I think, to be fair, that it should be pointed out that the version of Tk shipping with SL is quite buggy--as is usually the case with Apple, they do not update such libraries with OS update. Users report that recent versions of ActiveTcl's Cocoa build work quite well with IDLE--a lot of bug fixing has gone on with both Tk and Tkinter's integration of the Cocoa version of Tk. -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
[Pythonmac-SIG] Python compatible with GC?
I'm trying to debug a crash in a Python/Tkinter application that I am unable to reproduce using equivalent Tcl/Tk code. I have a custom Tcl/Tk extension library that implements an NSToolbar for Tk windows (using Tk-Cocoa). In testing this extension, when I call the standard Cocoa dialog to save a file, Python then crashes with a segfault. Ordinarily these kinds of issues are reproducible in Tk itself using Tcl/Tk itself, since the crash pertains to some bug in Tk. However, I am not able to reproduce this issue with Tcl/Tk, just with Python/Tkinter. This leads me to suspect the issue may lie somewhere within the interaction between Python and Tk. My build of Python is 2.7.1, built as 64/32-bit, and linked to the system Tcl/Tk Cocoa frameworks (for Mac App Store compatibility). Tcl/Tk is built with garbage-collection enabled; could this cause some issue with Python, which I believe does not support Objective-C-based GC? Here is my crashlog below. Any advice is appreciated. 0 com.apple.AppKit 0x7fff8758d3d4 -[NSWindow setLevel:] + 132 1 com.apple.Foundation 0x7fff814d323c __NSFireDelayedPerform + 404 2 com.apple.CoreFoundation0x7fff84dd9be8 __CFRunLoopRun + 6488 3 com.apple.CoreFoundation 0x7fff84dd7dbf CFRunLoopRunSpecific + 575 4 Tcl 0x000102da1466 Tcl_WaitForEvent + 299 5 Tcl 0x000102d7028a Tcl_DoOneEvent + 261 6 _tkinter.so 0x00010184421d Tkapp_CallDeallocArgs + 8781 7 org.python.python 0x0001006bca8d PyEval_EvalFrameEx + 20797 8 org.python.python 0x0001006becd6 PyEval_EvalCodeEx + 2118 9 org.python.python 0x0001006bccb3 PyEval_EvalFrameEx + 21347 10 org.python.python 0x0001006becd6 PyEval_EvalCodeEx + 2118 11 org.python.python 0x0001006bedf6 PyEval_EvalCode + 54 12 org.python.python 0x0001006e37fe PyRun_FileExFlags + 174 13 org.python.python 0x0001006b4a9e _PyBuiltin_Init + 14894 14 org.python.python 0x0001006bca8d PyEval_EvalFrameEx + 20797 15 org.python.python 0x0001006becd6 PyEval_EvalCodeEx + 2118 16 org.python.python 0x0001006bccb3 PyEval_EvalFrameEx + 21347 17 org.python.python 0x0001006becd6 PyEval_EvalCodeEx + 2118 18 org.python.python 0x0001006bedf6 PyEval_EvalCode + 54 19 org.python.python 0x0001006e37fe PyRun_FileExFlags + 174 20 org.python.python 0x0001006e3ab9 PyRun_SimpleFileExFlags + 489 21 com.codebykevin.quickwho-cbk0x00015856 start + 19074 22 com.codebykevin.quickwho-cbk0x000159c8 main + 229 23 com.codebykevin.quickwho-cbk0x00010e08 start + 52 --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] a word of warning for pyobjc users
On 2/22/11 8:27 AM, Ronald Oussoren wrote: Don't install Xcode 4 when you use PyObjC for your GUIs and want to use Interface Builder. The Interface Builder that's included with Xcode 4 no longer supports Python. I've filed a bug in Apple's tracker, but I have no idea if that will have any effect at all. It'll probably not help a lot, I filed the same bug just after WWDC last year and that didn't help either. Unbelievable. Apple's "scripting bridge" push, its claim of full Cocoa support for Python, Ruby, etc. seems hard to believe now. What other options are there? Specify your GUI by hand? Use the XML format from GNUStep? (Renaissance, I think)? --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Mac and Python (absolute begineer)
Hi Prashant, Welcome to the Mac! Please see some answers below: Q. How do I install python 2.6.6 on Mac? There is a build available on python.org.(python-2.6.6-macosx10.3.dmg). Is it OK if I download and install the .dmg file directly? Is it going to make 2.6.6 default one automatically or there are some post installation settings required? The installer will update your ~/.profile to place the build of Python on your $PATH. Q. I don't know if it's a universal build (python-2.6.6-macosx10.3.dmg) or not. It is universal. As per py2app docs, make sure that you use a universal build of python to make your app compatible for PPC and Intel. If above mentioned version is not universal then how do I get a universal build of python? Do I have to compile on Mac? Compiling is not hard, but the installer should do the trick for you. If above is solved then installing wxpython is straight forward and build is compatible for both (ppc and i686) architecture. Yes, wxPython does a good job of providing binary installers for the Mac. Q. In case you are building C-Extensions for python using cython or swig or anything else, how do you make sure that extension are universal and will run on both (ppc and i686) platform? I'm not sure about Cython or Swig, but extensions build with distutils pick up the settings of your Python installation and should do the right thing. Q. If a package is deployed on 10.5.5, is it going to work on minor version such as 10.5.1 or even 10.4.x? A package built on 10.5.x should run fine on 10.5.x. Backwards compatibility (building on 10.5, running on 10.4) can be done but is a bit tricky. Others on the list can help with that. Good luck! Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Amateur question about modules
On 11/3/10 4:32 PM, Pedro Gazzola wrote: "ImportError: No module named tkSnack" I tried to run one script on the Python Launcher and got this import error. So, how can I correctly import this module? And where should I put it, so Python can find it. Thanks for any help. TkSnack is a Tkinter wrapper for the Snack sound library. You'll need to install TkSnack in your site-packages path and Snack in a place where Tkinter can find it like /Library/Tcl. Google can direct you to download sites. -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
[Pythonmac-SIG] Mac app store
Well, I guess it should be no surprise that Apple's bringing the App Store to the Mac. The question is, what does it mean for Python developers? I saw a link to the app store guidelines here: http://pastie.org/1236378 If these are accurate, then I suppose Python apps that are wrapped via py2app wouldn't automatically be excluded. Java apps, however, are specifically excluded. (There are howls of protest on Apple's Java-dev list.) Of course, Apple isn't making the app store the only game in town, which is good. But as a developer of commercial desktop Mac apps in Python, I'm taking a careful look. --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] py2app 64 bit or 32 bit
On 10/13/10 12:38 PM, BjornJohansson wrote: Hi, I have a couple of questions about py2app. I would like to make a mac executable from a wxPython app that I have written. I have ubuntu 10.04 64-bit version with py2app installed. Can I use this setup to create generally usable apps or do I have to use a 32 bit version of Ubuntu? I am new at this, but I have managed to create a win executables using py2exe. Cheers, bjorn You have to build your Mac apps on a Mac. Even if py2app runs on Linux, which I'm not sure if it does, you'd be bundling up a Linux build of Python and any binary extensions, which obviously won't run on the Mac. -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] py2app on linux
On 10/15/10 4:56 AM, BjornJohansson wrote: Hi, I understood that py2app can only produce mac .apps when run on macosx and not linux. Is this correct? /bjorn That's correct. --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Python 2.6/3.1 on Mac - default arch is i386?
On 8/16/10 1:27 PM, Sridhar Ratnakumar wrote: An ideal fix to this problem, according to Hobbs, is to patch _tkinter.c to use the tcl stubs mechanism in order to support higher tcl versions during runtime (eg: 8.6). I had seen discussion of this; has ActiveState decided not to include such a patch in ActivePython? -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Python 2.6/3.1 on Mac - default arch is i386?
On 8/13/10 6:54 PM, Sridhar Ratnakumar wrote: Of course, ActiveState and the other distributors of OS X installers could choose otherwise and, if so, patch it accordingly. That's what I am currently inclined to do as we are dropping 10.4/ppc support (in favour of 10.5+/x86_64) in upcoming 2.6 releases. I haven't followed every item of this thread, so I hope this question isn't redundant: will a forthcoming release of ActivePython 2.6 or 2.7 be built as a 32/64-bit binary for Intel, and will it work with a 32/64-bit Intel build of ActiveTcl 8.6 beta (based on Cocoa)? --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] [Pyobjc-dev] ANN: py2app 0.5
On 7/30/10 7:21 AM, Ronald Oussoren wrote: I'm also not surprised that almost nobody reacted to my call for help, that's just how opensource works. That means that the projects where I work on move forward very slowly because there is only one developer that has little time. Folks, please don't forget that I do almost all my python work in my private time and don't get paid for doing it. This includes py2app, pyobjc and also the Mac port of Python itself. I'd love to spend more time on these projects, but that's not going happen without some kind of financial support. I have a donations link on the pyobjc website, but I don't know why I bothered adding it. Ronald, I think I speak for everyone on the list when I say we appreciate the work you do. The work you do as Python maintainer is invaluable. Unfortunately, the amount of time I spend on Tk development makes it hard for me to find time to contribute to MacPython development, unless I'm scratching my own itch. Toward that end, I probably will set up a bundlebuilder project at PyPi once I move to Python 3 (I have found I prefer bundlebuilder's simplicity to py2app). As you know, I've also filed patches on IDLE to make it lay nicer on Tk-Cocoa. Again, thanks for the work you do. Thanks also to Ned Deilly for his contributions, bug reports, patches, etc. --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] sys.path corrupted?
On 6/1/10 11:06 AM, Kevin Walzer wrote: Does anyone have any idea what might cause my framework build of Python to see sys.path only in the build directory of one of my apps? I don't typically jigger my Python settings with .pth files so I have no idea what to look for. I solved the problem by rebooting. Something had set the PYTHONHOME, PYTHONPATH and PYTHONEXECUTABLE environment vars in my shell. I couldn't figure it out. Very weird. Ah, well, things work OK now. -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
[Pythonmac-SIG] sys.path corrupted?
I've been trying to test a new app I'm working on and it appears that my sys.path has been corrupted somehow, because Python doesn't see things in my site-packages directory. My $PATH is correctly set up: which python /Library/Frameworks/Python64.framework/Versions/Current/bin/python However, when I run this Python, I get this output: >>> import sys >>> sys.path ['', '/Users/kevin/Programming/phynchronicity/build/Phynchronicity.app/Contents/Resources', '/Users/kevin/Programming/phynchronicity/build/Phynchronicity.app/Contents/Resources/Modules.zip'] This specific path is the sys.path for one of my applications wrapped by bundlebuilder--not the expected one! Does anyone have any idea what might cause my framework build of Python to see sys.path only in the build directory of one of my apps? I don't typically jigger my Python settings with .pth files so I have no idea what to look for. TIA, Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] python 2.7 Tkinter using Tk 8.6
On 5/21/10 1:16 AM, Stephen M. Gava wrote: Hi there, I've installed the python.org package of python 2.7b2 for osx snow leopard. It's Tkinter appears to be built against Tk 8.4, but I want to use Tkinter with my installed framework build of Tk 8.6 (for native Tk .png support among other things). So, I assume I need to build my own osx packages of 2.7 linking against Tk 8.6 to achieve this? Thanks, Stephen Yes, most likely. I believe the binary installers from Python.org still link against 8.4 by default--anything else requires you to build your own. --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Problems with Tk (I think)
On 5/6/10 10:28 AM, Jan Erik Moström wrote: I'm new to Tk so it might be something that I might be doing wrong but I have a crash that I can't find the cause to. The error message I get on the crash is: python(19468,0x7fff70f5cbe0) malloc: *** error for object 0x1002c5a10: double free *** set a breakpoint in malloc_error_break to debug Abort trap This is using the standard 2.6.1 version on OS X 10.6.3, but version 2.5 give the same result. When I try this using a linux box (v2.5.2) the program runs as it should. I tried to using the debugger to single step through the critical lines and it seem to crash when it should return from a menu item handler. The code for that handler looks like this def saveToFile(self): filename = dlg.asksaveasfilename() self._storage.store(filename,self._win.getText()) Single stepping seem to indicate that the call to self._win.getText() works just fine, the store command saves some text to a file and the file is created with the correct text, but then something seem to happen: (Pdb) s --Return-- /Users/jem/Desktop/testing.py(96)saveToFile()->None -> self._storage.store(filename,self._win.getText()) (Pdb) s 2010-05-06 15:40:54.806 Python[19589:d07] *** __NSAutoreleaseFreedObject(): release of previously deallocated object (0x1011466f0) ignored Does anyone have an idea what could be causing this? The complete code is available at<http://tmp.myownsnapshots.com/pyproblem> (and yes, I know that the code looks a bit strange but I have my reasons :) - jem ___ I'm able to run your code on Leopard (10.5.8) with Python 2.6.2 and a 64-bit Cocoa-based build of Tk (similar to the system Tcl/Tk on Snow Leopard) and I don't see any crashes; I'm not able to reproduce this error. You might actually want to consider filing a bug with Apple, because this type of crash is coming from deep within Python or Tk's internals--not in your code. --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Py2app Problem
On 4/18/10 12:24 AM, Mike wrote: Hey, Thanks. I did try it on Debian Linux, and got this: stripping zgp /usr/bin/strip: '-': No such file /usr/bin/strip: /root/crap/zgp/src/dist/zgp.app/Contents/MacOS/zgp: File format not recognized stripping saved 0 bytes (116316 / 116316) I assume that means it didn't work and I'll need a mac? Mike py2app only works on the Mac... -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
[Pythonmac-SIG] PyQt apps on Mac
Hi all, I'm interested in taking a look at PyQt apps on the Mac. Problem is--I can't find any that are already bundled as standalone apps. Right now I don't have the time or inclination to build PyQt from scratch to test things out...are there any PyQt developers on this list who can post links to standalone PyQt apps wrapped with py2app that run on Leopard? Thanks, Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Shell login for py2app bundle
On 3/19/10 9:32 AM, Dan Ross wrote: I'm trying to call Imagemagick's convert through a subprocess from within a bundled app. Console.app is telling me that it can't find it in /bin/sh which stands to reason. I can change the "convert" command to "/usr/local/bin/convert" in the app but then when convert calls Ghostscript (gs) it can't find IT in /bin/sh. Suggestions? Thanks, Dan Why wouldn't you just use the full path to gs as well? /path/to/gs --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Recommended Tcl/Tk with Py-2.6.x? (was: Test failure...)
On 3/3/10 5:33 AM, Ned Deily wrote: The main problem before was 64-bit Tk availability. IIRC, the only real game in town for that was the Apple-supplied 8.5 in 10.6 which apparently pulled in from the TkAqua Cocoa/64-bit port project (which now may be a part of 8.6?). Kevin Walzer was trying to get that the TkAqua 64-bit stuff to work with Python on 10.5 a while back but he ran into various problems. Perhaps he can jump in here with an update. I've seen reports that the X11 version of Tk may work in 64-bit (I think the MacPorts version does) but I have no (recent) personal experience with X11 Tk on OS X and, frankly, I'm not looking to get any more. X11 Tk would probably require some build tweaking. In general, Tk 8.5 64-bit (based on Cocoa) works fine with Python 64-bit, at least on Leopard. I'm not on Snow Leopard yet. Here are the major issues I've encountered: - Tk Aqua 8.6 (still in beta) is now based on Cocoa and should build as 64-bit with no problem. A Cocoa backport to 8.5 is here: http://github.com/das/tcltk/tree/de-carbon-8-5. - Building everything as a four-way universal binary is a bit tricky. See http://bugs.python.org/issue4165 and http://bugs.python.org/issue6441. These bug reports were helpful to me when I was building my current development stack (Python 2.6.2 and Tk 8.5.7 Cocoa). I see that some of these issues may have been resolved. - IDLE doesn't work out of the box with the 64-bit Cocoa-based version of Tk that ships with Snow Leopard. I've filed some patches at http://bugs.python.org/issue6075 to address the Cocoa-integration/UI issues, but there are still apparently some issues pertaining to stuff locking up (see some of the other bug links in this thread; I haven't seen them but they have caused others some serious problems). There are some other, unrelated bugs on Leopard with Cocoa-Tk IDLE (menus get wonky when they are destroyed and recreated), which won't be fixed because it's at the Appkit level (requires a fix by Apple). As a result, despite my work on integrating IDLE with Tk-Cocoa, I'm not currently using IDLE for my Python work. - A lot of development occurred on Tk-Cocoa after it was included in Snow Leopard, so there may be issues with the system-included libraries that are no longer present in the latest revs of the library. - This isn't directly related to 64-bit Tkinter and Python, but if you're doing GUI development, many developers have reported serious issues with using py2app in a 64-bit context. You can search the list archives for details, but in short, many people can't get their 64-bit Python GUI apps to build with py2app. I've seen reports on issues with PyQt and PyObjC, and I've also had similar issues with my Tkinter apps. One workaround is to use bundlebuilder, which has its own problems but can be coaxed into building 64-bit apps (search the list archives for my notes about that). I don't believe this affects wxPython at present because wxPython/wxWidgets isn't yet supported in 64-bit mode. Hope that helps, Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] problem running py2app
On 2/2/10 6:24 PM, William R.Dickson wrote: Attila Tajti gmail.com> writes: error: unpack requires a string argument of length 8 /Users/ata/Projects/MailArchiveButton/build/bdist.macosx-10.6- universal/egg/macholib/ptypes.py(48)from_str() (Pdb) ^D I'm getting the same error on my first attempt to build an app. Did you get any response to this question? Thanks, -Bill http://wiki.python.org/moin/MacPython/BundleBuilder -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
[Pythonmac-SIG] Interesting article on 64-bit py2app
Looks like someone has made some progress with a 64-bit-supporting version of py2app http://www.hardcoded.net/articles/building-64-bit-pyobjc-applications-with-py2app.htm And here are his source trees: http://hg.hardcoded.net/py2app/ http://hg.hardcoded.net/macholib/ (I have not tested these in any way, so use at your own risk...) -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] py2app annoyance
On 1/26/10 6:17 AM, Ronald Oussoren wrote: The codebase for py2app is incomprehensible at times, although that is partially caused by external contraints (distutils and the attempt to mirror py2exe's interface). It is all python code though and it should therefore be possible to clean it up without diving into C. I ran into difficulties with macholib. I didn't understand how to fix error messages like this: > error: unpack requires a string argument of length 32 > /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/macholib/ptypes.py(48)from_str() -> return cls.from_tuple(struct.unpack(endian + cls._format_, s), **kw) I tried to isolate what was going on, but nothing I tried worked. Eventually I gave up. But Ronald sees to think there are real advantages to py2app, and he would know. I prefer py2app over bundlebuilder, mostly because py2app can create standalone application without my specifying each and every file that needs to be included. Bundlebuilder is more work in this respect, that's true. If only I had more time for this stuff! What bugs my most about py2app discussions on this list is that there are too many people that complain and yet no-one seems to be inclined to do anything. Ronald, did you see the patches included in this message? http://mail.python.org/pipermail/pythonmac-sig/2009-December/021998.html These may solve some of the issues that others have been reporting. I encouraged the author of these patches to send them to you. (They didn't solve my own issues with py2app, which continues to report "New Mach-O header is too large to relocate" even after the patches. According to notes from Bob Ippolito in the list archives, the only solution here may be to recompile Tcl/Tk with different headerpad flags, which I don't have time to do.) --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] py2app annoyance
On 1/25/10 1:52 PM, Christopher Barker wrote: Kevin Walzer wrote: py2app may be more powerful than BundleBuilder, but it is also a complex, fragile beast. It consists of several different packages, requiring both a) a deep understanding of OS X mach-o internals and how libraries/load paths/dyld bits are loaded; I'm a bit confused by this -- how does bundle builder to it in a way that doesn't require this knowledge? If I understand the code correctly, it uses modulefinder, which doesn't seem to work as well as the modulegraph stuff that py2app uses. The fact that it has worked better for you doesn't necessarily mean that it is more robust or more maintainable (though having tried to dig into the Py2app code a couple times, I agree that it is a challenge!). It isn't more robust. I never claimed that. It may be more maintainable simply because it's a smaller code base--at least, I can grok its internals a bit better. And "works for me" is better than "doesn't work for me and I don't know how to fix it." But Ronald sees to think there are real advantages to py2app, and he would know. He mentioned that bundlebuilder requires you to specify every file that you include. That's not entirely true, but modulefinder is less effective at picking up dependencies than modulegraph, and you do have to do more trial and error with your builds. I believe that was the main complaint in the past. Are you offering to maintain BundleBuilder? I"ll take somthing actively maintained over something that isn't. It doesn't need an active maintainer for Python 2.x because it's in the standard library, and shouldn't require any tweaking of build scripts that make use of it unless you're trying to build a 64-bit version of your app. (Argvemulator isn't supported in 64-bit because it's part of Carbon.) When I move my code base to Python 3.x, which won't happen until all the libraries I need are ported to work with 3.x, I will look at setting up a separate bundlebuilder project somewhere. Note that modulegraph is being used by bbfreeze as well, so it's not completely unmaintained. I still wish that the was more unification among all the executable builders, it does seem to be a waste of energy to have so much stuff repeated. bbfreeze and pyinstaller have no constituency on the Mac right now--their Mac support is alpha-level at best. So I don't consider them to be part of the mix. --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] py2app annoyance
On 1/22/10 8:06 PM, Charles Hartman wrote: Your mouth to gods' ears. How much I wish someone had both the expertise (not me that's for sure) and the time to take over what is after all *the only way for ordinary Mac-Python dopes like me to make a distributable application*! Isn't this bad for the Python community, the cause of Python, etc? Or substitute "Mac" in those phrases? But it isn't the only way. http://wiki.python.org/moin/MacPython/BundleBuilder I've switched back to BundleBuilder, and it works fine. It takes a bit of trial and error to get everything wrapped up, but I've never understood why people bad-mouthed it so much. It's a single-script module, and reasonably easy to understand, and relatively easy to modify: anyone with a reasonably amount of Python skill can get it working. I just used it today to release a fully 64-bit, four-way universal build of one of my commercial/shareware Python apps. py2app may be more powerful than BundleBuilder, but it is also a complex, fragile beast. It consists of several different packages, requiring both a) a deep understanding of OS X mach-o internals and how libraries/load paths/dyld bits are loaded; and b) a deep understanding of Python internals, i.e. object graphs, etc. It's so complicated that there are only two developers in the Python community that I'm aware of who actually understand it: its original author, Bob Ippolito, who has abandoned it; and the current MacPython maintainer, Ronald Oussoren, who is also the only current maintainer of PyObjC, and who does all this stuff in his spare time. (i.e. he has limited time, and many demands on that time). In other words, py2app is now essentially unmaintained, and is starting to suffer from bit-rot. I certainly don't plan to stake my own development platform on it anymore. This isn't a criticism of anyone. Bob has gone on to bigger and better things as the co-founder of his own company, and Ronald's efforts as MacPython maintainer are absolutely essential: his limited time is focused exactly where it needs to be, on general Python/Mac issues and on PyObjC. However, the absence of a maintainer for py2app is real, and that doesn't portend well for its future. I'd encourage others to take another look at BundleBuilder. It works fine with Python 2.x, and I see no reason why it can't work with Python 3.x, with some modification (it's removed from 3.x). When I move my own platform to Python 3.x in the future, I will likely start a separate BundleBuilder 3.x project. --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Integrating aemreceive into a class--help
On 1/12/10 2:13 PM, has wrote: Kevin Walzer wrote: You don't pass self to a bound method in Python. Delete the ('', 'self', ...) tuple. HTH One more follow-up: The code now works! I run this code in Script Editor: tell application "QuickWho" get domain "codebykevin.com" end tell and my application fires up, and does what the code intends it to do. Awesome! As noted before, aemreceive doesn't seem to play nice with "self" passed in as a parameter--or at least I can't get it to. So some minor refactoring of my code worked around that issue. I used to stuff all of my app code in a main module, "QuickWho.py," for instance, that I then wrapped in an app bundle. I pulled out the main app class and put that into a different module, quickwho_main, which I then imported into QuickWho.py. Then, in the QuickWho.py module, I ran the "installeventhandler" function as outlined in the docs and sample code, with the parameters correctly set. For posterity's sake, here's my final code layout: --- import aem import aemreceive from quickwho_main import quickwhoApp app = quickwhoApp(None) #expose basic functionality to AppleScript def getDomain(domain): app.searchfield.insert(0, domain) app.servertree.selection_set('Default') app.getInfo() aemreceive.installeventhandler(getDomain, 'CoKvdman', ('', 'domain', aemreceive.kae.typeUnicodeText) ) app.mainloop() -- Thanks again to has for the help and the great package! --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Integrating aemreceive into a class--help
On 1/12/10 2:13 PM, has wrote: You don't pass self to a bound method in Python. Delete the ('', 'self', ...) tuple. My app crashes when I do that. Here's the error message: TypeError: Can't install event handler 'CoKvdman': expected 2 parameters but function 'getDomain' has 1. logout I've gotten things to load, instead, by refactoring the code to import aemreceive into a brief "main" module, into which I also import my app class, like this: import aem import aemreceive from quickwho_main import quickwhoApp #expose basic functionality to AppleScript def getDomain(domain): quickwhoApp.searchterm = StringVar() quickwhoApp.searchterm = "" quickwhoApp.searchterm.set(domain) quickwhoApp.searchfield.insert(0, domain) quickwhoApp.servertree.selection_set('Default') quickwhoApp.getInfo() aemreceive.installeventhandler(getDomain, 'CoKvdman', ('', 'domain', aemreceive.kae.typeUnicodeText) ) app = quickwhoApp(None) app.mainloop() This plays nicer with aemreceive's procedural API. Thanks, Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
[Pythonmac-SIG] Integrating aemreceive into a class--help
I'm having a harder time than expected integrating aemreceive into my application class. While aemreceive's example code is admirably clear and the docs are thorough, they are geared for procedural code, and I keep tripping over scoping issues in trying to integrate the library into a more OO setting. Here's where things stand: First, I simply import aemreceive into my app class. Next, I wrap its "installeventhandler" function into a class method, cf: def installeventhandler (self, eventcallback, eventcode, *parameterdefinitions): aemreceive.installeventhandler(eventcallback, eventcode, *parameterdefinitions, codecs=aem.Codecs()) Next, in my app class's __init__ method, I install the event handler like so: self.installeventhandler(self.getDomain, 'CoKvdman', ('', 'self', aemreceive.kae.typeUnicodeText), ('', 'domain', aemreceive.kae.typeUnicodeText) ) This actually builds and runs the application without any complaints about "self" being undefined. However, I still can't actually get data from my Apple Event. As it's currently set up, I get this error from AppleScript: "Required parameter '' is missing." I'm not clear on what this means. According to the aemreceive docs, I need to provide a tuple for each parameter included. This means two, i.e. "self" and "domain," as outlined above. I don't know what the missing parameter is. This doesn't *look* right to me: "self" prepends the "getDomain" method and actually shouldn't be included in the parameter setup as well, by my logic. However, the application crashes if I change "self.getDomain" to "getDomain" because, of course, "getDomain" is not defined. Any guidance in getting the parameters for the event handlers correctly fleshed out would be much appreciated. In particular, I'm not sure where "self" should go, nor am I even certain if aemreceive.kae.typeUnicodeText is the correct data type for that. I hope I don't sound too frustrated. Apple Events are very complicated, and has's work on making them accessible via this higher-level interface is admirable. Tk-Aqua's built-in "do-script" functionality is easier to use, and is very flexible in the sense that it allows you to execute *any* Tcl code, but aemreceive allows you to provide a real AppleScript interface to Python commands (you don't have to call raw Python code from AppleScript). There's a richer Tcl interface to Apple Events called TclAE, but it's more low-level and complex, and and it's only minimally maintained, so the extensive work needed to make it 64-bit capable has not yet been done. So, thanks again to has for his good work on this! And looking forward to additional advice on the package. Best, Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Python app with aemreceive is not scriptable
On 1/10/10 3:08 PM, Kevin Walzer wrote: What's the best way to structure the command so that it can be seen from AppleScript, i.e. run in the proper scope and not return an error? Never mind about the scope question--I found that simply adding the aemreceive bits and the custom function inside the app class resolved that issue, cf: def getDomain(domain): self.searchterm=domain self.searchfield.insert(domain) self.servertree.selection_set('Default') self.getInfo() installeventhandler( getDomain, 'GetDmain', ('', 'domain', kae.typeUnicodeText) ) The idea is to run the app, set a variable, "self.searchterm," then display the output in the app's GUI. Simple. However, now I'm running into a separate issue. The AppleScript command that corresponds to the "GetDmain" event, "get domain," returns a strange error: tell application "QuickWho" get domain "\"codebykevin.com\"" end tell It launches the app, but returns "missing value." I know "missing value" is an AppleScript constant, but I'm not sure what variable is returning empty here, which I believe is the "missing value" message. Any ideas? --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Python app with aemreceive is not scriptable
On 1/6/10 4:58 AM, has wrote: Though personally I'd be looking to add a proper AE API, even if only procedural, so that users can't just run arbitrary code. But that's your decision, not mine. Following has's advice here, I'm trying to implement a basic API (set of Python commands/functions) in one of my apps. However, it's not working, perhaps because of scoping issues. My Python apps basically run in a single fooApp class, and everything runs inside the class. To launch the app (my apps are Tkinter-based), I use something like this: if __name__== '__main__': app = fooApp(None) app.mainloop() I've added a doCommand function inside the app class to provide some basic functionality in response to an AppleScript: it will set some objects/variables, then display the output in the app. In my code it looks like this: def runCommand(self, string): self.searchterm=string self.servertree.selection_set('Default') self.getInfo() However, I'm having some trouble with getting this out to AppleScript. My script: tell application "FooApp" run script "fooApp.runCommand(\"inputstring\")" end tell returns this error: NameError: name 'fooApp' is not defined What's the best way to structure the command so that it can be seen from AppleScript, i.e. run in the proper scope and not return an error? --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig