From karstenwo at googlemail.com Wed Feb 2 01:22:51 2011 From: karstenwo at googlemail.com (Karsten Wolf) Date: Wed, 2 Feb 2011 01:22:51 +0100 Subject: [Pythonmac-SIG] [py-appscript] is System Events sleeping ? In-Reply-To: References: Message-ID: <86ED2406-C0F3-4E35-AF2E-0C9249532CFE@googlemail.com> Am 30.01.2011 um 16:12 schrieb Fandekasp: > Ok so the only solution for me is to map a sleep key which will > call my > program and plan some tasks (threading.Timer), and my program will > force my > system to sleep after that. If you're willing to dive into pyobjc, NSWorkspace may help you. Ask for a NSWorkspaceWillSleepNotification and you get ca. 30 seconds to finish your pre-sleep duties, after that, well you're asleep. This is a modified script from the pyobjc examples and works on python 2.7 with pyobjc 1.4 on OSX 10.4. YMMV. -karsten P.S.: There are many more notifications. Application launch/quit; volumes mount/unmount; sleep, wake, power-off. The original demo ran a script when a new volume was mounted. Read the NSWorkspace class reference. #!/usr/bin/env python import time import Foundation NSObject = Foundation.NSObject import AppKit NSWorkspace = AppKit.NSWorkspace NSWorkspaceWillSleepNotification = AppKit.NSWorkspaceWillSleepNotification NSWorkspaceDidWakeNotification = AppKit.NSWorkspaceDidWakeNotification import PyObjCTools.AppHelper as AppHelper class NotificationHandler(NSObject): """Class that handles the sleep notifications.""" def handleSleepNotification_(self, aNotification): for i in range(1, 101): time.sleep(1) print str(i)+u"seconds yet.." ws = NSWorkspace.sharedWorkspace() notificationCenter = ws.notificationCenter() sleepHandler = NotificationHandler.new() notificationCenter.addObserver_selector_name_object_( sleepHandler, "handleSleepNotification:", NSWorkspaceWillSleepNotification, None) print "Waiting for sheep count to start..." AppHelper.runConsoleEventLoop() From parkjv1 at gmail.com Thu Feb 3 04:23:34 2011 From: parkjv1 at gmail.com (John Parker) Date: Wed, 02 Feb 2011 17:23:34 -1000 Subject: [Pythonmac-SIG] Some test code Message-ID: All, I have written this test code if (card == "Hearts" or card == "Diamonds"): print "That card is Red" elif (card == "Spades" or card == "Clubs"): print "That card is Black" It seems to work but prior to this code, it looked like this if (card == "Hearts" or card == "Diamonds"): print "That card is Red" elif (card == "Spades" or card == "Clubs") print "That card is Black" Which didn't work. Can someone set me straight because in class The teacher gave an example like this which worked if (favcolor == "Red"): print "Roses are Red" elif (favcolor == "Blue" print "Violets are Blue" So, why did I have to add a second : after my code for spades or clubs? Thanks, John Python newbie From pythonmac at rebertia.com Thu Feb 3 05:45:14 2011 From: pythonmac at rebertia.com (Chris Rebert) Date: Wed, 2 Feb 2011 20:45:14 -0800 Subject: [Pythonmac-SIG] Some test code In-Reply-To: References: Message-ID: On Wed, Feb 2, 2011 at 7:23 PM, John Parker wrote: > All, > > I have written this test code > > if (card == "Hearts" or card == "Diamonds"): > ? ? print "That card is Red" > > elif (card == "Spades" or card == "Clubs"): > ? ? print "That card is Black" Note that the parentheses are completely unnecessary and not idiomatic style. if card == "Hearts" or card == "Diamonds": is the normal way of writing compound conditions. > It seems to work but prior to this code, it looked like this > > if (card == "Hearts" or card == "Diamonds"): > ? ? print "That card is Red" > > elif (card == "Spades" or card == "Clubs") > ? ? print "That card is Black" > > Which didn't work. ?Can someone set me straight because in class > > The teacher gave an example like this which worked > ?if (favcolor == "Red"): > ? ?print "Roses are Red" > > ?elif (favcolor == "Blue" > ? ?print "Violets are Blue" I can assure you that such code does not work. Either the example was incorrect or there is some other key difference you accidentally omitted. The colons are absolutely required. > So, why did I have to add a second : after my code for spades or clubs? All Python control structures require a colon. The general form is: : In the specific case of if-elif-else, we have: if condition: do_something elif other_condition: do_something_else else: do_a_third_thing All the colons are always mandatory. Also, your question isn't Mac-specific, so for future reference, it would have been better posed to the more general and widely-read python-list (http://mail.python.org/mailman/listinfo/python-list ). Cheers, Chris -- http://blog.rebertia.com From hraban at fiee.net Thu Feb 3 08:48:39 2011 From: hraban at fiee.net (Henning Hraban Ramm) Date: Thu, 3 Feb 2011 08:48:39 +0100 Subject: [Pythonmac-SIG] Some test code In-Reply-To: References: Message-ID: <7E617EAD-4C6F-4D9E-BD0D-21B1352F6768@fiee.net> Am 2011-02-03 um 05:45 schrieb Chris Rebert: >> if (card == "Hearts" or card == "Diamonds"): >> print "That card is Red" >> >> elif (card == "Spades" or card == "Clubs"): >> print "That card is Black" > > Note that the parentheses are completely unnecessary and not > idiomatic style. > if card == "Hearts" or card == "Diamonds": > is the normal way of writing compound conditions. or even: if card in ('Hearts', 'Diamonds'): Greetlings from Lake Constance! Hraban --- http://www.fiee.net https://www.cacert.org (I'm an assurer) From fandekasp at gmail.com Thu Feb 3 09:24:24 2011 From: fandekasp at gmail.com (Fandekasp) Date: Thu, 3 Feb 2011 08:24:24 +0000 Subject: [Pythonmac-SIG] Some test code In-Reply-To: <7E617EAD-4C6F-4D9E-BD0D-21B1352F6768@fiee.net> References: <7E617EAD-4C6F-4D9E-BD0D-21B1352F6768@fiee.net> Message-ID: If you have only 4 type of cards, it's even better to write a oneliner : print card in ["Hearts", "Diamonds"] and "That car is red" or "That card is > Black" On 3 February 2011 07:48, Henning Hraban Ramm wrote: > Am 2011-02-03 um 05:45 schrieb Chris Rebert: > > > if (card == "Hearts" or card == "Diamonds"): >>> print "That card is Red" >>> >>> elif (card == "Spades" or card == "Clubs"): >>> print "That card is Black" >>> >> >> Note that the parentheses are completely unnecessary and not idiomatic >> style. >> if card == "Hearts" or card == "Diamonds": >> is the normal way of writing compound conditions. >> > > or even: > > if card in ('Hearts', 'Diamonds'): > > > Greetlings from Lake Constance! > Hraban > --- > http://www.fiee.net > https://www.cacert.org (I'm an assurer) > > > > > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG > -------------- next part -------------- An HTML attachment was scrubbed... URL: From pythonmac at rebertia.com Thu Feb 3 09:39:15 2011 From: pythonmac at rebertia.com (Chris Rebert) Date: Thu, 3 Feb 2011 00:39:15 -0800 Subject: [Pythonmac-SIG] Some test code In-Reply-To: References: <7E617EAD-4C6F-4D9E-BD0D-21B1352F6768@fiee.net> Message-ID: > On 3 February 2011 07:48, Henning Hraban Ramm wrote: >> Am 2011-02-03 um 05:45 schrieb Chris Rebert: >> >>>> if (card == "Hearts" or card == "Diamonds"): >>>> ? ?print "That card is Red" >>>> >>>> elif (card == "Spades" or card == "Clubs"): >>>> ? ?print "That card is Black" >>> >>> Note that the parentheses are completely unnecessary and not idiomatic >>> style. >>> ? if card == "Hearts" or card == "Diamonds": >>> is the normal way of writing compound conditions. >> >> or even: >> >> if card in ('Hearts', 'Diamonds'): On Thu, Feb 3, 2011 at 12:24 AM, Fandekasp wrote: > If you have only 4 type of cards, it's even better to write a oneliner : >> >> print card in ["Hearts", "Diamonds"] and?"That car is red"?or "That card >> is Black" There's no need for that hack. Python has a proper ternary operator; use it: print ("That car is red" if card in ["Hearts", "Diamonds"] else "That card is Black") Cheers, Chris From estartu at augusta.de Thu Feb 3 14:54:53 2011 From: estartu at augusta.de (Gerhard Schmidt) Date: Thu, 03 Feb 2011 14:54:53 +0100 Subject: [Pythonmac-SIG] Problems with py2app Message-ID: <4D4AB3AD.7080906@augusta.de> HI, I try to generate an MacOSX app from one of my wxPython projects. but I've run into some problems with py2app. when I run python setup.py py2app i get the following error running py2app creating /home/users/estartu/projekte/acf/vereinsverwaltung/dist *** filtering dependencies *** 242 total 238 filtered 0 orphaned 4 remaining *** create binaries *** *** byte compile python files *** skipping byte-compilation of /Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/bootstrap/boot_app.py to boot_app.pyc skipping byte-compilation of /Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/bootstrap/chdir_resource.py to chdir_resource.pyc skipping byte-compilation of /Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/bootstrap/disable_linecache.py to disable_linecache.pyc skipping byte-compilation of /home/users/estartu/projekte/acf/vereinsverwaltung/verwaltung.py to verwaltung.pyc *** creating application bundle: ACFVereinsverwaltung *** Traceback (most recent call last): File "/Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/build_app.py", line 604, in _run self.run_normal() File "/Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/build_app.py", line 675, in run_normal self.create_binaries(py_files, pkgdirs, extensions, loader_files) File "/Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/build_app.py", line 772, in create_binaries target, arcname, pkgexts, copyexts, target.script) File "/Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/build_app.py", line 1207, in build_executable appdir, resdir, plist = self.create_bundle(target, script) File "/Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/build_app.py", line 1130, in create_bundle use_runtime_preference=use_runtime_preference File "/Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/build_app.py", line 1119, in create_appbundle extension=self.extension, File "/Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/create_appbundle.py", line 34, in create_appbundle copy(srcmain, destmain) File "/Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/util.py", line 233, in mergecopy return macholib.util.mergecopy(src, dest) File "build/bdist.macosx-10.3-fat/egg/macholib/util.py", line 111, in mergecopy copy2(src, dest) File "build/bdist.macosx-10.3-fat/egg/macholib/util.py", line 43, in copy2 shutil.copy2(fsencoding(src), fsencoding(dst)) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/shutil.py", line 100, in copy2 copystat(src, dst) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/shutil.py", line 77, in copystat os.chflags(dst, st.st_flags) OSError: [Errno 45] Operation not supported: '/home/users/estartu/projekte/acf/vereinsverwaltung/dist/ACFVereinsverwaltung.app/Contents/MacOS/Vereinsverwaltung' > /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/shutil.py(77)copystat() -> os.chflags(dst, st.st_flags) (Pdb) ctrl-d and python setup.py py2app producers another error message running py2app *** filtering dependencies *** 242 total 238 filtered 0 orphaned 4 remaining *** create binaries *** *** byte compile python files *** skipping byte-compilation of /Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/bootstrap/boot_app.py to boot_app.pyc skipping byte-compilation of /Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/bootstrap/chdir_resource.py to chdir_resource.pyc skipping byte-compilation of /Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/bootstrap/disable_linecache.py to disable_linecache.pyc skipping byte-compilation of /home/users/estartu/projekte/acf/vereinsverwaltung/verwaltung.py to verwaltung.pyc *** creating application bundle: ACFVereinsverwaltung *** Traceback (most recent call last): File "/Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/build_app.py", line 604, in _run self.run_normal() File "/Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/build_app.py", line 675, in run_normal self.create_binaries(py_files, pkgdirs, extensions, loader_files) File "/Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/build_app.py", line 772, in create_binaries target, arcname, pkgexts, copyexts, target.script) File "/Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/build_app.py", line 1207, in build_executable appdir, resdir, plist = self.create_bundle(target, script) File "/Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/build_app.py", line 1130, in create_bundle use_runtime_preference=use_runtime_preference File "/Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/build_app.py", line 1119, in create_appbundle extension=self.extension, File "/Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/create_appbundle.py", line 40, in create_appbundle copyfn=copy, File "/Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/util.py", line 237, in mergetree return macholib.util.mergetree(src, dst, condition=condition, copyfn=copyfn) File "build/bdist.macosx-10.3-fat/egg/macholib/util.py", line 145, in mergetree raise IOError(errors) IOError: [('/Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/apptemplate/lib/__error__.sh', '/home/users/estartu/projekte/acf/vereinsverwaltung/dist/ACFVereinsverwaltung.app/Contents/Resources/__error__.sh', OSError(45, 'Operation not supported')), ('/Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/apptemplate/lib/site.py', '/home/users/estartu/projekte/acf/vereinsverwaltung/dist/ACFVereinsverwaltung.app/Contents/Resources/site.py', OSError(45, 'Operation not supported')), ('/Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/apptemplate/lib/site.pyc', '/home/users/estartu/projekte/acf/vereinsverwaltung/dist/ACFVereinsverwaltung.app/Contents/Resources/site.pyc', OSError(45, 'Operation not supported'))] > /home/users/estartu/projekte/acf/vereinsverwaltung/build/bdist.macosx-10.3-fat/egg/macholib/util.py(145)mergetree() (Pdb) again ctrl-d an restart runs without error running py2app *** filtering dependencies *** 242 total 238 filtered 0 orphaned 4 remaining *** create binaries *** *** byte compile python files *** skipping byte-compilation of /Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/bootstrap/boot_app.py to boot_app.pyc skipping byte-compilation of /Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/bootstrap/chdir_resource.py to chdir_resource.pyc skipping byte-compilation of /Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/bootstrap/disable_linecache.py to disable_linecache.pyc skipping byte-compilation of /home/users/estartu/projekte/acf/vereinsverwaltung/verwaltung.py to verwaltung.pyc *** creating application bundle: ACFVereinsverwaltung *** copying verwaltung.py -> /home/users/estartu/projekte/acf/vereinsverwaltung/dist/ACFVereinsverwaltung.app/Contents/Resources creating /home/users/estartu/projekte/acf/vereinsverwaltung/dist/ACFVereinsverwaltung.app/Contents/Resources/lib creating /home/users/estartu/projekte/acf/vereinsverwaltung/dist/ACFVereinsverwaltung.app/Contents/Resources/lib/python2.6 copying build/bdist.macosx-10.6-universal/python2.6-semi_standalone/app/site-packages.zip -> /home/users/estartu/projekte/acf/vereinsverwaltung/dist/ACFVereinsverwaltung.app/Contents/Resources/lib/python2.6 creating /home/users/estartu/projekte/acf/vereinsverwaltung/dist/ACFVereinsverwaltung.app/Contents/Resources/lib/python2.6/lib-dynload creating /home/users/estartu/projekte/acf/vereinsverwaltung/dist/ACFVereinsverwaltung.app/Contents/Frameworks stripping Vereinsverwaltung stripping saved 33768 bytes (173528 / 207296) i have stipped my .py file to do nothing at all, no imports just an empty .py file still the app produces an abort trap error Process: Vereinsverwaltung [1567] Path: /home/users/estartu/projekte/acf/vereinsverwaltung/dist/ACFVereinsverwaltung.app/Contents/MacOS/Vereinsverwaltung Identifier: com.acf.vereinsverwaltung Version: 0.0.1 (0.0.0) Code Type: X86 (Native) Parent Process: launchd [98] Date/Time: 2011-02-03 14:51:30.293 +0100 OS Version: Mac OS X 10.6.6 (10J567) Report Version: 6 Interval Since Last Report: 9498 sec Crashes Since Last Report: 12 Per-App Crashes Since Last Report: 6 Anonymous UUID: 8877B2B8-9749-4AB2-B12A-4A6408A8D4E4 Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Crashed Thread: 0 Dispatch queue: com.apple.main-thread Application Specific Information: __abort() called Thread 0 Crashed: Dispatch queue: com.apple.main-thread 0 libSystem.B.dylib 0x96a18176 __kill + 10 1 libSystem.B.dylib 0x96a18168 kill$UNIX2003 + 32 2 libSystem.B.dylib 0x96aaa89d raise + 26 3 libSystem.B.dylib 0x96ac0951 __abort + 124 4 libSystem.B.dylib 0x96aa362c release_file_streams_for_task + 0 5 com.acf.vereinsverwaltung 0x00003f25 start + 10393 6 com.acf.vereinsverwaltung 0x0000699e start + 21266 7 com.acf.vereinsverwaltung 0x00006f8c main + 285 8 com.acf.vereinsverwaltung 0x000016c2 start + 54 Thread 1: Dispatch queue: com.apple.libdispatch-manager 0 libSystem.B.dylib 0x969dd982 kevent + 10 1 libSystem.B.dylib 0x969de09c _dispatch_mgr_invoke + 215 2 libSystem.B.dylib 0x969dd559 _dispatch_queue_invoke + 163 3 libSystem.B.dylib 0x969dd2fe _dispatch_worker_thread2 + 240 4 libSystem.B.dylib 0x969dcd81 _pthread_wqthread + 390 5 libSystem.B.dylib 0x969dcbc6 start_wqthread + 30 Thread 2: 0 libSystem.B.dylib 0x969dca12 __workq_kernreturn + 10 1 libSystem.B.dylib 0x969dcfa8 _pthread_wqthread + 941 2 libSystem.B.dylib 0x969dcbc6 start_wqthread + 30 Thread 0 crashed with X86 Thread State (32-bit): eax: 0x00000000 ebx: 0x96ac08e1 ecx: 0xbfffe86c edx: 0x96a18176 edi: 0x00000000 esi: 0x00000000 ebp: 0xbfffe888 esp: 0xbfffe86c ss: 0x0000001f efl: 0x00000282 eip: 0x96a18176 cs: 0x00000007 ds: 0x0000001f es: 0x0000001f fs: 0x00000000 gs: 0x00000037 cr2: 0xffe178e8 Binary Images: 0x1000 - 0x7ff7 +com.acf.vereinsverwaltung 0.0.1 (0.0.0) <6EA54C30-8072-41D2-C8FE-5938B665F31E> /home/users/estartu/projekte/acf/vereinsverwaltung/dist/ACFVereinsverwaltung.app/Contents/MacOS/Vereinsverwaltung 0x8fe00000 - 0x8fe4162b dyld 132.1 (???) <749D24EE-54BD-D74B-D305-C13F5E6C95D8> /usr/lib/dyld 0x9201f000 - 0x92022fe7 libmathCommon.A.dylib 315.0.0 (compatibility 1.0.0) <1622A54F-1A98-2CBE-B6A4-2122981A500E> /usr/lib/system/libmathCommon.A.dylib 0x9218c000 - 0x92239fe7 libobjc.A.dylib 227.0.0 (compatibility 1.0.0) /usr/lib/libobjc.A.dylib 0x925e3000 - 0x92629ff7 libauto.dylib ??? (???) <29422A70-87CF-10E2-CE59-FEE1234CFAAE> /usr/lib/libauto.dylib 0x93a31000 - 0x93a3ffe7 libz.1.dylib 1.2.3 (compatibility 1.0.0) <33C1B260-ED05-945D-FC33-EF56EC791E2E> /usr/lib/libz.1.dylib 0x969b6000 - 0x96b5dff7 libSystem.B.dylib 125.2.1 (compatibility 1.0.0) <4FFBF71A-D603-3C64-2BC6-BFBFFFD562F0> /usr/lib/libSystem.B.dylib 0x97b47000 - 0x97bb1fe7 libstdc++.6.dylib 7.9.0 (compatibility 7.0.0) <411D87F4-B7E1-44EB-F201-F8B4F9227213> /usr/lib/libstdc++.6.dylib 0x982e4000 - 0x9845ffe7 com.apple.CoreFoundation 6.6.4 (550.42) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation 0x98dfe000 - 0x98f80fe7 libicucore.A.dylib 40.0.0 (compatibility 1.0.0) <35DB7644-0780-D2AB-F6A9-45F28D2D434A> /usr/lib/libicucore.A.dylib 0xffff0000 - 0xffff1fff libSystem.B.dylib ??? (???) <4FFBF71A-D603-3C64-2BC6-BFBFFFD562F0> /usr/lib/libSystem.B.dylib Model: iMac4,1, BootROM IM41.0055.B08, 2 processors, Intel Core Duo, 2 GHz, 1,5 GB, SMC 1.1f5 Graphics: ATI Radeon X1600, ATY,RadeonX1600, PCIe, 128 MB Memory Module: global_name AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x89), Broadcom BCM43xx 1.0 (5.10.131.36.1) Bluetooth: Version 2.3.8f7, 2 service, 12 devices, 1 incoming serial ports Network Service: Ethernet, Ethernet, en0 Serial ATA Device: WDC WD2500JS-40NGB2, 232,89 GB Parallel ATA Device: MATSHITADVD-R UJ-846 USB Device: Built-in iSight, 0x05ac (Apple Inc.), 0x8501, 0xfd400000 USB Device: iPhone, 0x05ac (Apple Inc.), 0x1294, 0xfd300000 USB Device: Hub in Apple Pro Keyboard, 0x05ac (Apple Inc.), 0x1003, 0x1d100000 USB Device: Apple Optical USB Mouse, 0x05ac (Apple Inc.), 0x0304, 0x1d110000 USB Device: Apple Pro Keyboard, 0x05ac (Apple Inc.), 0x020c, 0x1d130000 USB Device: Bluetooth USB Host Controller, 0x05ac (Apple Inc.), 0x8206, 0x7d100000 USB Device: IR Receiver, 0x05ac (Apple Inc.), 0x8240, 0x7d200000 the setup.py locks like this """ This is a setup.py script generated by py2applet Usage: python setup.py py2app """ import os, sys from setuptools import setup APP = ['verwaltung.py'] DATA_FILES = [] OPTIONS = {'plist': dict(CFBundleName = "ACFVereinsverwaltung", CFBundleShortVersionString = "0.0.1", # must be in X.X.X format CFBundleGetInfoString = "ACFVereinsverwaltung 0.0.1", CFBundleExecutable = "Vereinsverwaltung", CFBundleIdentifier = "com.acf.vereinsverwaltung", ) # ,'packages': 'wx' # ,'site_packages': True } setup(app=APP ,data_files=DATA_FILES ,options={'py2app': OPTIONS} ,setup_requires=['py2app'] ) I don't understand whats going wrong with py2app. Regards Gerhard From Chris.Barker at noaa.gov Thu Feb 3 20:17:27 2011 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Thu, 03 Feb 2011 11:17:27 -0800 Subject: [Pythonmac-SIG] Some test code In-Reply-To: References: Message-ID: <4D4AFF47.7050502@noaa.gov> On 2/2/11 8:45 PM, Chris Rebert wrote: > Also, your question isn't Mac-specific, so for future reference, it > would have been better posed to the more general and widely-read > python-list (http://mail.python.org/mailman/listinfo/python-list ). or better yet, the python tutor list: http://mail.python.org/mailman/listinfo/tutor -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov From ronaldoussoren at mac.com Fri Feb 4 13:39:09 2011 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Fri, 04 Feb 2011 13:39:09 +0100 Subject: [Pythonmac-SIG] Problems with py2app In-Reply-To: <4D4AB3AD.7080906@augusta.de> References: <4D4AB3AD.7080906@augusta.de> Message-ID: <922D5B08-DD5F-4D01-B857-198EB966833B@mac.com> On 3 Feb, 2011, at 14:54, Gerhard Schmidt wrote: > HI, > > I try to generate an MacOSX app from one of my wxPython projects. but I've run into some problems with py2app. > > when I run python setup.py py2app i get the following error > > running py2app > creating /home/users/estartu/projekte/acf/vereinsverwaltung/dist > *** filtering dependencies *** > 242 total > 238 filtered > 0 orphaned > 4 remaining > *** create binaries *** > *** byte compile python files *** > skipping byte-compilation of /Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/bootstrap/boot_app.py to boot_app.pyc > skipping byte-compilation of /Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/bootstrap/chdir_resource.py to chdir_resource.pyc > skipping byte-compilation of /Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/bootstrap/disable_linecache.py to disable_linecache.pyc > skipping byte-compilation of /home/users/estartu/projekte/acf/vereinsverwaltung/verwaltung.py to verwaltung.pyc > *** creating application bundle: ACFVereinsverwaltung *** > Traceback (most recent call last): > File "/Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/build_app.py", line 604, in _run > self.run_normal() > File "/Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/build_app.py", line 675, in run_normal > self.create_binaries(py_files, pkgdirs, extensions, loader_files) > File "/Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/build_app.py", line 772, in create_binaries > target, arcname, pkgexts, copyexts, target.script) > File "/Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/build_app.py", line 1207, in build_executable > appdir, resdir, plist = self.create_bundle(target, script) > File "/Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/build_app.py", line 1130, in create_bundle > use_runtime_preference=use_runtime_preference > File "/Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/build_app.py", line 1119, in create_appbundle > extension=self.extension, > File "/Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/create_appbundle.py", line 34, in create_appbundle > copy(srcmain, destmain) > File "/Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/util.py", line 233, in mergecopy > return macholib.util.mergecopy(src, dest) > File "build/bdist.macosx-10.3-fat/egg/macholib/util.py", line 111, in mergecopy > copy2(src, dest) > File "build/bdist.macosx-10.3-fat/egg/macholib/util.py", line 43, in copy2 > shutil.copy2(fsencoding(src), fsencoding(dst)) > File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/shutil.py", line 100, in copy2 > copystat(src, dst) > File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/shutil.py", line 77, in copystat > os.chflags(dst, st.st_flags) > OSError: [Errno 45] Operation not supported: '/home/users/estartu/projekte/acf/vereinsverwaltung/dist/ACFVereinsverwaltung.app/Contents/MacOS/Vereinsverwaltung' > > /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/shutil.py(77)copystat() > -> os.chflags(dst, st.st_flags) > (Pdb) This is very odd, it seems that the object copied into the application bundle is not a regular file. The other issues you're haveing are likely related to this. > > I don't understand whats going wrong with py2app. I don't understand as well. I'll try to reproduce your problem, hopefully I'll be able to do so and find a fix. Ronald From antoine at nagafix.co.uk Fri Feb 4 19:46:41 2011 From: antoine at nagafix.co.uk (Antoine Martin) Date: Sat, 05 Feb 2011 01:46:41 +0700 Subject: [Pythonmac-SIG] gtk/pygtk + py2app recipe Message-ID: <4D4C4991.9040907@nagafix.co.uk> Hi, I've seen a number of questions about how to bundle pygtk applications using py2app (*) and I've also spent a fair amount of time figuring things out so I thought I would share my findings here. Especially since there are no recipes for it built-in, no pygtk specific info on the py2app website, and I could not find much through googling either. My own instructions are based on tryton's, so this should be your first stop: http://code.google.com/p/tryton/wiki/BuildingMacOSXInstall If that works for you great, but for some reason these were not sufficient in my case (maybe because of extra dependencies), so I also added gtk-osx's "ige-mac-bundler" to the mix: http://winswitch.org/dev/macosx.html Clearly not all sections will be relevant to you, but hopefully this will be helpful to some... Cheers Antoine (*) examples of questions on the mailing list: http://mail.python.org/pipermail/pythonmac-sig/2011-January/022910.html http://www.mail-archive.com/pythonmac-sig at python.org/msg09123.html http://www.mail-archive.com/pythonmac-sig at python.org/msg09030.html From dgodon at juno.com Sat Feb 5 03:09:35 2011 From: dgodon at juno.com (dgodon at juno.com) Date: Sat, 5 Feb 2011 02:09:35 GMT Subject: [Pythonmac-SIG] appscript: Newbie trying to script using System Events Message-ID: <20110204.180935.21744.0@webmail05.vgs.untd.com> Can anyone share some good examples of scripting System Events? For instance, to select sub-menu options of an app, or to open/close app windows, or dock panels in Photoshop. Thanks, -Demian ____________________________________________________________ $65/Hr Job - 25 Openings Part-Time job ($20-$65/hr). Requirements: Home Internet Access http://thirdpartyoffers.juno.com/TGL3131/4d4cb1a4dc404e8cdest03vuc From silver.francis at mac.com Sat Feb 5 10:34:46 2011 From: silver.francis at mac.com (Francis Young) Date: Sat, 05 Feb 2011 20:34:46 +1100 Subject: [Pythonmac-SIG] need help installing py2app Message-ID: <3CA35C20-34A0-4A3C-A8AB-0FDAC323F95E@mac.com> Hi there, Traceback (most recent call last): File "setup.py", line 106, in **extra_args File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/core.py", line 112, in setup _setup_distribution = dist = klass(attrs) File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/distribute-0.6.4-py2.5.egg/setuptools/dist.py", line 224, in __init__ _Distribution.__init__(self,attrs) File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/dist.py", line 267, in __init__ self.finalize_options() File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/distribute-0.6.4-py2.5.egg/setuptools/dist.py", line 257, in finalize_options ep.load()(self, ep.name, value) File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/distribute-0.6.4-py2.5.egg/pkg_resources.py", line 1922, in load raise ImportError("%r has no %r attribute" % (entry,attr)) ImportError: has no 'check_packages' attribute Francis-Youngs-iMac:py2app-0.5.2 FrancisYoung$ This is the error message i got and being new to python programming i don't understand how to work around this problem. Could someone please help? From hengist.podd at virgin.net Sat Feb 5 16:27:43 2011 From: hengist.podd at virgin.net (has) Date: Sat, 05 Feb 2011 15:27:43 +0000 Subject: [Pythonmac-SIG] appscript: Newbie trying to script using System Events Message-ID: <4D4D6C6F.8030206@virgin.net> dgodon wrote: > Can anyone share some good examples of scripting System Events? For > instance, to select sub-menu options of an app, or to open/close app > windows, or dock panels in Photoshop. GUI Scripting's a last resort where applications don't provide a suitable scripting interface of their own. It's brittle and fiddly, and finding your way around the structure of and application's is a chore. Best (paid) solution would be to use UI Browser (http://pfiddlesoft.com/uibrowser/) to generate AppleScript commands and convert them to Python via ASTranslate. Or you could use appscript's interactive help system to browse objects in SE; see the appscript manual for more info. HTH has From dgodon at juno.com Sat Feb 5 19:15:11 2011 From: dgodon at juno.com (dgodon at juno.com) Date: Sat, 5 Feb 2011 18:15:11 GMT Subject: [Pythonmac-SIG] appscript: Newbie trying to script using System Ev ents Message-ID: <20110205.101511.11570.0@webmail08.vgs.untd.com> Thanks for the help. I'm considering using System Events for test automation. To the extent where the app under test is script-able, that would certainly be preferable, but unfortunately, there are significant areas not exposed via the app's dictionary. Most other test automation for the mac relies on screen capture (like Siluli or TestPlant) which is very fragile and doesn't scale. System Events seemed like a potentially better option, but I was not enthusiastic about using AppleScript. appscript seemed like a good way to go. Given your feedback below, is appscript+System Events a reasonable approach for test automation? FYI, there is Mac automation tool that doesn't rely on screen capture - called Squish. I've just started evaluating it. thanks, -Demian ---------- Original Message ---------- From: has To: pythonmac-sig at python.org Subject: Re: [Pythonmac-SIG] appscript: Newbie trying to script using System Events Date: Sat, 05 Feb 2011 15:27:43 +0000 dgodon wrote: > Can anyone share some good examples of scripting System Events? For > instance, to select sub-menu options of an app, or to open/close app > windows, or dock panels in Photoshop. GUI Scripting's a last resort where applications don't provide a suitable scripting interface of their own. It's brittle and fiddly, and finding your way around the structure of and application's is a chore. Best (paid) solution would be to use UI Browser (http://pfiddlesoft.com/uibrowser/) to generate AppleScript commands and convert them to Python via ASTranslate. Or you could use appscript's interactive help system to browse objects in SE; see the appscript manual for more info. HTH has _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG at python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG ____________________________________________________________ Job Scams (EXPOSED) We investigated work at home jobs and what we found may shock you... http://thirdpartyoffers.juno.com/TGL3131/4d4d93dec7e3d2245e7st01vuc From vze26m98 at optonline.net Sat Feb 5 20:37:21 2011 From: vze26m98 at optonline.net (Charles Turner) Date: Sat, 05 Feb 2011 14:37:21 -0500 Subject: [Pythonmac-SIG] appscript: Newbie trying to script using System Ev ents In-Reply-To: <20110205.101511.11570.0@webmail08.vgs.untd.com> References: <20110205.101511.11570.0@webmail08.vgs.untd.com> Message-ID: <21FDA496-355D-448D-BD8F-51B2D995DBE1@optonline.net> On Feb 5, 2011, at 1:15 PM, dgodon at juno.com wrote: > Given your feedback below, is appscript+System Events a reasonable approach for test automation? I'm sure there are many with greater experience, but I'd second everything has said about scripting system events: brittle and fiddly pretty well sums it up. UIBrowser would be essential to keep your sanity, and you should program in py-appscript instead of Applescript. One of the things that I find most bothersome is the timing of actions: some commands can't be made before a menu or window is instantiated. I've found often that KeyboardMaestro often gets around these issues, but on the other hand, doesn't offer as complete access to System Events as py-appscript would. KeyboardMaestro is itself py-appscript-able, so you could mix and match at will. Also, a lot is dependent on your application(s) supporting System Events, which isn't (still) always the case. So, I think you could use py-appscript to aid your testing, which isn't impossible to do, but as things get more complex and big, your scripts might become un-manageable. If you can split your testing into smaller tasks, you'll be in better good shape. HTH, Charles From brendan.simon at etrix.com.au Sun Feb 6 10:47:37 2011 From: brendan.simon at etrix.com.au (Brendan Simon (eTRIX)) Date: Sun, 06 Feb 2011 20:47:37 +1100 Subject: [Pythonmac-SIG] C++ ABI 1002/102 incompatibility with wxPython In-Reply-To: <4D3F0301.3030209@noaa.gov> References: <4D3E95F8.5000101@etrix.com.au> <4D3F0301.3030209@noaa.gov> Message-ID: <4D4E6E39.70808@etrix.com.au> On 26/01/11 4:06 AM, Christopher Barker wrote: > On 1/25/11 1:20 AM, Brendan Simon (eTRIX) wrote: >> I have a wxPython app that is built with py2app. A user recently >> reported the following error when trying to run the app. >> >> Fatal Error: Mismatch between the program and library build versions >> detected. >> The library used 2.8 (no debug,Unicode,compiler with C++ ABI 1002,wx >> containers,compatible with 2.6), >> and your program used 2.8 (no debug,Unicode,compiler with C++ ABI >> 102,wx containers,compatible with 2.6). >> Abort trap >> logout As others have informed me, the C++ ABI changed from gcc-3.3 to gcc-3.4 (and beyond). > Meanwhile a couple questions/thoughts: > > > It appears to be a difference in the wx libraries on the target system >> and the wx libraries on the build system. >> >> Unfortunately, at this stage, I do not know what the OS X version is on >> the target system. >> >> The app was built using Python 2.5.4, (wxPython 2.8.11.0 or 2.8.4.2 ??) >> on OS X 10.6.6. > > Is that the "apple's" python? i.e. the one in: > > /System/Library/Frameworks/Python.framework/Versions/2.5 > > If so, that is likely your problem. py2app does not bundle up everything > if you're using Apple's python, so your python install and your users > may be different. It's not Apple's python. It is 2.5.4 from Python.org. >> Is there anyway to fix this with a py2app setting ?? > > not until we figure out what's wrong... > >> Doesn't py2app copy all the libraries to the app bundle ?? > > it should, but it won't if you are using Apple's python, and sometimes > things go wrong. wxPython puts itself in /usr/local/, while putting > nifty sys.path manipulations in the python installs, so things can get a > bit confused. But it's done so that one installer can support both > python,org and apple pythons. > >> I guess that >> doesn't guarantee that the libraries will load on any OS. > > no, it doesn't, but it should load on any version that your supporting > libs are built for -- the standard wxPython installers are built for > 10.4 and above (maybe 10.3.9 --not sure about that), and so is the > python,org python -- are you using any other third-party libs that > aren't pure python? I have more info now. The app is being run on a PPC Mac with 10.4.11 (Tiger). Tiger should be fine in terms of ABI compatibility for wxPython and Python. I now have a 10.4.11 PowerPC Mac and can replicate the problem, though it was a 10.2 (Jaguar) system that I upgraded to 10.4 (Tiger). i.e. it's not a fresh install of Tiger. $ file /Applications/MyApp.app/Contents/MyApp MyApp: Mach-O fat file with 2 architectures MyApp (for architecture ppc): Mach-O executable ppc MyApp (for architecture i386): Mach-O executable i386 $ /Applications/MyApp.app/Contents/MacOS/MyApp Fatal Error: Mismatch between the program and library build versions detected. The library used 2.8 (debug,Unicode,compiler with C++ ABI 1002,wx containers,compatible with 2.6) and wxPython used 2.8 (debug,Unicode,compiler with C++ ABI 102,wx containers,compatible with 2.6) Abort $ /Applications/MyApp.app/Contents/MacOS/python Could not find platform independent libraries Consider setting $PYTHONPATH to [:] 'import site' failed; use -v for traceback Python 2.5.4 (r254:67917, Dec 23 2008, 14:57:27) [GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin >>> import sys >>> for l in sys.path: print l ... /Library/Frameworks/Python.framework/Versions/2.5/lib/python25.zip /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-darwin /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-mac /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-mac/lib-scriptpackages /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-tk /Library/Frameworks/Python.framework/Versions/2.5/lib/lib-dynload >>> $ ls -l /Library/Frameworks/ $ No output from above command, but it shouldn't matter right, as all libraries should be in the app bundle, right ?? From hengist.podd at virgin.net Sun Feb 6 19:56:23 2011 From: hengist.podd at virgin.net (has) Date: Sun, 6 Feb 2011 18:56:23 +0000 Subject: [Pythonmac-SIG] [ann] py-appscript 1.0.0 final release Message-ID: Hi all, Just to let you know that Python appscript 1.0.0 has finally been released: http://pypi.python.org/pypi/appscript Enjoy, has From rans at email.com Sun Feb 6 19:01:18 2011 From: rans at email.com (Michael Rans) Date: Sun, 6 Feb 2011 18:01:18 +0000 (GMT) Subject: [Pythonmac-SIG] Installing modules with py2app Message-ID: <919857.40180.qm@web25905.mail.ukl.yahoo.com> Try putting env={} in subprocess For MacOS (and probably Linux if it were running through Freeze or the like), you need to pass env as an empty dict. For Windows and py2exe, you pass env as None. I don't know if this post will get through as I'm not intending to subscribe to this list, but I thought I'd try sending an answer as I came across your post. Cheers, Mike On Tue, Jan 11, 2011 at 9:42 AM, Mier, Alejandro wrote: > Hello > > I have a script that installs Python, and then installs some modules with: > > subprocess.call("python setup.py install") > > The script works on Windows with py2exe, but gives me this error when using > py2app: > > File setup.py > from distutils.core import setup > ImportError: No module named distutils.core > > I tried explicitly including distutils when building the .app bundle, with > python setup.py py2app --packages distutils (and several variations of > --includes), but then I get this error: > > error: invalid command 'install' > > What do I need to do to make this work on mac? > > Thanks! > _______________________________________________ > Pythonmac-SIG maillist - Pyth... at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kestrel.andre at gmail.com Sun Feb 6 20:03:04 2011 From: kestrel.andre at gmail.com (=?utf-8?Q?Andr=C3=A9_Renault?=) Date: Sun, 6 Feb 2011 14:03:04 -0500 Subject: [Pythonmac-SIG] [ann] py-appscript 1.0.0 final release In-Reply-To: References: Message-ID: Hooray! On 2011-02-06, at 1:56 PM, has wrote: > Hi all, > > Just to let you know that Python appscript 1.0.0 has finally been released: > > http://pypi.python.org/pypi/appscript > > Enjoy, > > has > _______________________________________________ > Do not post admin requests to the list. They will be ignored. > AppleScript-Users mailing list (applescript-users at lists.apple.com) > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/applescript-users/kestrel.andre%40gmail.com > Archives: http://lists.apple.com/archives/applescript-users > > This email sent to kestrel.andre at gmail.com From nad at acm.org Mon Feb 7 00:43:31 2011 From: nad at acm.org (Ned Deily) Date: Sun, 06 Feb 2011 15:43:31 -0800 Subject: [Pythonmac-SIG] [ann] py-appscript 1.0.0 final release References: Message-ID: In article , Andre Renault wrote: > On 2011-02-06, at 1:56 PM, has wrote: >>Just to let you know that Python appscript 1.0.0 has >>finally been released: >> http://pypi.python.org/pypi/appscript > Hooray! +1.0.0 ! -- Ned Deily, nad at acm.org From cohar at conncoll.edu Mon Feb 7 01:26:41 2011 From: cohar at conncoll.edu (Charles Hartman) Date: Sun, 6 Feb 2011 19:26:41 -0500 Subject: [Pythonmac-SIG] [ann] py-appscript 1.0.0 final release In-Reply-To: References: Message-ID: Mazel tov! How long have you been at this, has? It's a massive project & a massive service. Charles Hartman On Sun, Feb 6, 2011 at 6:43 PM, Ned Deily wrote: > In article , > Andre Renault wrote: > > On 2011-02-06, at 1:56 PM, has wrote: > >>Just to let you know that Python appscript 1.0.0 has > >>finally been released: > >> http://pypi.python.org/pypi/appscript > > Hooray! > > +1.0.0 ! > > -- > Ned Deily, > nad at acm.org > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG > -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Charles O. Hartman Poet in Residence Professor, Chair, Department of Literatures in English oak.conncoll.edu/cohar -------------- next part -------------- An HTML attachment was scrubbed... URL: From brendan.simon at etrix.com.au Tue Feb 8 12:55:14 2011 From: brendan.simon at etrix.com.au (Brendan Simon (eTRIX)) Date: Tue, 08 Feb 2011 22:55:14 +1100 Subject: [Pythonmac-SIG] C++ ABI 1002/102 incompatibility with wxPython In-Reply-To: <4D4E6E39.70808@etrix.com.au> References: <4D3E95F8.5000101@etrix.com.au> <4D3F0301.3030209@noaa.gov> <4D4E6E39.70808@etrix.com.au> Message-ID: <4D512F22.6090701@etrix.com.au> I'm still stuck on this. Has anyone got any suggestions to help solve the ABI compatibility issue with wx ?? I think it's something to do with building on 10.6 Intel, and trying to run on 10.4 PPC. It seems to work ok when run on 10.4 Intel. My 10.4 Intel box has Apple python 2.3.1 (/usr/bin/python) and wx 2.5.3.1 installed, and python.org 2.5.1 (/usr/local/bin/python) and wx 2.8 (i think). My 10.4 PPC box has Apple python 2.3.1 (/usr/bin/python) and wx 2.5.3.1 installed. It really shouldn't matter what I have installed if py2app is truly packaging up all libraries and dependencies (assuming they are universal builds). Thanks, Brendan. On 6/02/11 8:47 PM, Brendan Simon (eTRIX) wrote: > On 26/01/11 4:06 AM, Christopher Barker wrote: >> On 1/25/11 1:20 AM, Brendan Simon (eTRIX) wrote: >>> I have a wxPython app that is built with py2app. A user recently >>> reported the following error when trying to run the app. >>> >>> Fatal Error: Mismatch between the program and library build versions >>> detected. >>> The library used 2.8 (no debug,Unicode,compiler with C++ ABI 1002,wx >>> containers,compatible with 2.6), >>> and your program used 2.8 (no debug,Unicode,compiler with C++ ABI >>> 102,wx containers,compatible with 2.6). >>> Abort trap >>> logout > > As others have informed me, the C++ ABI changed from gcc-3.3 to gcc-3.4 > (and beyond). > >> Meanwhile a couple questions/thoughts: >> >> > It appears to be a difference in the wx libraries on the target system >>> and the wx libraries on the build system. >>> >>> Unfortunately, at this stage, I do not know what the OS X version is on >>> the target system. >>> >>> The app was built using Python 2.5.4, (wxPython 2.8.11.0 or 2.8.4.2 ??) >>> on OS X 10.6.6. >> >> Is that the "apple's" python? i.e. the one in: >> >> /System/Library/Frameworks/Python.framework/Versions/2.5 >> >> If so, that is likely your problem. py2app does not bundle up everything >> if you're using Apple's python, so your python install and your users >> may be different. > > > It's not Apple's python. It is 2.5.4 from Python.org. > > >>> Is there anyway to fix this with a py2app setting ?? >> >> not until we figure out what's wrong... >> >>> Doesn't py2app copy all the libraries to the app bundle ?? >> >> it should, but it won't if you are using Apple's python, and sometimes >> things go wrong. wxPython puts itself in /usr/local/, while putting >> nifty sys.path manipulations in the python installs, so things can get a >> bit confused. But it's done so that one installer can support both >> python,org and apple pythons. >> >>> I guess that >>> doesn't guarantee that the libraries will load on any OS. >> >> no, it doesn't, but it should load on any version that your supporting >> libs are built for -- the standard wxPython installers are built for >> 10.4 and above (maybe 10.3.9 --not sure about that), and so is the >> python,org python -- are you using any other third-party libs that >> aren't pure python? > > > I have more info now. The app is being run on a PPC Mac with 10.4.11 > (Tiger). Tiger should be fine in terms of ABI compatibility for > wxPython and Python. > > I now have a 10.4.11 PowerPC Mac and can replicate the problem, though > it was a 10.2 (Jaguar) system that I upgraded to 10.4 (Tiger). i.e. > it's not a fresh install of Tiger. > > $ file /Applications/MyApp.app/Contents/MyApp > MyApp: Mach-O fat file with 2 architectures > MyApp (for architecture ppc): Mach-O executable ppc > MyApp (for architecture i386): Mach-O executable i386 > > $ /Applications/MyApp.app/Contents/MacOS/MyApp > Fatal Error: Mismatch between the program and library build versions > detected. > The library used 2.8 (debug,Unicode,compiler with C++ ABI 1002,wx > containers,compatible with 2.6) > and wxPython used 2.8 (debug,Unicode,compiler with C++ ABI 102,wx > containers,compatible with 2.6) > Abort > > $ /Applications/MyApp.app/Contents/MacOS/python > Could not find platform independent libraries > Consider setting $PYTHONPATH to [:] > 'import site' failed; use -v for traceback > Python 2.5.4 (r254:67917, Dec 23 2008, 14:57:27) > [GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin > >>>> import sys >>>> for l in sys.path: print l > ... > > /Library/Frameworks/Python.framework/Versions/2.5/lib/python25.zip > /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ > /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-darwin > /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-mac > /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-mac/lib-scriptpackages > /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-tk > /Library/Frameworks/Python.framework/Versions/2.5/lib/lib-dynload >>>> > > $ ls -l /Library/Frameworks/ > $ > > No output from above command, but it shouldn't matter right, as all > libraries should be in the app bundle, right ?? > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG > From cweisiger at msg.ucsf.edu Tue Feb 8 22:48:51 2011 From: cweisiger at msg.ucsf.edu (Chris Weisiger) Date: Tue, 8 Feb 2011 13:48:51 -0800 Subject: [Pythonmac-SIG] Cannot import name PyPIRCCommand Message-ID: This is really bizarre. I have a Python program that I've built many times successfully in the past. Now I'm getting this error when I try to build it. Nothing in the program itself has changed since I last built it successfully, and I'm fairly confident that I haven't changed my Python install either, so I have no idea why the build process would be different now. Here's the full traceback: % /usr/local/bin/python2.5 setup.py py2app Traceback (most recent call last): File "setup.py", line 18, in setup_requires=['py2app'], File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/core.py", line 112, in setup _setup_distribution = dist = klass(attrs) File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/setuptools/dist.py", line 260, in __init__ File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/setuptools/dist.py", line 284, in fetch_build_eggs File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/pkg_resources.py", line 563, in resolve File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/pkg_resources.py", line 799, in best_match File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/pkg_resources.py", line 811, in obtain File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/setuptools/dist.py", line 327, in fetch_build_egg File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/setuptools/command/easy_install.py", line 446, in easy_install File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/setuptools/command/easy_install.py", line 476, in install_item File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/setuptools/command/easy_install.py", line 655, in install_eggs File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/setuptools/command/easy_install.py", line 930, in build_and_install File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/setuptools/command/easy_install.py", line 919, in run_setup File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/setuptools/sandbox.py", line 62, in run_setup File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/setuptools/sandbox.py", line 105, in run File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/setuptools/sandbox.py", line 64, in File "setup.py", line 12, in OPTIONS = {} ImportError: cannot import name PyPIRCCommand I'm not able to cd into the egg to examine its contents, sadly, so I can't figure out what exactly it's trying to do. Has anyone seen an error like this before? -Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: From cweisiger at msg.ucsf.edu Tue Feb 8 23:24:59 2011 From: cweisiger at msg.ucsf.edu (Chris Weisiger) Date: Tue, 8 Feb 2011 14:24:59 -0800 Subject: [Pythonmac-SIG] Cannot import name PyPIRCCommand In-Reply-To: References: Message-ID: On further investigation, presumably what has changed is that one of the dependencies that is automatically downloaded by setup.py / py2app now doesn't work properly. I didn't include those in the previous paste, but on cleaning my directory and then rebuilding, I see that the build fails when trying to process altgraph 0.7.2 from http://pypi.python.org/packages/source/a/altgraph/altgraph-0.7.2.tar.gz#md5=effd9f891355ae9bc243a848f6c3a519 Is there some way to specify the desired version to download? I see that altgraph was last updated January 31st. altgraph 0.7.0, which was released in January 2010, should work just fine if I can figure out how to tell py2app to use it instead. -Chris On Tue, Feb 8, 2011 at 1:48 PM, Chris Weisiger wrote: > This is really bizarre. I have a Python program that I've built many times > successfully in the past. Now I'm getting this error when I try to build it. > Nothing in the program itself has changed since I last built it > successfully, and I'm fairly confident that I haven't changed my Python > install either, so I have no idea why the build process would be different > now. Here's the full traceback: > > % /usr/local/bin/python2.5 setup.py py2app > Traceback (most recent call last): > File "setup.py", line 18, in > setup_requires=['py2app'], > File > "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/core.py", > line 112, in setup > _setup_distribution = dist = klass(attrs) > File > "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/setuptools/dist.py", > line 260, in __init__ > File > "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/setuptools/dist.py", > line 284, in fetch_build_eggs > File > "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/pkg_resources.py", > line 563, in resolve > File > "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/pkg_resources.py", > line 799, in best_match > File > "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/pkg_resources.py", > line 811, in obtain > File > "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/setuptools/dist.py", > line 327, in fetch_build_egg > File > "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/setuptools/command/easy_install.py", > line 446, in easy_install > File > "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/setuptools/command/easy_install.py", > line 476, in install_item > File > "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/setuptools/command/easy_install.py", > line 655, in install_eggs > File > "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/setuptools/command/easy_install.py", > line 930, in build_and_install > File > "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/setuptools/command/easy_install.py", > line 919, in run_setup > File > "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/setuptools/sandbox.py", > line 62, in run_setup > File > "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/setuptools/sandbox.py", > line 105, in run > File > "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/setuptools/sandbox.py", > line 64, in > File "setup.py", line 12, in > OPTIONS = {} > ImportError: cannot import name PyPIRCCommand > > > I'm not able to cd into the egg to examine its contents, sadly, so I can't > figure out what exactly it's trying to do. Has anyone seen an error like > this before? > > -Chris > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cweisiger at msg.ucsf.edu Wed Feb 9 18:25:22 2011 From: cweisiger at msg.ucsf.edu (Chris Weisiger) Date: Wed, 9 Feb 2011 09:25:22 -0800 Subject: [Pythonmac-SIG] Cannot import name PyPIRCCommand In-Reply-To: References: Message-ID: I get a working app if I build with Python 2.6, so apparently something that altgraph changed has broken compatibility with 2.5, somehow. Unfortunately this doesn't completely fix my problem, as I have another app I need to be able to build that only works with Python 2.5. -Chris On Tue, Feb 8, 2011 at 2:24 PM, Chris Weisiger wrote: > On further investigation, presumably what has changed is that one of the > dependencies that is automatically downloaded by setup.py / py2app now > doesn't work properly. I didn't include those in the previous paste, but on > cleaning my directory and then rebuilding, I see that the build fails when > trying to process altgraph 0.7.2 from > http://pypi.python.org/packages/source/a/altgraph/altgraph-0.7.2.tar.gz#md5=effd9f891355ae9bc243a848f6c3a519 > > Is there some way to specify the desired version to download? I see that > altgraph was last updated January 31st. altgraph 0.7.0, which was released > in January 2010, should work just fine if I can figure out how to tell > py2app to use it instead. > > -Chris > > > On Tue, Feb 8, 2011 at 1:48 PM, Chris Weisiger wrote: > >> This is really bizarre. I have a Python program that I've built many times >> successfully in the past. Now I'm getting this error when I try to build it. >> Nothing in the program itself has changed since I last built it >> successfully, and I'm fairly confident that I haven't changed my Python >> install either, so I have no idea why the build process would be different >> now. Here's the full traceback: >> >> % /usr/local/bin/python2.5 setup.py py2app >> Traceback (most recent call last): >> File "setup.py", line 18, in >> setup_requires=['py2app'], >> File >> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/core.py", >> line 112, in setup >> _setup_distribution = dist = klass(attrs) >> File >> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/setuptools/dist.py", >> line 260, in __init__ >> File >> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/setuptools/dist.py", >> line 284, in fetch_build_eggs >> File >> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/pkg_resources.py", >> line 563, in resolve >> File >> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/pkg_resources.py", >> line 799, in best_match >> File >> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/pkg_resources.py", >> line 811, in obtain >> File >> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/setuptools/dist.py", >> line 327, in fetch_build_egg >> File >> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/setuptools/command/easy_install.py", >> line 446, in easy_install >> File >> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/setuptools/command/easy_install.py", >> line 476, in install_item >> File >> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/setuptools/command/easy_install.py", >> line 655, in install_eggs >> File >> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/setuptools/command/easy_install.py", >> line 930, in build_and_install >> File >> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/setuptools/command/easy_install.py", >> line 919, in run_setup >> File >> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/setuptools/sandbox.py", >> line 62, in run_setup >> File >> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/setuptools/sandbox.py", >> line 105, in run >> File >> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/setuptools/sandbox.py", >> line 64, in >> File "setup.py", line 12, in >> OPTIONS = {} >> ImportError: cannot import name PyPIRCCommand >> >> >> I'm not able to cd into the egg to examine its contents, sadly, so I can't >> figure out what exactly it's trying to do. Has anyone seen an error like >> this before? >> >> -Chris >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From animator333 at yahoo.com Thu Feb 10 08:45:14 2011 From: animator333 at yahoo.com (Prashant Saxena) Date: Thu, 10 Feb 2011 13:15:14 +0530 (IST) Subject: [Pythonmac-SIG] Mac and Python (absolute begineer) Message-ID: <737690.44432.qm@web94910.mail.in2.yahoo.com> Hi, I am new on Mac platform, have some patience with me. Leopard Intel 10.5.5 XCode 3.1.4 I am using Mac to port a python application developed on Linux and finally create a deployment package. On linux, app is using python 2.6.6 and wxpython 2.8.10.1. On Mac 10.5.5 default python is 2.5.1 and wxPython is 2.8.4.x. 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? Q. I don't know if it's a universal build (python-2.6.6-macosx10.3.dmg) or not. 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? If above is solved then installing wxpython is straight forward and build is compatible for both (ppc and i686) architecture. 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? 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? I may have asked things in an inappropriate way as I don't know much about Mac platform. accept my apologies in advance. Cheers Prashant From kw at codebykevin.com Thu Feb 10 15:49:15 2011 From: kw at codebykevin.com (Kevin Walzer) Date: Thu, 10 Feb 2011 09:49:15 -0500 Subject: [Pythonmac-SIG] Mac and Python (absolute begineer) In-Reply-To: <737690.44432.qm@web94910.mail.in2.yahoo.com> References: <737690.44432.qm@web94910.mail.in2.yahoo.com> Message-ID: <4D53FAEB.4050909@codebykevin.com> 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 From Chris.Barker at noaa.gov Thu Feb 10 16:35:03 2011 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Thu, 10 Feb 2011 07:35:03 -0800 Subject: [Pythonmac-SIG] Mac and Python (absolute begineer) In-Reply-To: <4D53FAEB.4050909@codebykevin.com> References: <737690.44432.qm@web94910.mail.in2.yahoo.com> <4D53FAEB.4050909@codebykevin.com> Message-ID: <4D5405A7.6050400@noaa.gov> On 2/10/11 6:49 AM, Kevin Walzer wrote: > 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. They both produce C code, how you compile them is up to you -- they also both have confusing directions about that on some sites -- so make sure to use ditutils to build -- i.e. write a "setup.py". That's the best way to do it on other platfroms anyway. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov From christian at prinoth.name Fri Feb 11 12:22:38 2011 From: christian at prinoth.name (Christian Prinoth) Date: Fri, 11 Feb 2011 12:22:38 +0100 Subject: [Pythonmac-SIG] appscript and Office 2011, not working? Message-ID: Just upgraded to Office 2011, and it appears appscript is not working correctly with Excel 2011. If I do the following: > app(u'/Applications/Microsoft Office 2011/Microsoft > Excel').ranges[u'B2'].value() I get: --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) /Users/c.prinoth/ in () /Library/Python/2.6/site-packages/appscript-1.0.0-py2.6-macosx-10.6-universal.egg/appscript/reference.pyc in __getitem__(self, selector) 587 def __getitem__(self, selector): 588 if isinstance(selector, basestring): # by-name --> 589 return Reference(self.AS_appdata, self.AS_aemreference.byname(selector)) 590 elif isinstance(selector, (GenericReference, Reference, Test)): # by-test 591 if isinstance(selector, GenericReference): AttributeError: 'Property' object has no attribute 'byname' while issuing the corresponding command in Applescript editor works perfectly: * * *tell* *application* "Microsoft Excel" *get* value *of* *range* "B2" --> "seweqwe" *end tell* *Result:* "seweqwe" -------------- next part -------------- An HTML attachment was scrubbed... URL: From hengist.podd at virgin.net Sun Feb 13 19:12:32 2011 From: hengist.podd at virgin.net (has) Date: Sun, 13 Feb 2011 18:12:32 +0000 Subject: [Pythonmac-SIG] appscript and Office 2011, not working? Message-ID: Christian Prinoth wrote: > Just upgraded to Office 2011, and it appears appscript is not working > correctly with Excel 2011. > > If I do the following: > > app(u'/Applications/Microsoft Office 2011/Microsoft > Excel').ranges[u'B2'].value() > > I get: > > AttributeError: 'Property' object has no attribute 'byname' > > while issuing the corresponding command in Applescript editor works > perfectly: Wild guess: Excel's dictionary defines both a 'ranges' property and a 'range' class (plural 'ranges'). AppleScript can just about deal with that sort of ambiguity as the compiler can determine from context if a 'ranges' keyword is being used as a property name or element name. Appscript doesn't have that luxury, so has to favour one interpretation or the other; in this case, the former. If you need it to go the other way, you'll need to drop down to the aem API (equivalent to using chevron syntax in AS); something like: app('Microsoft Excel').AS_newreference(aem.app.elements('xxxx'))['B2'].value() You'll need to use ASDictionary to export the Excel dictionary as plain text in order to look up the correct four-char code to use in the aem reference. I won't bother suggesting you file a bug report on Excel - feel free to do so, but I don't imagine the developers will want to change anything as long as it's working in AS (no small achievement itself). It's not really their fault anyway: Apple have never provided an adequate spec for application developers to follow, never mind validation tools to check their application dictionaries are formally correct. So the best that any application developer can realistically do is test that their app works okay with AS, as that's the de facto standard. Appscript tries to be quirk-for-quirk compatible with AS to minimize these sorts of compatibility problems, but there are limits to what it can reasonably achieve and sometimes you just have to fall back to the lower-level APIs to deal with such issues. HTH has From i at yaofur.com Tue Feb 15 11:34:27 2011 From: i at yaofur.com (Fur Yao) Date: Tue, 15 Feb 2011 18:34:27 +0800 Subject: [Pythonmac-SIG] Problem with PyObjC memory usage ~ Message-ID: Hi, Everyone~ I have develop a soft using Python to do something. So create a header .h and implement it with Python. Then I use Py_Initialize and PyRun_SimpleFile to load the necessary module by running 'main.py'. It works fine. But I found it will couse a lot of memory usage( without Python about 20M and with Python it goes up to 50M or higher). I want to know how to release the unnecessary memory usage~ Or I have to rewrite all the python code to Objective-C~ And another question , if I use PyObjC in my project. Should I open my source? And if I open my source , can I sell my own opensource soft in AppStore. If so , which license should I use? Thanks for your help , and forgive me pool English. -- Blog: http://kebot.me/ More About Me: http://about.me/yaofur/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From hsoft at hardcoded.net Tue Feb 15 11:54:51 2011 From: hsoft at hardcoded.net (Virgil Dupras) Date: Tue, 15 Feb 2011 11:54:51 +0100 Subject: [Pythonmac-SIG] Problem with PyObjC memory usage ~ In-Reply-To: References: Message-ID: On 2011-02-15, at 11:34 AM, Fur Yao wrote: > > It works fine. But I found it will couse a lot of memory usage( without Python about 20M and with Python it goes up to 50M or higher). > > I want to know how to release the unnecessary memory usage~ When importing modules like "Foundation" or "Appkit" in Python, big files with metadata are loaded up. As long as you import those modules, you'll get this high memory usage. Addressing this problem is on PyObjC's roadmap, but its maintainer, Ronald, is pretty much the only one working on it, so development is slow. If you want to reduce memory usage, you might have to convert a part of your code to Objective-C, yes. I wrote an article about that a while ago: http://www.hardcoded.net/articles/embedded-pyobjc.htm > Or I have to rewrite all the python code to Objective-C~ > > And another question , if I use PyObjC in my project. Should I open my source? > No, it's licensed under MIT. Virgil From ronaldoussoren at mac.com Tue Feb 15 13:32:11 2011 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Tue, 15 Feb 2011 13:32:11 +0100 Subject: [Pythonmac-SIG] gtk/pygtk + py2app recipe In-Reply-To: <4D4C4991.9040907@nagafix.co.uk> References: <4D4C4991.9040907@nagafix.co.uk> Message-ID: <314F9BCB-F07B-4B35-BB15-F2A02043C3F8@mac.com> On 4 Feb, 2011, at 19:46, Antoine Martin wrote: > Hi, > > I've seen a number of questions about how to bundle pygtk applications > using py2app (*) and I've also spent a fair amount of time figuring > things out so I thought I would share my findings here. Especially since > there are no recipes for it built-in, no pygtk specific info on the > py2app website, and I could not find much through googling either. AFAIK nobody has written py2app recipies for gtk. If someone does write a recipe I'd be happy to include it (preferably the recipe would be accompanied by a small example that will allow me to test if the recipe still works after updates). Ronald From ronaldoussoren at mac.com Tue Feb 15 13:37:31 2011 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Tue, 15 Feb 2011 13:37:31 +0100 Subject: [Pythonmac-SIG] Problem with PyObjC memory usage ~ In-Reply-To: References: Message-ID: <997292B7-F654-42FB-8C7A-5AD30A385405@mac.com> On 15 Feb, 2011, at 11:34, Fur Yao wrote: > Hi, Everyone~ > > I have develop a soft using Python to do something. > > So create a header .h and implement it with Python. > > Then I use Py_Initialize and PyRun_SimpleFile > to load the necessary module by running 'main.py'. > > It works fine. But I found it will couse a lot of memory usage( without Python about 20M and with Python it goes up to 50M or higher). Looking into PyObjC memory usage is on my todolist, but I haven't gotten around to doing the work. > > I want to know how to release the unnecessary memory usage~ > > Or I have to rewrite all the python code to Objective-C~ Is the memory use bothering you? > > And another question , if I use PyObjC in my project. Should I open my source? No. PyObjC is released with the MIT license and that allows you to use it in closed source software. > > And if I open my source , can I sell my own opensource soft in AppStore. If so , which license should I use? I'm not a lawyer and haven't studied the AppStore requirements, but as long as you own the copyright on the application itself you can relicense your code as much as you want and hence sell it on the AppStore. I'd be carefull w.r.t. including (L)GPL-ed code in your application though, the iOS appstore requirements are incompatible with that license and I'd be surprised if the OSX appstore were any different. Ronald -------------- next part -------------- An HTML attachment was scrubbed... URL: From ronaldoussoren at mac.com Tue Feb 15 14:12:17 2011 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Tue, 15 Feb 2011 14:12:17 +0100 Subject: [Pythonmac-SIG] Problem with PyObjC memory usage ~ In-Reply-To: References: Message-ID: <07A5ADE5-ACA0-452D-9187-A668CAEB5A77@mac.com> On 15 Feb, 2011, at 11:54, Virgil Dupras wrote: > > On 2011-02-15, at 11:34 AM, Fur Yao wrote: > >> >> It works fine. But I found it will couse a lot of memory usage( without Python about 20M and with Python it goes up to 50M or higher). >> >> I want to know how to release the unnecessary memory usage~ > > When importing modules like "Foundation" or "Appkit" in Python, big files with metadata are loaded up. As long as you import those modules, you'll get this high memory usage. Addressing this problem is on PyObjC's roadmap, but its maintainer, Ronald, is pretty much the only one working on it, so development is slow. To be clear: "pretty much the only one" means that I'm the only one working on PyObjC except for some contributed bugfixes (mostly be Virgil in the last year). Researching and (hopefully) fixing the memory usage of PyObjC requires several days of work, which I just don't have at the moment. I do almost all my work on PyObjC in my not very copious free time, and that means progress is slow and I tend to prefer to work on more interesting things that this issue. Ronald From animator333 at yahoo.com Wed Feb 16 14:19:18 2011 From: animator333 at yahoo.com (Prashant Saxena) Date: Wed, 16 Feb 2011 18:49:18 +0530 (IST) Subject: [Pythonmac-SIG] py2app -> .app size is too big Message-ID: <76465.11467.qm@web94901.mail.in2.yahoo.com> Hi, Leopard 10.5.5 Intel XCode 3.1.4 Python 2.6.6 universal wxpython 2.8.11.0 universal After installing py2app using "python setup.py install", I created an .app of default wxpython's example name "supperdoodle". The resulting superdoodle.app is around 48.5 MB. Am I missing something in setup.py or this is normal size for wxpython based applications? Cheers Prashant From cweisiger at msg.ucsf.edu Wed Feb 16 16:59:35 2011 From: cweisiger at msg.ucsf.edu (Chris Weisiger) Date: Wed, 16 Feb 2011 07:59:35 -0800 Subject: [Pythonmac-SIG] py2app -> .app size is too big In-Reply-To: <76465.11467.qm@web94901.mail.in2.yahoo.com> References: <76465.11467.qm@web94901.mail.in2.yahoo.com> Message-ID: Sounds about right. Remember that your app also includes the Python interpreter and a whole bunch of support libraries. Even simple apps are not very small. One of the prices you pay for using Python. -Chris On Wed, Feb 16, 2011 at 5:19 AM, Prashant Saxena wrote: > Hi, > > Leopard 10.5.5 Intel > XCode 3.1.4 > Python 2.6.6 universal > wxpython 2.8.11.0 universal > > After installing py2app using "python setup.py install", I created an .app > of > default wxpython's example name "supperdoodle". > The resulting superdoodle.app is around 48.5 MB. Am I missing something in > setup.py or this is normal size for wxpython based applications? > > Cheers > > > Prashant > > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hraban at fiee.net Wed Feb 16 16:40:41 2011 From: hraban at fiee.net (Henning Hraban Ramm) Date: Wed, 16 Feb 2011 16:40:41 +0100 Subject: [Pythonmac-SIG] py2app -> .app size is too big In-Reply-To: <76465.11467.qm@web94901.mail.in2.yahoo.com> References: <76465.11467.qm@web94901.mail.in2.yahoo.com> Message-ID: <4260F986-AD65-4C73-8249-5714D2CF44E0@fiee.net> Am 2011-02-16 um 14:19 schrieb Prashant Saxena: > After installing py2app using "python setup.py install", I created > an .app of > default wxpython's example name "supperdoodle". > The resulting superdoodle.app is around 48.5 MB. Am I missing > something in > setup.py or this is normal size for wxpython based applications? That's (unfortunately) completely normal. Greetlings from Lake Constance! Hraban --- http://www.fiee.net https://www.cacert.org (I'm an assurer) From aahz at pythoncraft.com Wed Feb 16 17:46:06 2011 From: aahz at pythoncraft.com (Aahz) Date: Wed, 16 Feb 2011 08:46:06 -0800 Subject: [Pythonmac-SIG] py2app -> .app size is too big In-Reply-To: <76465.11467.qm@web94901.mail.in2.yahoo.com> References: <76465.11467.qm@web94901.mail.in2.yahoo.com> Message-ID: <20110216164605.GB4945@panix.com> On Wed, Feb 16, 2011, Prashant Saxena wrote: > > Leopard 10.5.5 Intel > XCode 3.1.4 > Python 2.6.6 universal > wxpython 2.8.11.0 universal > > After installing py2app using "python setup.py install", I created an .app of > default wxpython's example name "supperdoodle". > The resulting superdoodle.app is around 48.5 MB. Am I missing something in > setup.py or this is normal size for wxpython based applications? wxpython by itself probably accounts for about 10MB. You should be able to compress that down to around 15MB if you're distributing an installer package. -- Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/ "Programming language design is not a rational science. Most reasoning about it is at best rationalization of gut feelings, and at worst plain wrong." --GvR, python-ideas, 2009-03-01 From Chris.Barker at noaa.gov Wed Feb 16 18:21:03 2011 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Wed, 16 Feb 2011 09:21:03 -0800 Subject: [Pythonmac-SIG] py2app -> .app size is too big In-Reply-To: <20110216164605.GB4945@panix.com> References: <76465.11467.qm@web94901.mail.in2.yahoo.com> <20110216164605.GB4945@panix.com> Message-ID: <4D5C077F.3020101@noaa.gov> On 2/16/11 8:46 AM, Aahz wrote: > On Wed, Feb 16, 2011, Prashant Saxena wrote: >> After installing py2app using "python setup.py install", I created an .app of >> default wxpython's example name "superdoodle". >> The resulting superdoodle.app is around 48.5 MB. > wxpython by itself probably accounts for about 10MB. You should be able > to compress that down to around 15MB if you're distributing an installer > package. Actually, wxPython is really big, and with the universal build, it's twice as big. On my system (Python 2.6 Universal): minimal python app : 9.1MB minimal wxPython app: 43MB But the wxPython one does compress down to 17MB wxPython is so big because it has all of the wx C++ libs, plus all the wrapper code to access it. It is unfortunately pretty monolithic, so it's very hard to bring in just what you need. But disk space is cheap these days. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov From estartu at augusta.de Thu Feb 17 11:05:09 2011 From: estartu at augusta.de (Gerhard Schmidt) Date: Thu, 17 Feb 2011 11:05:09 +0100 Subject: [Pythonmac-SIG] py2app with wxpython Message-ID: <4D5CF2D5.8040107@augusta.de> Hi, i try to genrate an app from a wxPython project. Generation the App runs without an error. But when i try to start the App it terminates. The logs show that import wx doesn't work. What am i missing. Regards Gerhard -------------- next part -------------- A non-text attachment was scrubbed... Name: setup_mac.py Type: text/x-python-script Size: 1014 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 368 bytes Desc: OpenPGP digital signature URL: From christian at prinoth.name Thu Feb 17 11:41:31 2011 From: christian at prinoth.name (Christian Prinoth) Date: Thu, 17 Feb 2011 11:41:31 +0100 Subject: [Pythonmac-SIG] appscript and Office 2011, not working? Message-ID: Has, thanks for your reply. I have tried doing what you suggest. the four char code for the range object is X117, so I did the following: app('Microsoft Excel').AS_newreference(aem.app.elements('X117'))['A1'].value() and this works fine in both Excel 2008 and Excel 2011. My problem is that this way I can only reference a range in the currently active worksheet. Using standard appscript syntax I would do the following: app('Microsoft Excel').worksheets['Sheet1'].ranges['A1'].value() to access data on a specific cell on a specific worksheet. How do I do that with the AEM syntax you suggested? I tried something along the lines of: ws.AS_newreference(aem.app.elements('X117'))[address] which won't work since a reference to a worksheet object does not have the AS_newreference method. Tried playing a bit with AS_aemreference but I am not getting how this is supposed to work. Thanks Christian > Wild guess: Excel's dictionary defines both a 'ranges' property and a > 'range' class (plural 'ranges'). AppleScript can just about deal with > that sort of ambiguity as the compiler can determine from context if a > 'ranges' keyword is being used as a property name or element name. > Appscript doesn't have that luxury, so has to favour one > interpretation or the other; in this case, the former. If you need it > to go the other way, you'll need to drop down to the aem API > (equivalent to using chevron syntax in AS); something like: > > app('Microsoft > Excel').AS_newreference(aem.app.elements('xxxx'))['B2'].value() > > You'll need to use ASDictionary to export the Excel dictionary as > plain text in order to look up the correct four-char code to use in > the aem reference. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hengist.podd at virgin.net Thu Feb 17 13:34:02 2011 From: hengist.podd at virgin.net (has) Date: Thu, 17 Feb 2011 12:34:02 +0000 Subject: [Pythonmac-SIG] appscript and Office 2011, not working? Message-ID: Christian Prinoth wrote: > My problem is that this way I can only reference a range in the currently active worksheet. > Using standard appscript syntax I would do the following: > > app('Microsoft Excel').worksheets['Sheet1'].ranges['A1'].value() > > to access data on a specific cell on a specific worksheet. How do I do that > with the AEM syntax you suggested? excel = app('Microsoft Excel') ws = excel.worksheets['Sheet1'] excel.AS_newreference(ws.AS_aemreference.elements('X117'))[address] HTH has From Chris.Barker at noaa.gov Thu Feb 17 18:12:36 2011 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Thu, 17 Feb 2011 09:12:36 -0800 Subject: [Pythonmac-SIG] py2app with wxpython In-Reply-To: <4D5CF2D5.8040107@augusta.de> References: <4D5CF2D5.8040107@augusta.de> Message-ID: <4D5D5704.8070803@noaa.gov> On 2/17/11 2:05 AM, Gerhard Schmidt wrote: > Hi, > > i try to generate an app from a wxPython project. > > Generation the App runs without an error. But when i try to start the > App it terminates. versions of python (and which binary install), py2app, wxPython, OS-X ? > The logs show that import wx doesn't work. can you build a really, really simple wx app? (see enclosed) > What am i missing. I'm not sure, but you do have something extra: CFBundleIdentifier = "com.acf.vereinsverwaltung", ) ,'packages': 'wx' you don't need to specify the wx package -- if there is an "import wx" in your code, py2app will find it. ,'site_packages': True And I don't remember what this does -- try taking it out and see what you get. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov -------------- next part -------------- A non-text attachment was scrubbed... Name: basicwx.py Type: application/x-python Size: 185 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: setup.py Type: application/x-python Size: 309 bytes Desc: not available URL: From christian at prinoth.name Fri Feb 18 16:34:11 2011 From: christian at prinoth.name (Christian Prinoth) Date: Fri, 18 Feb 2011 16:34:11 +0100 Subject: [Pythonmac-SIG] appscript and Office 2011, not working? (has) Message-ID: Thanks, works great now! > excel = app('Microsoft Excel') > ws = excel.worksheets['Sheet1'] > excel.AS_newreference(ws.AS_aemreference.elements('X117'))[address] > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From animator333 at yahoo.com Sat Feb 19 12:22:22 2011 From: animator333 at yahoo.com (Prashant Saxena) Date: Sat, 19 Feb 2011 16:52:22 +0530 (IST) Subject: [Pythonmac-SIG] py2app and module finding Message-ID: <213358.18737.qm@web94916.mail.in2.yahoo.com> Hi, It's related to my previous post regarding .app bundle size produce by py2app. When I looked inside the .app bundle, It gives me some confusion: 1. I have a custom package name "core". There is directory structure inside filled with scripts. Some of the scripts are compiled using cython. This give you three version of single script (.py, .pyc and .so). py2app is copying .so to .lib folder inside bundle as well as it's also copying .py and .pyc inside "site-package/core". Why it's like that? 2. Not only python scripts but every thing under the folder is going inside the .app. It seems py2app is globing all the files instead of required modules/scripts. I am using a very simple setup.py. It's almost the same as examples/wxpython/2.5/superdoodle Prashant From brendan.simon at etrix.com.au Sun Feb 20 23:11:26 2011 From: brendan.simon at etrix.com.au (Brendan Simon (eTRIX)) Date: Mon, 21 Feb 2011 09:11:26 +1100 Subject: [Pythonmac-SIG] py2app with wxpython In-Reply-To: References: Message-ID: <4D61918E.1010308@etrix.com.au> On 18/02/2011 10:00 PM, pythonmac-sig-request at python.org wrote: > Subject: > Re: [Pythonmac-SIG] py2app with wxpython > From: > Christopher Barker > Date: > Thu, 17 Feb 2011 09:12:36 -0800 > > To: > pythonmac-sig at python.org > > > On 2/17/11 2:05 AM, Gerhard Schmidt wrote: >> Hi, >> >> i try to generate an app from a wxPython project. >> >> Generation the App runs without an error. But when i try to start the >> App it terminates. > > versions of python (and which binary install), py2app, wxPython, OS-X ? > >> The logs show that import wx doesn't work. > > can you build a really, really simple wx app? (see enclosed) > >> What am i missing. > > I'm not sure, but you do have something extra: > > CFBundleIdentifier = > "com.acf.vereinsverwaltung", > ) > ,'packages': 'wx' > > you don't need to specify the wx package -- if there is an "import wx" > in your code, py2app will find it. > > > ,'site_packages': True > > And I don't remember what this does -- try taking it out and see what > you get. > > -Chris Do you need to specify 'pythonw' as the interpreter ?? It may depend on python version. I found (on OS X) that Python 2.7 requires pythonw rather than python to run my wxPython apps. Cheers, Brendan. -- Brendan Simon www.etrix.com.au -------------- next part -------------- An HTML attachment was scrubbed... URL: From nad at acm.org Mon Feb 21 00:46:05 2011 From: nad at acm.org (Ned Deily) Date: Sun, 20 Feb 2011 15:46:05 -0800 Subject: [Pythonmac-SIG] py2app with wxpython References: <4D61918E.1010308@etrix.com.au> Message-ID: In article <4D61918E.1010308 at etrix.com.au>, "Brendan Simon (eTRIX)" wrote: > Do you need to specify 'pythonw' as the interpreter ?? > It may depend on python version. I found (on OS X) that Python 2.7 > requires pythonw rather than python to run my wxPython apps. That sounds very suspicious. On OS X installs, bin/python and bin/pythonw are supposed to be identical. -- Ned Deily, nad at acm.org From dave at bcs.co.nz Mon Feb 21 00:56:23 2011 From: dave at bcs.co.nz (David Brooks) Date: Mon, 21 Feb 2011 12:56:23 +1300 Subject: [Pythonmac-SIG] Allow multiple executables in a single py2app bundle Message-ID: <4D61AA27.10107@bcs.co.nz> Resending, as didn't make it to the list when sent on 18 February... Hi, The following patch enables the name of the stub executable to determine the Python script to run. This allows multiple scripts to use a common runtime. Required manual steps are to make copies of the stub in ./MacOS and to copy the actual Python scripts into ./Resources. N.B. The py2app/apptemplate/prebuilt contents need to be recreated by running 'python setup.py build' in py2app/apptemplate, before running the main 'setup.py install'. Enjoy! Dave ================================================= diff --git a/py2app/apptemplate/src/main.c b/py2app/apptemplate/src/main.c --- a/py2app/apptemplate/src/main.c +++ b/py2app/apptemplate/src/main.c @@ -1017,8 +1017,9 @@ argv_new = alloca((argc + 1) * sizeof(char *)); argv_new[argc] = NULL; - argv_new[0] = c_mainScript; - memcpy(&argv_new[1],&argv[1], (argc - 1) * sizeof(char *)); + //argv_new[0] = c_mainScript; + //memcpy(&argv_new[1],&argv[1], (argc - 1) * sizeof(char *)); + memcpy(argv_new, argv, argc * sizeof(char *)); py2app_PySys_SetArgv(argc, argv_new); diff --git a/py2app/bootstrap/boot_app.py b/py2app/bootstrap/boot_app.py --- a/py2app/bootstrap/boot_app.py +++ b/py2app/bootstrap/boot_app.py @@ -7,7 +7,7 @@ site.addsitedir(os.path.join(base, 'Python', 'site-packages')) if not scripts: import __main__ - for script in scripts: - path = os.path.join(base, script) - sys.argv[0] = __file__ = path - execfile(path, globals(), globals()) + script = sys.argv[0].split('/')[-1] + '.py' + path = os.path.join(base, script) + sys.argv[0] = __file__ = path + execfile(path, globals(), globals()) ================================================= From brendan.simon at etrix.com.au Mon Feb 21 12:33:38 2011 From: brendan.simon at etrix.com.au (Brendan Simon (eTRIX)) Date: Mon, 21 Feb 2011 22:33:38 +1100 Subject: [Pythonmac-SIG] py2app with wxpython In-Reply-To: References: Message-ID: <4D624D92.5070608@etrix.com.au> On 21/02/11 10:00 PM, pythonmac-sig-request at python.org wrote: > Subject: > Re: [Pythonmac-SIG] py2app with wxpython > From: > Ned Deily > Date: > Sun, 20 Feb 2011 15:46:05 -0800 > > To: > pythonmac-sig at python.org > > > In article <4D61918E.1010308 at etrix.com.au>, > "Brendan Simon (eTRIX)" wrote: >> > Do you need to specify 'pythonw' as the interpreter ?? >> > It may depend on python version. I found (on OS X) that Python 2.7 >> > requires pythonw rather than python to run my wxPython apps. > That sounds very suspicious. On OS X installs, bin/python and > bin/pythonw are supposed to be identical. Indeed you are right. The python and pythonw varieties are identical for Python 2.7 and my wxPython application works fine with either. I tried again with my Python 2.5.4 install and that does have the problem. "pythonw myapp.py" works fine. "python myapp.py" fails with the following error. Traceback (most recent call last): File "myapp.py", line 18, in import main as myMain File "/Users/brendan/src/main.py", line 19, in from theapp import MyApp File "/Users/brendan/src/theapp.py", line 20, in import wxAnyThread ImportError: No module named wxAnyThread It looks like it is just a path issue. So it should be easy to solve, but there is a difference in behaviour between python and pythonw with Python 2.5.4, even though the binaries are identical. I presume that the the interpreter looks at the command that it is invoked with and does something different with sys.path ?? Cheers, Brendan. -------------- next part -------------- An HTML attachment was scrubbed... URL: From nad at acm.org Mon Feb 21 13:00:31 2011 From: nad at acm.org (Ned Deily) Date: Mon, 21 Feb 2011 04:00:31 -0800 Subject: [Pythonmac-SIG] py2app with wxpython References: <4D624D92.5070608@etrix.com.au> Message-ID: In article <4D624D92.5070608 at etrix.com.au>, "Brendan Simon (eTRIX)" wrote: > I tried again with my Python 2.5.4 install and that does have the problem. > > "pythonw myapp.py" works fine. > > "python myapp.py" fails with the following error. > > Traceback (most recent call last): > File "myapp.py", line 18, in > import main as myMain > File "/Users/brendan/src/main.py", line 19, in > from theapp import MyApp > File "/Users/brendan/src/theapp.py", line 20, in > import wxAnyThread > ImportError: No module named wxAnyThread > > It looks like it is just a path issue. So it should be easy to solve, > but there is a difference in behaviour between python and pythonw with > Python 2.5.4, even though the binaries are identical. I presume that > the the interpreter looks at the command that it is invoked with and > does something different with sys.path ?? That still seems suspicious. If you are using Python 2.5.4 from the python.org installer, it also installs identical bin/python2.5 and bin/pythonw2.5 binaries, with bin/python and bin/pythonw as symlinks to the versioned names. So all four names *should* behave identically, assuming all the names are being picked up from the framework bin directory, /Library/Frameworks/Python.frameworks/Versions/2.5/bin. Make sure you are really using them: which pythonw which python If necessary, you may need to specify absolute paths to the bin directory or temporarily change your shell PATH to ensure the 2.5 bin directory comes first (note, that Apple ships its own version of Python 2.5, linked in /usr/bin, in both OS X 10.5 and 10.6). -- Ned Deily, nad at acm.org From bejarar at gmail.com Mon Feb 21 20:38:01 2011 From: bejarar at gmail.com (Rafael Bejarano) Date: Mon, 21 Feb 2011 13:38:01 -0600 Subject: [Pythonmac-SIG] The time module Message-ID: Hello, I can't get the clock() function in the time module to work. I would appreciate any helpful suggestions. Below is a copy of the Terminal session, for your perusal. Thanks. Rafael Bejarano Last login: Mon Feb 21 13:02:48 on ttyp1 Welcome to Darwin! 173-216-77-254-arka:~ Rafael$ python Python 3.0.1 (r301:69597, Feb 14 2009, 19:03:52) [GCC 4.0.1 (Apple Inc. build 5490)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import time >>> clock() Traceback (most recent call last): File "", line 1, in NameError: name 'clock' is not defined >>> From listmail at gearyweb.com Mon Feb 21 20:43:34 2011 From: listmail at gearyweb.com (Michael Geary) Date: Mon, 21 Feb 2011 12:43:34 -0700 Subject: [Pythonmac-SIG] The time module In-Reply-To: References: Message-ID: >>> import time >>> time.clock() 0.059185000000000001 or: >>> from time import clock >>> clock() best, mg On Feb 21, 2011, at 12:38 PM, Rafael Bejarano wrote: > Hello, > > I can't get the clock() function in the time module to work. I would appreciate any helpful suggestions. > > Below is a copy of the Terminal session, for your perusal. > > Thanks. > Rafael Bejarano > > Last login: Mon Feb 21 13:02:48 on ttyp1 > Welcome to Darwin! > 173-216-77-254-arka:~ Rafael$ python > Python 3.0.1 (r301:69597, Feb 14 2009, 19:03:52) > [GCC 4.0.1 (Apple Inc. build 5490)] on darwin > Type "help", "copyright", "credits" or "license" for more information. > >>> import time > >>> clock() > Traceback (most recent call last): > File "", line 1, in > NameError: name 'clock' is not defined > >>> > > > > > > > > > > > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG From nad at acm.org Mon Feb 21 21:08:25 2011 From: nad at acm.org (Ned Deily) Date: Mon, 21 Feb 2011 12:08:25 -0800 Subject: [Pythonmac-SIG] The time module References: Message-ID: In article , Rafael Bejarano wrote: > I can't get the clock() function in the time module to work. I would > appreciate any helpful suggestions. > > Below is a copy of the Terminal session, for your perusal. > > Thanks. > Rafael Bejarano > > Last login: Mon Feb 21 13:02:48 on ttyp1 > Welcome to Darwin! > 173-216-77-254-arka:~ Rafael$ python > Python 3.0.1 (r301:69597, Feb 14 2009, 19:03:52) > [GCC 4.0.1 (Apple Inc. build 5490)] on darwin > Type "help", "copyright", "credits" or "license" for more information. > >>> import time > >>> clock() > Traceback (most recent call last): > File "", line 1, in > NameError: name 'clock' is not defined > >>> Importing a module creates a new namespace for the names in that module.: $ python3.2 Python 3.2 (r32:88452, Feb 20 2011, 11:12:31) [GCC 4.2.1 (Apple Inc. build 5664)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import time >>> time.clock() 0.091744 You might want to review the Python tutorial here: http://docs.python.org/py3k/tutorial/index.html And, by the way, you should upgrade to Python 3.2 as soon as possible. Python 3.0.1 was a very early release of Python 3. It is known to be buggy and is no longer supported. -- Ned Deily, nad at acm.org From ronaldoussoren at mac.com Tue Feb 22 10:54:47 2011 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Tue, 22 Feb 2011 10:54:47 +0100 Subject: [Pythonmac-SIG] py2app and module finding In-Reply-To: <213358.18737.qm@web94916.mail.in2.yahoo.com> References: <213358.18737.qm@web94916.mail.in2.yahoo.com> Message-ID: <0EDAD305-5A69-4328-A543-277BFF872478@mac.com> On 19 Feb, 2011, at 12:22, Prashant Saxena wrote: > Hi, > > It's related to my previous post regarding .app bundle size produce by py2app. > When I looked inside the .app bundle, > It gives me some confusion: > > 1. I have a custom package name "core". There is directory structure inside > filled with scripts. Some of the scripts are compiled > using cython. This give you three version of single script (.py, .pyc and .so). > py2app is copying .so to .lib folder inside bundle as > well as it's also copying .py and .pyc inside "site-package/core". Why it's like > that? The .so is copied into lib-dynload, the .py/.pyc inside the zipfile are special loader scripts that will load the extension from lib-dynload. This is needed because extensions cannot be in the zipfile. > > 2. Not only python scripts but every thing under the folder is going inside the > .app. It seems py2app is globing all the files instead of required > modules/scripts. py2app currently copies all data files in a python package directory. This is done because setuptools allows you to have such data, and without copying data files some python software don't work. Why do you have files in your python package directory that aren't needed to run the software? Ronald From ronaldoussoren at mac.com Tue Feb 22 10:57:51 2011 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Tue, 22 Feb 2011 10:57:51 +0100 Subject: [Pythonmac-SIG] py2app with wxpython In-Reply-To: <4D624D92.5070608@etrix.com.au> References: <4D624D92.5070608@etrix.com.au> Message-ID: <714A4776-E0B0-458E-A519-F4A1E96766B5@mac.com> On 21 Feb, 2011, at 12:33, Brendan Simon (eTRIX) wrote: > On 21/02/11 10:00 PM, pythonmac-sig-request at python.org wrote: >> >> Subject: Re: [Pythonmac-SIG] py2app with wxpython >> From: Ned Deily >> Date: Sun, 20 Feb 2011 15:46:05 -0800 >> To: pythonmac-sig at python.org >> In article <4D61918E.1010308 at etrix.com.au>, >> "Brendan Simon (eTRIX)" wrote: >>> > Do you need to specify 'pythonw' as the interpreter ?? >>> > It may depend on python version. I found (on OS X) that Python 2.7 >>> > requires pythonw rather than python to run my wxPython apps. >> That sounds very suspicious. On OS X installs, bin/python and >> bin/pythonw are supposed to be identical. > Indeed you are right. The python and pythonw varieties are identical for Python 2.7 and my wxPython application works fine with either. > > I tried again with my Python 2.5.4 install and that does have the problem. Which python 2.5.4 is that (that is, how did you install it)? Are you sure that 'python' and 'pythonw' refer to the same python installation (what is sys.prefix for these two commands)? Ronald > > "pythonw myapp.py" works fine. > > "python myapp.py" fails with the following error. > > Traceback (most recent call last): > File "myapp.py", line 18, in > import main as myMain > File "/Users/brendan/src/main.py", line 19, in > from theapp import MyApp > File "/Users/brendan/src/theapp.py", line 20, in > import wxAnyThread > ImportError: No module named wxAnyThread > > It looks like it is just a path issue. So it should be easy to solve, but there is a difference in behaviour between python and pythonw with Python 2.5.4, even though the binaries are identical. I presume that the the interpreter looks at the command that it is invoked with and does something different with sys.path ?? > > Cheers, Brendan. > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG -------------- next part -------------- An HTML attachment was scrubbed... URL: From brendan.simon at etrix.com.au Tue Feb 22 12:03:21 2011 From: brendan.simon at etrix.com.au (Brendan Simon (eTRIX)) Date: Tue, 22 Feb 2011 22:03:21 +1100 Subject: [Pythonmac-SIG] py2app with wxpython In-Reply-To: <714A4776-E0B0-458E-A519-F4A1E96766B5@mac.com> References: <4D624D92.5070608@etrix.com.au> <714A4776-E0B0-458E-A519-F4A1E96766B5@mac.com> Message-ID: <4D6397F9.1030806@etrix.com.au> On 22/02/11 8:57 PM, Ronald Oussoren wrote: > On 21 Feb, 2011, at 12:33, Brendan Simon (eTRIX) wrote: > >> On 21/02/11 10:00 PM, pythonmac-sig-request at python.org wrote: >>> Subject: >>> Re: [Pythonmac-SIG] py2app with wxpython >>> From: >>> Ned Deily >>> Date: >>> Sun, 20 Feb 2011 15:46:05 -0800 >>> >>> To: >>> pythonmac-sig at python.org >>> >>> >>> In article <4D61918E.1010308 at etrix.com.au>, >>> "Brendan Simon (eTRIX)" wrote: >>>> > Do you need to specify 'pythonw' as the interpreter ?? >>>> > It may depend on python version. I found (on OS X) that Python 2.7 >>>> > requires pythonw rather than python to run my wxPython apps. >>> That sounds very suspicious. On OS X installs, bin/python and >>> bin/pythonw are supposed to be identical. >> Indeed you are right. The python and pythonw varieties are identical >> for Python 2.7 and my wxPython application works fine with either. >> >> I tried again with my Python 2.5.4 install and that does have the >> problem. > > Which python 2.5.4 is that (that is, how did you install it)? Are you > sure that 'python' and 'pythonw' refer to the same python installation > (what is sys.prefix for these two commands)? I'm using standard python.org builds. brendan$ python Python 2.5.4 (r254:67917, Dec 23 2008, 14:57:27) [GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> print sys.prefix /Users/brendan/virtualenv/xxx-py25/bin/.. brendan$ pythonw Python 2.5.4 (r254:67917, Dec 23 2008, 14:57:27) [GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> print sys.prefix /Library/Frameworks/Python.framework/Versions/2.5 Hmmm, it might be something to do with my virtualenv setup (I've only just started using virtualenv). brendan$ ls -l ~/virtualenv/xxx-py25/bin/python* -rwxrwxr-x 1 brendan staff 30028 27 Jan 22:11 /Users/brendan/virtualenv/xxx-py25/bin/python lrwxr-xr-x 1 brendan staff 6 27 Jan 22:11 /Users/brendan/virtualenv/xxx-py25/bin/python2.5 -> python lrwxr-xr-x 1 brendan staff 61 27 Jan 22:20 /Users/brendan/virtualenv/xxx-py25/bin/pythonw -> /Library/Frameworks/Python.framework/Versions/2.5/bin/pythonw -------------- next part -------------- An HTML attachment was scrubbed... URL: From ronaldoussoren at mac.com Tue Feb 22 14:27:28 2011 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Tue, 22 Feb 2011 14:27:28 +0100 Subject: [Pythonmac-SIG] a word of warning for pyobjc users Message-ID: 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. Ronald From ronaldoussoren at mac.com Tue Feb 22 15:18:04 2011 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Tue, 22 Feb 2011 15:18:04 +0100 Subject: [Pythonmac-SIG] py2app with wxpython In-Reply-To: <4D6397F9.1030806@etrix.com.au> References: <4D624D92.5070608@etrix.com.au> <714A4776-E0B0-458E-A519-F4A1E96766B5@mac.com> <4D6397F9.1030806@etrix.com.au> Message-ID: On 22 Feb, 2011, at 12:03, Brendan Simon (eTRIX) wrote: > On 22/02/11 8:57 PM, Ronald Oussoren wrote: >> >> On 21 Feb, 2011, at 12:33, Brendan Simon (eTRIX) wrote: >> >>> On 21/02/11 10:00 PM, pythonmac-sig-request at python.org wrote: >>>> >>>> Subject: Re: [Pythonmac-SIG] py2app with wxpython >>>> From: Ned Deily >>>> Date: Sun, 20 Feb 2011 15:46:05 -0800 >>>> To: pythonmac-sig at python.org >>>> In article <4D61918E.1010308 at etrix.com.au>, >>>> "Brendan Simon (eTRIX)" wrote: >>>>> > Do you need to specify 'pythonw' as the interpreter ?? >>>>> > It may depend on python version. I found (on OS X) that Python 2.7 >>>>> > requires pythonw rather than python to run my wxPython apps. >>>> That sounds very suspicious. On OS X installs, bin/python and >>>> bin/pythonw are supposed to be identical. >>> Indeed you are right. The python and pythonw varieties are identical for Python 2.7 and my wxPython application works fine with either. >>> >>> I tried again with my Python 2.5.4 install and that does have the problem. >> >> Which python 2.5.4 is that (that is, how did you install it)? Are you sure that 'python' and 'pythonw' refer to the same python installation (what is sys.prefix for these two commands)? > I'm using standard python.org builds. > > > brendan$ python > Python 2.5.4 (r254:67917, Dec 23 2008, 14:57:27) > [GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin > Type "help", "copyright", "credits" or "license" for more information. > >>> import sys > >>> print sys.prefix > /Users/brendan/virtualenv/xxx-py25/bin/.. > > > brendan$ pythonw > Python 2.5.4 (r254:67917, Dec 23 2008, 14:57:27) > [GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin > Type "help", "copyright", "credits" or "license" for more information. > >>> import sys > >>> print sys.prefix > /Library/Frameworks/Python.framework/Versions/2.5 > > > Hmmm, it might be something to do with my virtualenv setup (I've only just started using virtualenv). > > brendan$ ls -l ~/virtualenv/xxx-py25/bin/python* > -rwxrwxr-x 1 brendan staff 30028 27 Jan 22:11 /Users/brendan/virtualenv/xxx-py25/bin/python > lrwxr-xr-x 1 brendan staff 6 27 Jan 22:11 /Users/brendan/virtualenv/xxx-py25/bin/python2.5 -> python > lrwxr-xr-x 1 brendan staff 61 27 Jan 22:20 /Users/brendan/virtualenv/xxx-py25/bin/pythonw -> /Library/Frameworks/Python.framework/Versions/2.5/bin/pythonw AFAIK pythonw doesn't work in virtualenvs and within a virtualenv the python command is the real embedded interpreter, not the pythonw wrapper you get otherwise. This is something that needs to be fixed by someone. I'm more likely to work on a simular tool that supports both 2.x and 3.x and doesn't install crap I didn't ask for and isn't mentioned in the documentation. Ronald > > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG -------------- next part -------------- An HTML attachment was scrubbed... URL: From kw at codebykevin.com Tue Feb 22 17:04:37 2011 From: kw at codebykevin.com (Kevin Walzer) Date: Tue, 22 Feb 2011 11:04:37 -0500 Subject: [Pythonmac-SIG] a word of warning for pyobjc users In-Reply-To: References: Message-ID: <4D63DE95.4020609@codebykevin.com> 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 From brendan.simon at etrix.com.au Tue Feb 22 23:24:42 2011 From: brendan.simon at etrix.com.au (Brendan Simon (eTRIX)) Date: Wed, 23 Feb 2011 09:24:42 +1100 Subject: [Pythonmac-SIG] py2app with wxpython In-Reply-To: References: <4D624D92.5070608@etrix.com.au> <714A4776-E0B0-458E-A519-F4A1E96766B5@mac.com> <4D6397F9.1030806@etrix.com.au> Message-ID: <4D6437AA.70105@etrix.com.au> On 23/02/2011 1:18 AM, Ronald Oussoren wrote: > > On 22 Feb, 2011, at 12:03, Brendan Simon (eTRIX) wrote: > >> On 22/02/11 8:57 PM, Ronald Oussoren wrote: >>> On 21 Feb, 2011, at 12:33, Brendan Simon (eTRIX) wrote: >>> >>>> On 21/02/11 10:00 PM, pythonmac-sig-request at python.org wrote: >>>>> Subject: >>>>> Re: [Pythonmac-SIG] py2app with wxpython >>>>> From: >>>>> Ned Deily >>>>> Date: >>>>> Sun, 20 Feb 2011 15:46:05 -0800 >>>>> >>>>> To: >>>>> pythonmac-sig at python.org >>>>> >>>>> >>>>> In article<4D61918E.1010308 at etrix.com.au>, >>>>> "Brendan Simon (eTRIX)" wrote: >>>>>> > Do you need to specify 'pythonw' as the interpreter ?? >>>>>> > It may depend on python version. I found (on OS X) that Python 2.7 >>>>>> > requires pythonw rather than python to run my wxPython apps. >>>>> That sounds very suspicious. On OS X installs, bin/python and >>>>> bin/pythonw are supposed to be identical. >>>> Indeed you are right. The python and pythonw varieties are >>>> identical for Python 2.7 and my wxPython application works fine >>>> with either. >>>> >>>> I tried again with my Python 2.5.4 install and that does have the >>>> problem. >>> >>> Which python 2.5.4 is that (that is, how did you install it)? Are >>> you sure that 'python' and 'pythonw' refer to the same python >>> installation (what is sys.prefix for these two commands)? >> I'm using standard python.org builds. >> >> >> brendan$ python >> Python 2.5.4 (r254:67917, Dec 23 2008, 14:57:27) >> [GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin >> Type "help", "copyright", "credits" or "license" for more information. >> >>> import sys >> >>> print sys.prefix >> /Users/brendan/virtualenv/xxx-py25/bin/.. >> >> >> brendan$ pythonw >> Python 2.5.4 (r254:67917, Dec 23 2008, 14:57:27) >> [GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin >> Type "help", "copyright", "credits" or "license" for more information. >> >>> import sys >> >>> print sys.prefix >> /Library/Frameworks/Python.framework/Versions/2.5 >> >> >> Hmmm, it might be something to do with my virtualenv setup (I've only >> just started using virtualenv). >> >> brendan$ ls -l ~/virtualenv/xxx-py25/bin/python* >> -rwxrwxr-x 1 brendan staff 30028 27 Jan 22:11 >> /Users/brendan/virtualenv/xxx-py25/bin/python >> lrwxr-xr-x 1 brendan staff 6 27 Jan 22:11 >> /Users/brendan/virtualenv/xxx-py25/bin/python2.5 -> python >> lrwxr-xr-x 1 brendan staff 61 27 Jan 22:20 >> /Users/brendan/virtualenv/xxx-py25/bin/pythonw -> >> /Library/Frameworks/Python.framework/Versions/2.5/bin/pythonw > > > AFAIK pythonw doesn't work in virtualenvs and within a virtualenv the > python command is the real embedded interpreter, not the pythonw > wrapper you get otherwise. > > This is something that needs to be fixed by someone. I'm more likely > to work on a simular tool that supports both 2.x and 3.x and doesn't > install crap I didn't ask for and isn't mentioned in the documentation. I'm not clear which tool you are referring too. I'm presuming virtualenv, right ?? or are you referring to the pythonw wrapper ?? Does virtualenv have some downsides that I'm not aware of ?? It seems like a great idea to be able to install separate modules into separate virtual environments so that each project can use different modules, or different versions of the same module, etc. Cheers, Brendan. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ronaldoussoren at mac.com Wed Feb 23 07:52:51 2011 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Wed, 23 Feb 2011 07:52:51 +0100 Subject: [Pythonmac-SIG] a word of warning for pyobjc users In-Reply-To: <4D63DE95.4020609@codebykevin.com> References: <4D63DE95.4020609@codebykevin.com> Message-ID: On 22 Feb, 2011, at 17:04, Kevin Walzer wrote: > 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)? The easiest option for now is to continue using Xcode 3, and file a bug at http://bugreporter.apple.com/ to complain about this regression (I've already filed one, the more people file a similar issue the more likely it is that the issue gets attention). I'm currently thinking about what to do in the longer run, specifying the GUI by hand is definitely an option although I'd prefer to use a GUI design tool. Renaissance would be an option for that. Ronald > > --Kevin > > -- > Kevin Walzer > Code by Kevin > http://www.codebykevin.com > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG From hengist.podd at virgin.net Wed Feb 23 17:48:33 2011 From: hengist.podd at virgin.net (has) Date: Wed, 23 Feb 2011 16:48:33 +0000 Subject: [Pythonmac-SIG] a word of warning for pyobjc users Message-ID: Kevin Walzer wrote: 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, You mean BridgeSupport (http://bridgesupport.macosforge.org/), which provides XML descriptions of the non-introspectable bits of Cocoa APIs for easy consumption by PyObjC, MacRuby, etc. > its claim of full Cocoa support for Python, Ruby, etc. seems hard to believe now. I would suggest dropping a note to Laurent Sansonetti (BridgeSupport + MacRuby lead) and other bridge & runtime devs (http://www.cocoadev.com/index.pl?CocoaBridges) (http://www.cocoadev.com/index.pl?CocoaLanguages) to find out if they're also affected. Laurent may also be in a marginally better position to agitate, seeing as he's an Apple employee. (http://www.macruby.org/) > What other options are there? Specify your GUI by hand? Is it just the Read/Write Class Files functionality that's affected, or has Xcode 4 also lost the ability to specify IB classes manually? (IB 2 was good at this; IB 3 not so good but I think it was still possible.) HTH has From ronaldoussoren at mac.com Wed Feb 23 22:42:10 2011 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Wed, 23 Feb 2011 22:42:10 +0100 Subject: [Pythonmac-SIG] a word of warning for pyobjc users In-Reply-To: References: Message-ID: <17EE67A4-21E1-41C1-B885-B2AAC26C7AC7@mac.com> On 23 Feb, 2011, at 17:48, has wrote: > Kevin Walzer wrote: > > 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, > > You mean BridgeSupport (http://bridgesupport.macosforge.org/), which > provides XML descriptions of the non-introspectable bits of Cocoa APIs > for easy consumption by PyObjC, MacRuby, etc. There's also the Cocoa Scripting Bridge , which is simular to objc-appscript in scope. The BridgeSupport project is a mess, the specification is too lax to be useful. PyObjC uses its own variation of those files because there are slight diffferences in the semantics that RubyCocoa and PyObjC expect, even though I worked with Laurent on the initial version of these files. Current PyObjC versions diverge slightly further to be able to add more useful information to the bridgesupport files, and future versions might move to something else altogether. > > >> its claim of full Cocoa support for Python, Ruby, etc. seems hard to believe now. > > I would suggest dropping a note to Laurent Sansonetti (BridgeSupport + > MacRuby lead) and other bridge & runtime devs > (http://www.cocoadev.com/index.pl?CocoaBridges) > (http://www.cocoadev.com/index.pl?CocoaLanguages) to find out if > they're also affected. Laurent may also be in a marginally better > position to agitate, seeing as he's an Apple employee. > (http://www.macruby.org/) Ruby seems to be affected as well (although I'm not sure if I use the right syntax). > > >> What other options are there? Specify your GUI by hand? > > Is it just the Read/Write Class Files functionality that's affected, > or has Xcode 4 also lost the ability to specify IB classes manually? > (IB 2 was good at this; IB 3 not so good but I think it was still > possible.) I haven't found a way to do "Read Class Files", probably because IB is now part of the Xcode IDE and no longer a standalone program (which means IB immediately knows when files are added or updated). There are probably good technical reasons why it is no longer easy to support scripting languages in IB, but the new behavior sucks nonetheless. Ronald From hengist.podd at virgin.net Thu Feb 24 10:16:41 2011 From: hengist.podd at virgin.net (has) Date: Thu, 24 Feb 2011 09:16:41 +0000 Subject: [Pythonmac-SIG] a word of warning for pyobjc users In-Reply-To: <17EE67A4-21E1-41C1-B885-B2AAC26C7AC7@mac.com> References: <17EE67A4-21E1-41C1-B885-B2AAC26C7AC7@mac.com> Message-ID: Ronald Oussoren wrote: >>> Unbelievable. Apple's "scripting bridge" push, >> >> You mean BridgeSupport > > There's also the Cocoa Scripting Bridge Folks often use 'scripting bridge' to mean 'scripting language to ObjC bridge' (PyObjC, RubyCocoa, etc). The misleadingly named Scripting Bridge is Apple's attempt at ObjC to Apple event bindings, but isn't relevant here beyond being one of the many APIs that PyObjC & co. can talk to. > The BridgeSupport project is a mess, the specification is too lax to be useful. Not the first time I've heard this criticism, but there are enough bridge and runtime developers around these days that they ought to be able to pull together some improvements. I know with OSS it's common for everyone to do their own thing, but a coherent group effort might register better on Apple's radar when they're deciding what's worth their support. >> I would suggest dropping a note to Laurent Sansonetti (BridgeSupport + >> MacRuby lead) and other bridge & runtime devs > >Ruby seems to be affected as well (although I'm not sure if I use the right syntax). RubyCocoa and/or MacRuby? RubyCocoa uses the same method name swizzle as PyObjC, minus the trailing underscore, e.g. [obj foo: x bar: y] -> obj.foo_bar(x, y). MacRuby uses heavier syntactic sugar to make positional args look like keyword args, e.g. [obj foo: x bar: y] -> obj.foo(x, bar: y) >>> What other options are there? Specify your GUI by hand? >> >> Is it just the Read/Write Class Files functionality that's affected, >> or has Xcode 4 also lost the ability to specify IB classes manually? >> (IB 2 was good at this; IB 3 not so good but I think it was still >> possible.) > >I haven't found a way to do "Read Class Files", probably because IB is now part of the Xcode IDE and no longer a standalone program (which means IB immediately knows when files are added or updated). So can you still define class structures manually? Or is that gone too? >There are probably good technical reasons why it is no longer easy to support scripting languages in IB, but the new behavior sucks nonetheless. I doubt there's a good technical reason; my guess'd be that due to some combination ignorance, arrogance, insufficient time and/or managerial diktat [1] they've coupled it tightly to ObjC with little thought for creating a more flexible, reusable solution. Apple have always had a lukewarm attitude to any language not already called "Objective-C", treating even their own AppleScript language as the red-headed stepchild they'd club to death the moment everyone's backs are turned. Again, I'd recommend you have a pow-wow with all the other bridge and runtime developers, as you're the folks who are best able to describe the problem in both technical and practical terms and rally your user bases in concerted protest. Regards, has (trundling web- and Linux-ward for a reason) [1] This is what got appscript & co. rejected from 10.5 in favour of the crappy in-house solution. I always thought the ObjC bridges would be quite safe though, seeing as they hanged with the cool kids (ObjC & Cocoa) rather than the old-skool losers (AppleScript + Carbon), but sympathies if not. From ronaldoussoren at mac.com Thu Feb 24 10:31:53 2011 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Thu, 24 Feb 2011 10:31:53 +0100 Subject: [Pythonmac-SIG] a word of warning for pyobjc users In-Reply-To: References: <17EE67A4-21E1-41C1-B885-B2AAC26C7AC7@mac.com> Message-ID: <03FA5440-5F98-401E-8F94-FFED9F8C940A@mac.com> On 24 Feb, 2011, at 10:16, has wrote: > > >> The BridgeSupport project is a mess, the specification is too lax to be useful. > > Not the first time I've heard this criticism, but there are enough > bridge and runtime developers around these days that they ought to be > able to pull together some improvements. I know with OSS it's common > for everyone to do their own thing, but a coherent group effort might > register better on Apple's radar when they're deciding what's worth > their support. I've tried to work with Laurent to get something usefull going, but in the end this didn't work out. One example is the 'b' type string that is used for 'BOOL' in bridgesupport files: this got through several rounds of review without anyone noticing that "sizeof(bool) == sizeof(BOOL)" is not always true (IIRC sizeof(bool) is 4 on PPC32). > > >>> I would suggest dropping a note to Laurent Sansonetti (BridgeSupport + >>> MacRuby lead) and other bridge & runtime devs >> >> Ruby seems to be affected as well (although I'm not sure if I use the right syntax). > > RubyCocoa and/or MacRuby? RubyCocoa uses the same method name swizzle > as PyObjC, minus the trailing underscore, e.g. > > [obj foo: x bar: y] -> obj.foo_bar(x, y). > > MacRuby uses heavier syntactic sugar to make positional args look like > keyword args, e.g. > > [obj foo: x bar: y] -> obj.foo(x, bar: y) Method definitions aren't even relevant yet in my experiments, I've defined a subclass of NSObject and that wasn't seen by the IB component in Xcode. class MyController < OSX:NSObject attr_writer :button def clicked(sender) puts "Button clicked!" end end > > >>>> What other options are there? Specify your GUI by hand? >>> >>> Is it just the Read/Write Class Files functionality that's affected, >>> or has Xcode 4 also lost the ability to specify IB classes manually? >>> (IB 2 was good at this; IB 3 not so good but I think it was still >>> possible.) >> >> I haven't found a way to do "Read Class Files", probably because IB is now part of the Xcode IDE and no longer a standalone program (which means IB immediately knows when files are added or updated). > > So can you still define class structures manually? Or is that gone too? This seems to be gone too. That's not unsuprising because the IB component hooks directly into the editor which in turn uses clang to have an up-to-date semantic model of the code you type (as long as it's (Objective-)C related. > > >> There are probably good technical reasons why it is no longer easy to support scripting languages in IB, but the new behavior sucks nonetheless. > > I doubt there's a good technical reason; The "good" reason is probably that Xcode has an internal semantic model of the code using the clang project and adding support for scripting languages to that is relatively hard because there are not off-the-shelve components they could use for that. That's a lame reason for completely dropping the support they had in Xcode3, but is understandable. > > > Again, I'd recommend you have a pow-wow with all the other bridge and > runtime developers, as you're the folks who are best able to describe > the problem in both technical and practical terms and rally your user > bases in concerted protest. I'm not very interested in doing that as I hardly have any time to work on pyobjc as it is and I'd prefer to spend that on moving the project forward rather than trying to move a big corporation. Unless a lot of users start complaining (or a number of very large customers) this likely will have minimal priority within Apple. Ronald From benjamin.j.golder at gmail.com Mon Feb 28 00:11:29 2011 From: benjamin.j.golder at gmail.com (Benjamin Golder) Date: Sun, 27 Feb 2011 15:11:29 -0800 Subject: [Pythonmac-SIG] appscript = creating variables of basic k. types Message-ID: Hello, I'm learning and enjoying the appscript module, but I'm a little confused about how to instantiate basic k. type objects. for example, if I want to create a variable that holds a k.boolean value to use while scripting an application, how do I create it, and then pass it to the set() method of a property within that application? let's say I'm scripting Adobe Illustrator: il = app('Adobe Illustrator') doc = il.current_document.get() layers = doc.layers.get() layer = layers[1] in Illustrator, a layer object has a property layer.visible, which has a k.boolean value. how do I create a variable m which is a k.boolean type, such that: layer.visible.set(m) will set the .visible property to a different k.boolean value? m = k.boolean(True) doesn't work m = make(new k.boolean) doesn't work there must be a simple answer, but I don't know it. Any and all help or advice is appreciated, thanks!! -Ben -------------- next part -------------- An HTML attachment was scrubbed... URL: From benjamin.j.golder at gmail.com Mon Feb 28 00:20:33 2011 From: benjamin.j.golder at gmail.com (Benjamin Golder) Date: Sun, 27 Feb 2011 15:20:33 -0800 Subject: [Pythonmac-SIG] appscript module - creating k. type objects Message-ID: Hello, I'm learning and enjoying the appscript module, but I'm a little confused about how to instantiate basic k. type objects. for example, if I want to create a variable that holds a k.boolean value to use while scripting an application, how do I create it, and then pass it to the set() method of a property within that application? let's say I'm scripting Adobe Illustrator: il = app('Adobe Illustrator') doc = il.current_document.get() layers = doc.layers.get() layer = layers[1] in Illustrator, a layer object has a property layer.visible, which has a k.boolean value. how do I create a variable m which is a k.boolean type, such that: layer.visible.set(m) will set the .visible property to a different k.boolean value? m = k.boolean(True) doesn't work m = make(new k.boolean) doesn't work there must be a simple answer, but I don't know it. Any and all help or advice is appreciated, thanks!! -Ben -------------- next part -------------- An HTML attachment was scrubbed... URL: From estartu at augusta.de Mon Feb 28 10:38:54 2011 From: estartu at augusta.de (Gerhard Schmidt) Date: Mon, 28 Feb 2011 10:38:54 +0100 Subject: [Pythonmac-SIG] py2app with wxpython In-Reply-To: <4D5D5704.8070803@noaa.gov> References: <4D5CF2D5.8040107@augusta.de> <4D5D5704.8070803@noaa.gov> Message-ID: <4D6B6D2E.1020105@augusta.de> Hi, Sorry was ill some time. Couldn't reply sooner. Am 17.02.2011 18:12, schrieb Christopher Barker: > On 2/17/11 2:05 AM, Gerhard Schmidt wrote: >> Hi, >> >> i try to generate an app from a wxPython project. >> >> Generation the App runs without an error. But when i try to start the >> App it terminates. > > versions of python (and which binary install), py2app, wxPython, OS-X ? Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) [GCC 4.2.1 (Apple Inc. build 5646)] on darwin Type "help", "copyright", "credits" or "license" for more information. py2app-0.5.2-py2.6.egg wx-2.8-mac-unicode MaxOS 10.6.6 >> The logs show that import wx doesn't work. > > can you build a really, really simple wx app? (see enclosed) > >> What am i missing. > > I'm not sure, but you do have something extra: > > CFBundleIdentifier = > "com.acf.vereinsverwaltung", > ) > ,'packages': 'wx' > > you don't need to specify the wx package -- if there is an "import wx" in your > code, py2app will find it. > > > ,'site_packages': True > > And I don't remember what this does -- try taking it out and see what you get. Doesn't change the problem. Still can't run the app. I have the loglines attached. Regards Estartu -- ---------------------------------------------------------------------------- Gerhard Schmidt | http://www.augusta.de/~estartu/ | Fischbachweg 3 | | PGP Public Key 86856 Hiltenfingen | JabberID: estartu at augusta.de | auf Anfrage/ Tel: 08232 77 36 4 | IRCNET: Estartu | on request Fax: 08232 77 36 3 | | -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: log URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 370 bytes Desc: OpenPGP digital signature URL: From estartu at augusta.de Mon Feb 28 10:47:00 2011 From: estartu at augusta.de (Gerhard Schmidt) Date: Mon, 28 Feb 2011 10:47:00 +0100 Subject: [Pythonmac-SIG] py2app with wxpython In-Reply-To: <4D5D5704.8070803@noaa.gov> References: <4D5CF2D5.8040107@augusta.de> <4D5D5704.8070803@noaa.gov> Message-ID: <4D6B6F14.2010005@augusta.de> Am 17.02.11 18:12, schrieb Christopher Barker: > On 2/17/11 2:05 AM, Gerhard Schmidt wrote: >> Hi, >> >> i try to generate an app from a wxPython project. >> >> Generation the App runs without an error. But when i try to start the >> App it terminates. > > versions of python (and which binary install), py2app, wxPython, OS-X ? > >> The logs show that import wx doesn't work. > > can you build a really, really simple wx app? (see enclosed) calling python basicwx.py from terminal works after setting VERSIONER_PYTHON_PREFER_32_BIT=yes maybe thats the problem. Is there a way to force py2app to chose the 32 bit version or to set the env accordlingly buiold the app works, starting doesn't. console logs the following 28.02.11 10:41:27 [0x0-0xe70e7].org.pythonmac.unspecified.basicwx[2946] Traceback (most recent call last): 28.02.11 10:41:27 [0x0-0xe70e7].org.pythonmac.unspecified.basicwx[2946] File "/Users/Estartu/Desktop/test/dist/basicwx.app/Contents/Resources/__boot__.py", line 103, in 28.02.11 10:41:27 [0x0-0xe70e7].org.pythonmac.unspecified.basicwx[2946] _argv_emulation() 28.02.11 10:41:27 [0x0-0xe70e7].org.pythonmac.unspecified.basicwx[2946] File "/Users/Estartu/Desktop/test/dist/basicwx.app/Contents/Resources/__boot__.py", line 101, in _argv_emulation 28.02.11 10:41:27 [0x0-0xe70e7].org.pythonmac.unspecified.basicwx[2946] _get_argvemulator().mainloop() 28.02.11 10:41:27 [0x0-0xe70e7].org.pythonmac.unspecified.basicwx[2946] File "/Users/Estartu/Desktop/test/dist/basicwx.app/Contents/Resources/__boot__.py", line 40, in mainloop 28.02.11 10:41:27 [0x0-0xe70e7].org.pythonmac.unspecified.basicwx[2946] stoptime = Evt.TickCount() + timeout 28.02.11 10:41:27 [0x0-0xe70e7].org.pythonmac.unspecified.basicwx[2946] AttributeError: 'module' object has no attribute 'TickCount' 28.02.11 10:41:28 basicwx[2946] basicwx Error 28.02.11 10:41:28 basicwx[2946] basicwx Error 28.02.11 10:41:35 com.apple.launchd.peruser.502[693] ([0x0-0xe70e7].org.pythonmac.unspecified.basicwx[2946]) Exited with exit code: 255 28.02.11 10:41:59 com.apple.launchd.peruser.502[693] ([0x0-0xe80e8].org.python.buildapplet[2953]) Exited: Killed Regards Estartu -- ---------------------------------------------------------------------------- Gerhard Schmidt | Nick : estartu IRC : Estartu | Fischbachweg 3 | | PGP Public Key 86856 Hiltenfingen | Privat: estartu at augusta.de | auf Anfrage/ Tel: 08232 77 36 4 | Dienst: schmidt at ze.tu-muenchen.de | on request Fax: 08232 77 36 3 | | -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 368 bytes Desc: OpenPGP digital signature URL: From hengist.podd at virgin.net Mon Feb 28 21:04:15 2011 From: hengist.podd at virgin.net (has) Date: Mon, 28 Feb 2011 20:04:15 +0000 Subject: [Pythonmac-SIG] a word of warning for pyobjc users In-Reply-To: <03FA5440-5F98-401E-8F94-FFED9F8C940A@mac.com> References: <17EE67A4-21E1-41C1-B885-B2AAC26C7AC7@mac.com> <03FA5440-5F98-401E-8F94-FFED9F8C940A@mac.com> Message-ID: <4D6BFFBF.7060407@virgin.net> On 24/02/11 09:31, Ronald Oussoren wrote: >>> There are probably good technical reasons why it is no longer >>> easy to support scripting languages in IB, but the new behavior >>> sucks nonetheless. One last thought: did you try AppleScriptObjC? It's a PyObjC-style bridge introduced in 10.6 with project templates included in Xcode 3.2. Its presence (or absence) in Xcode 4 should tell you something. Regards, has From dave at bcs.co.nz Fri Feb 18 00:10:25 2011 From: dave at bcs.co.nz (David Brooks) Date: Fri, 18 Feb 2011 12:10:25 +1300 Subject: [Pythonmac-SIG] Allow multiple executables in a single py2app bundle Message-ID: <4D5DAAE1.2010503@bcs.co.nz> Hi, The following patch enables the name of the stub executable to determine the Python script to run. This allows multiple scripts to use a common runtime. Required manual steps are to make copies of the stub in ./MacOS and to copy the actual Python scripts into ./Resources. N.B. The py2app/apptemplate/prebuilt contents need to be recreated by running 'python setup.py build' in py2app/apptemplate, before running the main 'setup.py install'. Enjoy! Dave ================================================= diff --git a/py2app/apptemplate/src/main.c b/py2app/apptemplate/src/main.c --- a/py2app/apptemplate/src/main.c +++ b/py2app/apptemplate/src/main.c @@ -1017,8 +1017,9 @@ argv_new = alloca((argc + 1) * sizeof(char *)); argv_new[argc] = NULL; - argv_new[0] = c_mainScript; - memcpy(&argv_new[1],&argv[1], (argc - 1) * sizeof(char *)); + //argv_new[0] = c_mainScript; + //memcpy(&argv_new[1],&argv[1], (argc - 1) * sizeof(char *)); + memcpy(argv_new, argv, argc * sizeof(char *)); py2app_PySys_SetArgv(argc, argv_new); diff --git a/py2app/bootstrap/boot_app.py b/py2app/bootstrap/boot_app.py --- a/py2app/bootstrap/boot_app.py +++ b/py2app/bootstrap/boot_app.py @@ -7,7 +7,7 @@ site.addsitedir(os.path.join(base, 'Python', 'site-packages')) if not scripts: import __main__ - for script in scripts: - path = os.path.join(base, script) - sys.argv[0] = __file__ = path - execfile(path, globals(), globals()) + script = sys.argv[0].split('/')[-1] + '.py' + path = os.path.join(base, script) + sys.argv[0] = __file__ = path + execfile(path, globals(), globals()) =================================================