From vasure at gmail.com Thu Dec 2 08:23:31 2010 From: vasure at gmail.com (Srini Kommoori) Date: Wed, 1 Dec 2010 23:23:31 -0800 Subject: [Pythonmac-SIG] PySide QtCore/QtGui error and Packing python Message-ID: Hi Guys, Been juggling and trying to pack a PySide application that I have. Here is a simple example I am having trouble solving. 1. Install Qt from: http://get.qt.nokia.com/qt/source/qt-mac-opensource-4.7.1.dmg 2. Install PySide from: http://kotisivu.dnainternet.net/lamikae/pyside-osx/pyside-1.0.0-beta1-qt47-py26apple.pkg 3. Simple test #test.py import sys from PySide import QtCore, QtGui import os, uuid app = QtGui.QApplication(sys.argv) widget = QtGui.QWidget() widget.resize(250, 150) widget.setWindowTitle('test') widget.show() sys.exit(app.exec_()) #python test.py - should give a window 4. Try to pack. #setup.py from setuptools import setup APP = ['test.py'] OPTIONS = {'argv_emulation': True, 'includes': ['PySide.QtCore', 'PySide.QtGui']} setup( app=APP, options={'py2app': OPTIONS}, setup_requires=['py2app'], ) #python setup.py py2app 5. Try to run the app open dist/test.app (or) directly open test.app/Contents/MacOS/test File "/Users/Srini/Documents/DropAndLock/dist/test.app/Contents/Resources/test.py", line 2, in from PySide import QtCore, QtGui File "PySide/__init__.pyc", line 2, in File "PySide/private.pyc", line 2, in File "PySide/QtCore.pyc", line 18, in File "PySide/QtCore.pyc", line 15, in __load ImportError: '/usr/lib/python2.6/lib-dynload/PySide/QtCore.so' not found 2010-12-01 23:14:08.200 test[22645:903] test Error 2010-12-01 23:14:08.204 test[22645:903] test Error Not sure how to build this without these problems. Also, how do I let py2app to pack python in the .app folder itself. Right now above procedure links python to system python path. thanks a lot for the help. -Srini From vasure at gmail.com Thu Dec 2 20:42:10 2010 From: vasure at gmail.com (Srini Kommoori) Date: Thu, 2 Dec 2010 11:42:10 -0800 Subject: [Pythonmac-SIG] Almost done - Help with understanding internals Message-ID: Hi Guys, Finally, I could able to get a good handle on using py2app. The only problem is, if I did open dist/test.app -> doesn't work - gives just an Error window. Seems like print of ___error__.sh file. But if I did, open dist/test.app/Contents/MacOS/test -> works fine What is the internal execution order? python __boot__.py -> then _run(test.py) thanks, -Srini From nad at acm.org Fri Dec 3 02:49:35 2010 From: nad at acm.org (Ned Deily) Date: Thu, 02 Dec 2010 17:49:35 -0800 Subject: [Pythonmac-SIG] 2.7.1 build? References: <4CF3D9DF.9020107@noaa.gov> <19699.60895.484517.71305@montanaro.dyndns.org> <4CF3F87B.2060605@noaa.gov> Message-ID: BTW, the official 2.7.1 OS X installers are now available: http://www.python.org/download/releases/2.7.1/ With Python 2.7, there are two Mac OS X installer variants available for download: the "traditional" 32-bit-only (Intel and PPC) version that installs and runs on all versions of OS X from 10.3.9 through current 10.6.x; and a new 64-bit/32-bit (Intel only) variant. As discussed in http://bugs.python.org/issue9227, there were problems using Tkinter and IDLE with the original 2.7 64/32 installer. The problem is that the only supported non-X11 64-bit Tcl/Tk at the moment is the one supplied by Apple in 10.6 and the installer tried unsuccessfully to support both 10.5 and 10.6. For 2.7.1, the 64/32 installer now only supports 10.6.x and will only use the Apple-supplied Tcl/Tk 8.5. The 32-bit-only installer is still built to link with either an Active/State Tcl/Tk 8.4, if installed in /Library/Frameworks, or fallback to the Apple-supplied Tcl/Tk 8.4 in OS X 10.4 through 10.6. The official 3.1.3 installer is also now available: http://www.python.org/download/releases/3.1.3/ As with previous 3.1.x installers, it is a "traditional" 32-bit-only installer (Intel/PPC, 10.3.9 -> 10.6, Tcl/Tk 8.4, etc). -- Ned Deily, nad at acm.org From hengist.podd at virgin.net Fri Dec 10 08:17:25 2010 From: hengist.podd at virgin.net (has) Date: Fri, 10 Dec 2010 07:17:25 +0000 Subject: [Pythonmac-SIG] appscript update - need help testing Message-ID: Hi folks, I've just made a couple of changes to py-appscript: - now supports Python 3.2 (Python 3.0 is no longer supported due to C API changes) - eliminated the osax module's dependency on deprecated Carbon APIs (this should avoid problems for anyone submitting appscript-dependent applications to the new app store, which bars the use of deprecated APIs) Eliminating the osax module's dependency on OSAGetAppTerminology() did mean one of two changes, however: - restricting OSAX instances to using StandardAdditions only and using a hardcoded terminology table instead of fetching the dictionary dynamically (0.21.1 already used this approach in 64-bit) OR: - adding a basic sdef parser to osax.py, allowing OSAX instances to retrieve terminology dynamically via OSACopyScriptingDefinition(). While I'm pretty confident StandardAdditions is the only osax that anyone actually uses, I was a little reluctant to restrict the advertised functionality now so went with the second option. There are caveats with that too: the sdef parser ignores some of the less common elements (e.g. synonyms), and sdef XMLs have their own problems as well (e.g. OS X's aete->sdef converter may omit some four-char codes and other information). Fingers crossed any compatibility problems this causes are minor, otherwise I'll switch to the SA-only approach. The changes are significant enough that I'd appreciate some other folks giving it a try before I release it, so for now I've upped the version number to 0.22.0 and left it in the svn trunk (rev 718): svn checkout \ https://appscript.svn.sourceforge.net/svnroot/appscript/py-appscript/trunk \ py-appscript-trunk The main thing to check is that the osax module works on 10.4-10.6, 32- and 64-bit; I'd recommend trying it with third-party scripting additions (http://osaxen.com) as well as StandardAdditions. A double-check of the main appscript module would be good as well. Also, I no longer have a 10.4 machine with Python 2.3 (the minimum advertised requirements), so if anyone is able to test that combination I would really appreciate it. (I've created the odd compatibility problem in the past by using Python 2.4+ features without realising.) If no issues are reported, I will bump the version and make a final 1.0.0 release before the end of the year. Thanks, has -- Learn AppleScript, 3rd edition, Sanderson & Rosenthal: http://apress.com/book/view/9781430223610 Control AppleScriptable applications from Python, Ruby and ObjC: http://appscript.sourceforge.net From sridharr at activestate.com Fri Dec 10 23:47:50 2010 From: sridharr at activestate.com (Sridhar Ratnakumar) Date: Fri, 10 Dec 2010 14:47:50 -0800 Subject: [Pythonmac-SIG] ANN: ActivePython 3.1.3.5 is now available [using ActiveTcl 8.5 64-bit] Message-ID: ActiveState is pleased to announce ActivePython 3.1.3.5, a complete, ready-to-install binary distribution of Python 3.1. http://www.activestate.com/activepython/downloads What's New in ActivePython-3.1.3.5 ================================== *Release date: 6-Dec-2010* New Features & Upgrades ----------------------- - Upgrade to Python 3.1.3 (`release notes `__) - Upgrade to Tcl/Tk 8.5.9 (`changes `_) - Security upgrade to openssl-0.9.8q - [MacOSX] Tkinter now requires ActiveTcl 8.5 64-bit (not Apple's Tcl/Tk 8.5 on OSX) - Upgrade to PyPM 1.2.6; noteworthy changes: - New command 'pypm log' to view log entries for last operation - Upgraded the following packages: - SQLAlchemy-0.6.5 - virtualenv5-1.3.4.5 Noteworthy Changes & Bug Fixes ------------------------------ - [MacOSX] Include missing architecture binaries - Bug #88876 - PyPM bug fixes: - depgraph: Fix a bug with missing extra in install_requires - Bug #88825 - depgraph: Fix a bug with double-marking a package for upgrade - Bug #88664: handle cyclic dependencies in the depgraph algorithm - Ignore comments (starting with #) in the requirements file - Fix: ignore empty lines in requirements.txt - Bug #88882: Fix pickle incompatability (sqlite) on Python 3.x What is ActivePython? ===================== ActivePython is ActiveState's binary distribution of Python. Builds for Windows, Mac OS X, Linux are made freely available. Solaris, HP-UX and AIX builds, and access to older versions are available in ActivePython Business, Enterprise and OEM editions: http://www.activestate.com/python ActivePython includes the Python core and the many core extensions: zlib and bzip2 for data compression, the Berkeley DB (bsddb) and SQLite (sqlite3) database libraries, OpenSSL bindings for HTTPS support, the Tix GUI widgets for Tkinter, ElementTree for XML processing, ctypes (on supported platforms) for low-level library access, and others. The Windows distribution ships with PyWin32 -- a suite of Windows tools developed by Mark Hammond, including bindings to the Win32 API and Windows COM. ActivePython 2.6, 2.7 and 3.1 also include a binary package manager for Python (PyPM) that can be used to install packages much easily. For example: C:\>pypm install mysql-python [...] C:\>python >>> import MySQLdb >>> See this page for full details: http://docs.activestate.com/activepython/3.1/whatsincluded.html As well, ActivePython ships with a wealth of documentation for both new and experienced Python programmers. In addition to the core Python docs, ActivePython includes the "What's New in Python" series, "Dive into Python", the Python FAQs & HOWTOs, and the Python Enhancement Proposals (PEPs). An online version of the docs can be found here: http://docs.activestate.com/activepython/3.1/ We would welcome any and all feedback to: activepython-feedback at activestate.com Please file bugs against ActivePython at: http://bugs.activestate.com/enter_bug.cgi?product=ActivePython Supported Platforms =================== ActivePython is available for the following platforms: - Windows (x86 and x64) - Mac OS X (x86 and x86_64; 10.5+) - Linux (x86 and x86_64) - Solaris/SPARC (32-bit and 64-bit) (Business, Enterprise or OEM edition only) - Solaris/x86 (32-bit) (Business, Enterprise or OEM edition only) - HP-UX/PA-RISC (32-bit) (Business, Enterprise or OEM edition only) - HP-UX/IA-64 (32-bit and 64-bit) (Enterprise or OEM edition only) - AIX/PowerPC (32-bit and 64-bit) (Business, Enterprise or OEM edition only) More information about the Business Edition can be found here: http://www.activestate.com/business-edition Custom builds are available in the Enterprise Edition: http://www.activestate.com/enterprise-edition Thanks, and enjoy! The Python Team -- Sridhar Ratnakumar Python Developer ActiveState, The Dynamic Language Experts sridharr at activestate.com http://www.activestate.com Get insights on Open Source and Dynamic Languages at www.activestate.com/blog From sridharr at activestate.com Mon Dec 13 19:08:48 2010 From: sridharr at activestate.com (Sridhar Ratnakumar) Date: Mon, 13 Dec 2010 10:08:48 -0800 Subject: [Pythonmac-SIG] ANN: ActivePython 2.7.1.3 is now available [using ActiveTcl 8.5 64-bit] Message-ID: ActiveState is pleased to announce ActivePython 2.7.1.3, a complete, ready-to-install binary distribution of Python 2.7. http://www.activestate.com/activepython/downloads What's New in ActivePython-2.7.1.3 ================================== *Release date: 6-Dec-2010* New Features & Upgrades ----------------------- - Upgrade to Python 2.7.1 (`release notes `__) - Upgrade to Tcl/Tk 8.5.9 (`changes `_) - Security upgrade to openssl-0.9.8q - [MacOSX] Tkinter now requires ActiveTcl 8.5 64-bit (not Apple's Tcl/Tk 8.5 on OSX) - Upgrade to PyPM 1.2.6; noteworthy changes: - New command 'pypm log' to view log entries for last operation - Faster startup (performance) especially on Windows. - Rewrite of an improved dependency algorithm (#88038) - install/uninstall now accepts the --nodeps option - 'pypm install ' to directly download and install a .pypm file - 'pypm show' improvements - 'pypm show' shows other installed packages depending on the shown package - 'pypm show' accepts --rdepends to show the list of dependents - 'pypm show' shows extra dependencies (for use in the 'install' cmd) - 'pypm show' lists all available versions in the repository - 'pypm freeze' to dump installed packages as requirements (like 'pip freeze') - Support for pip-stye requirements file ('pypm install -r requirements.txt') - Upgraded the following packages: - Distribute-0.6.14 - pip-0.8.2 - SQLAlchemy-0.6.5 - virtualenv-1.5.1 Noteworthy Changes & Bug Fixes ------------------------------ - Bug #87951: Exclude PyPM install db to prevent overwriting user's database. - Bug #87600: create a `idleX.Y` script on unix - [Windows] Installer upgrade: automatically uninstall previous versions - Bug #87783 - [Windows] Renamed "python27.exe" to "python2.7.exe" (Unix like) - [Windows] Include "python2.exe" - PyPM bug fixes: - Bug #88882: Fix pickle incompatability (sqlite) on Python 3.x - Bug #87764: 'pypm upgrade' will not error out for missing packages - Bug #87902: fix infinite loops with cyclic package dependencies (eg: plone) - Bug #88370: Handle file-overwrite conflicts (implement --force) What is ActivePython? ===================== ActivePython is ActiveState's binary distribution of Python. Builds for Windows, Mac OS X, Linux are made freely available. Solaris, HP-UX and AIX builds, and access to older versions are available in ActivePython Business, Enterprise and OEM editions: http://www.activestate.com/python ActivePython includes the Python core and the many core extensions: zlib and bzip2 for data compression, the Berkeley DB (bsddb) and SQLite (sqlite3) database libraries, OpenSSL bindings for HTTPS support, the Tix GUI widgets for Tkinter, ElementTree for XML processing, ctypes (on supported platforms) for low-level library access, and others. The Windows distribution ships with PyWin32 -- a suite of Windows tools developed by Mark Hammond, including bindings to the Win32 API and Windows COM. ActivePython 2.6, 2.7 and 3.1 also include a binary package manager for Python (PyPM) that can be used to install packages much easily. For example: C:\>pypm install mysql-python [...] C:\>python >>> import MySQLdb >>> See this page for full details: http://docs.activestate.com/activepython/2.7/whatsincluded.html As well, ActivePython ships with a wealth of documentation for both new and experienced Python programmers. In addition to the core Python docs, ActivePython includes the "What's New in Python" series, "Dive into Python", the Python FAQs & HOWTOs, and the Python Enhancement Proposals (PEPs). An online version of the docs can be found here: http://docs.activestate.com/activepython/2.7/ We would welcome any and all feedback to: activepython-feedback at activestate.com Please file bugs against ActivePython at: http://bugs.activestate.com/enter_bug.cgi?product=ActivePython Supported Platforms =================== ActivePython is available for the following platforms: - Windows (x86 and x64) - Mac OS X (x86 and x86_64; 10.5+) - Linux (x86 and x86_64) - Solaris/SPARC (32-bit and 64-bit) (Business, Enterprise or OEM edition only) - Solaris/x86 (32-bit) (Business, Enterprise or OEM edition only) - HP-UX/PA-RISC (32-bit) (Business, Enterprise or OEM edition only) - HP-UX/IA-64 (32-bit and 64-bit) (Enterprise or OEM edition only) - AIX/PowerPC (32-bit and 64-bit) (Business, Enterprise or OEM edition only) More information about the Business Edition can be found here: http://www.activestate.com/business-edition Custom builds are available in the Enterprise Edition: http://www.activestate.com/enterprise-edition Thanks, and enjoy! The Python Team -- Sridhar Ratnakumar Python Developer ActiveState, The Dynamic Language Experts sridharr at activestate.com http://www.activestate.com Get insights on Open Source and Dynamic Languages at www.activestate.com/blog From sridharr at activestate.com Mon Dec 13 19:17:14 2010 From: sridharr at activestate.com (Sridhar Ratnakumar) Date: Mon, 13 Dec 2010 10:17:14 -0800 Subject: [Pythonmac-SIG] 2.7.1 build? In-Reply-To: References: <4CF3D9DF.9020107@noaa.gov> <19699.60895.484517.71305@montanaro.dyndns.org> <4CF3F87B.2060605@noaa.gov> Message-ID: <5A1C1D3A-FC81-4D14-B37D-94D758C92E4C@activestate.com> On 2010-12-02, at 5:49 PM, Ned Deily wrote: > As discussed in > http://bugs.python.org/issue9227, there were problems using Tkinter and > IDLE with the original 2.7 64/32 installer. The problem is that the > only supported non-X11 64-bit Tcl/Tk at the moment is the one supplied > by Apple in 10.6 [...] That is not true anymore. ActiveTcl 8.5.9.1 was released last week with 64-bit (Tk/Cocoa) support on OSX. http://www.activestate.com/activetcl/downloads http://docs.activestate.com/activetcl/8.5/at.release.html#new ActivePython 2.7 & 3.1 (in future, 2.6 as well) currently require this version of ActiveTcl on OSX. -srid From jf at ai.univ-paris8.fr Mon Dec 13 19:57:53 2010 From: jf at ai.univ-paris8.fr (Jym Feat) Date: Mon, 13 Dec 2010 19:57:53 +0100 Subject: [Pythonmac-SIG] utf-8 using python 2.6.1 (os x 10.6.4) In-Reply-To: <5A1C1D3A-FC81-4D14-B37D-94D758C92E4C@activestate.com> References: <4CF3D9DF.9020107@noaa.gov> <19699.60895.484517.71305@montanaro.dyndns.org> <4CF3F87B.2060605@noaa.gov> <5A1C1D3A-FC81-4D14-B37D-94D758C92E4C@activestate.com> Message-ID: I'm having issues when using python 2.6.1 in interactive mode : it wouldn't let me type anything but plain ascii... while the terminal itself will properly display french accented characters as entered on the fly; so I looked into site.py, found that silly instruction was still there on line 456, changed it, to utf-8, but still no go... hunting for a solution on the web, I learned about PYTHONIOENCODING and set it to utf-8 in my environment: still no accented french chars... then I checked the 'escape non ascii' option in the terminal settings: now I can type words like No?l or P?ques, but there are still some oddities, like the ? ligature for instance, that display as ?^?^? has anybody solved that issue? -- Jym Feat ~ Paris FR 75018 From nad at acm.org Mon Dec 13 20:23:41 2010 From: nad at acm.org (Ned Deily) Date: Mon, 13 Dec 2010 11:23:41 -0800 Subject: [Pythonmac-SIG] utf-8 using python 2.6.1 (os x 10.6.4) References: <4CF3D9DF.9020107@noaa.gov> <19699.60895.484517.71305@montanaro.dyndns.org> <4CF3F87B.2060605@noaa.gov> <5A1C1D3A-FC81-4D14-B37D-94D758C92E4C@activestate.com> Message-ID: In article , Jym Feat wrote: > I'm having issues when using python 2.6.1 in interactive mode : it wouldn't > let me type anything but plain ascii... while the terminal itself will > properly display french accented characters as entered on the fly; > > so I looked into site.py, found that silly instruction was still there on > line 456, changed it, to utf-8, but still no go... > > hunting for a solution on the web, I learned about PYTHONIOENCODING and set > it to utf-8 in my environment: still no accented french chars... > > then I checked the 'escape non ascii' option in the terminal settings: now I > can type words like No?l or P?ques, but there are still some oddities, like > the ? ligature for instance, that display as ?^?^? > > has anybody solved that issue? Without looking at it more closely, my guess would be an issue (or difference) between the Apple-supplied editline library which Apple uses as a substitute for the GNU readline library in the system-supplied Python 2.6.1 in OS X 10.6. If you have the time, please try using the python.org 32-bit-only python 2.7.1 installer which is linked with GNU readline and then the python.org 64-bit python 2.7.1 which is currently linked with editline. If the problem is duplicated there, please open an issue on the python bug tracker (bugs.python.org). -- Ned Deily, nad at acm.org From jf at ai.univ-paris8.fr Tue Dec 14 11:25:38 2010 From: jf at ai.univ-paris8.fr (Jym Feat) Date: Tue, 14 Dec 2010 11:25:38 +0100 Subject: [Pythonmac-SIG] utf-8 using python 2.6.1 (os x 10.6.4) In-Reply-To: References: <4CF3D9DF.9020107@noaa.gov> <19699.60895.484517.71305@montanaro.dyndns.org> <4CF3F87B.2060605@noaa.gov> <5A1C1D3A-FC81-4D14-B37D-94D758C92E4C@activestate.com> Message-ID: At 11:23 -0800 13/12/10, Ned Deily wrote: > please try using the python.org 32-bit-only python 2.7.1 installer which is linked with GNU readline and then the python.org 64-bit python 2.7.1 which is currently linked with editline. If the problem is duplicated there, please open an issue on the python bug tracker (bugs.python.org). thanks, Ned: will do that! -- Jym Feat ~ Paris FR 75018 From stokes at mac.com Tue Dec 14 18:57:20 2010 From: stokes at mac.com (David Stokes) Date: Tue, 14 Dec 2010 17:57:20 +0000 (GMT) Subject: [Pythonmac-SIG] Accessing the iTunes database directly? Message-ID: <21b38dbc-8071-6179-89c7-b9cbb050af9a@me.com> Can the iTunes library database be accessed directly via Python? What I want to do are some fairly basic manipulations of the data but using the scripting API (from both appscript and AppleScript) was ridiculously slow; operations that took seconds in comparable manipulations of a SQLite database of a similar size took multiple hours. I had thought I'd heard that iTunes uses -- or once used -- SQLite, but either it has changed or I was just looking in the wrong place. If nothing else, I suppose I can use an XML export of the library data and then re-import it.? Thanks, David -------------- next part -------------- An HTML attachment was scrubbed... URL: From nad at acm.org Tue Dec 14 23:03:22 2010 From: nad at acm.org (Ned Deily) Date: Tue, 14 Dec 2010 14:03:22 -0800 Subject: [Pythonmac-SIG] Accessing the iTunes database directly? References: <21b38dbc-8071-6179-89c7-b9cbb050af9a@me.com> Message-ID: In article <21b38dbc-8071-6179-89c7-b9cbb050af9a at me.com>, David Stokes wrote: > Can the iTunes library database be accessed directly via Python? What I want > to do are some fairly basic manipulations of the data but using the scripting > API (from both appscript and AppleScript) was ridiculously slow; operations > that took seconds in comparable manipulations of a SQLite database of a > similar size took multiple hours. I had thought I'd heard that iTunes uses -- > or once used -- SQLite, but either it has changed or I was just looking in > the wrong place. > > If nothing else, I suppose I can use an XML export of the > library data and then re-import it. Keep in mind that, depending on how your iTunes library is configured, changes to a track's metadata may cause iTunes to update the metadata in the music file (mp3 tags, etc), which may take a long time to rewrite each affected music file. That can make mass updates *very* slow regardless of how you do it: manually or through a scripting interface. You can parse the iTunes XML file easily in Python but, AFAIK, the only ways to then update the iTunes data are by either reimporting the modified XML library file, which might cause you to lose some information, or through the scripting API; I don't know of any public APIs to iTunes internal DBs. If you don't care about the tags in the music files themselves, you may be able to inhibit the file updates by experimenting with some of the iTunes preferences or possibly by temporarily changing the music files' permissions. -- Ned Deily, nad at acm.org From hengist.podd at virgin.net Wed Dec 15 02:02:46 2010 From: hengist.podd at virgin.net (has) Date: Wed, 15 Dec 2010 01:02:46 +0000 Subject: [Pythonmac-SIG] Accessing the iTunes database directly? Message-ID: [Pythonmac-SIG] Accessing the iTunes database directly? David Stokes wrote: > Can the iTunes library database be accessed directly via Python? No. Your only options are the Apple event interface and the read-only XML file in your iTunes library. > What I want to do are some fairly basic manipulations of the data but using the scripting API (from both appscript and AppleScript) was ridiculously slow; operations that took seconds in comparable manipulations of a SQLite database of a similar size took multiple hours. Did you read the 'About application scripting' and 'Performance issues' chapters in the appscript manual? Remember, Apple events = RPC + queries, not OOP. Remotely iterating over large data sets will absolutely kill your script performance-wise. While certain tasks can only be done via iteration and lots of small simple commands, e.g. setting the name of every track in a 50,000-track library, plenty of others can be reduced to just one or two commands by using more sophisticated queries, e.g.: tracks_ref = iTunes.tracks info = zip(tracks_ref.name.get(), tracks_ref.album.get()) # 2 commands not: info = [(track.name.get(), track.album.get() for track in iTunes.tracks.get()] # 2*N+1 commands If you're already familiar with how relational DB queries operate, it's not so different (as that is where the original AppleScript engineers nicked half their ideas from). HTH has -- Learn AppleScript, 3rd edition, Sanderson & Rosenthal: http://apress.com/book/view/9781430223610 Control AppleScriptable applications from Python, Ruby and ObjC: http://appscript.sourceforge.net From vincent at vincentdavis.net Wed Dec 15 05:41:55 2010 From: vincent at vincentdavis.net (Vincent Davis) Date: Tue, 14 Dec 2010 21:41:55 -0700 Subject: [Pythonmac-SIG] Correct owner and group in python directory Message-ID: Depending on how I instal modules into python I get different owner and group settings. Basically either I am the owner with the group being admin or root is the owner with admin group again. What is "correct" ideally. I as because I am working on a project to package some python modules into a installer/dmg and what to make sure they get installed with the right owner and group set. -- Thanks Vincent Davis 720-301-3003 -------------- next part -------------- An HTML attachment was scrubbed... URL: From hengist.podd at virgin.net Wed Dec 15 15:15:05 2010 From: hengist.podd at virgin.net (has) Date: Wed, 15 Dec 2010 14:15:05 +0000 Subject: [Pythonmac-SIG] [ann] Python appscript 0.22.0 released Message-ID: Hi folks, Just to let you know appscript 0.22.0 (release candidate 1) is now available for Python: http://pypi.python.org/pypi/appscript http://appscript.sourceforge.net/py-appscript/install.html This release adds 64-bit support to the osax module and ensures compatibility with Python 3.2. Please let me know if you encounter any problems. If no issues are reported, the 1.0.0 final release will follow shortly. Enjoy, has -- Learn AppleScript, 3rd edition, Sanderson & Rosenthal: http://apress.com/book/view/9781430223610 Control AppleScriptable applications from Python, Ruby and ObjC: http://appscript.sourceforge.net From hengist.podd at virgin.net Tue Dec 21 22:13:47 2010 From: hengist.podd at virgin.net (has) Date: Tue, 21 Dec 2010 21:13:47 +0000 Subject: [Pythonmac-SIG] [ann] ASDictionary, ASTranslate updates Message-ID: Hi all, I've just posted new versions of ASDictionary and ASTranslate; no new features but various bug fixes and internal updates to eliminate the use of deprecated Carbon APIs. Appreciate it if folks could give them a go and let us know of any problems. Thanks, has -- Learn AppleScript, 3rd edition, Sanderson & Rosenthal: http://apress.com/book/view/9781430223610 Control AppleScriptable applications from Python, Ruby and ObjC: http://appscript.sourceforge.net From amorris at mistermorris.com Wed Dec 22 08:12:06 2010 From: amorris at mistermorris.com (Adam Morris) Date: Wed, 22 Dec 2010 14:12:06 +0700 Subject: [Pythonmac-SIG] [ann] ASDictionary, ASTranslate updates In-Reply-To: References: Message-ID: How to translate this applescript into appscript?: do shell script "sudo rm /usr/bin/file" with administrator privileges Thanks for your software, has. -Adam From vze26m98 at optonline.net Wed Dec 22 20:07:45 2010 From: vze26m98 at optonline.net (Charles Turner) Date: Wed, 22 Dec 2010 14:07:45 -0500 Subject: [Pythonmac-SIG] [ann] ASDictionary, ASTranslate updates In-Reply-To: References: Message-ID: <3F15593D-9544-4B04-A00F-AA4D11440761@optonline.net> On Dec 22, 2010, at 2:12 AM, Adam Morris wrote: > How to translate this applescript into appscript?: > > do shell script "sudo rm /usr/bin/file" with administrator privileges > > Thanks for your software, has. I don't have the "with" solved, but it goes something like this: >> import osax >> >> sa = osax.OSAX() >> >> print sa.do_shell_script("ls -l") HTH, Charles From vze26m98 at optonline.net Wed Dec 22 20:14:23 2010 From: vze26m98 at optonline.net (Charles Turner) Date: Wed, 22 Dec 2010 14:14:23 -0500 Subject: [Pythonmac-SIG] [ann] ASDictionary, ASTranslate updates In-Reply-To: <3F15593D-9544-4B04-A00F-AA4D11440761@optonline.net> References: <3F15593D-9544-4B04-A00F-AA4D11440761@optonline.net> Message-ID: <3D20E91C-D55B-4043-B0E0-345222E5CD68@optonline.net> OK, I got it: > import osax > > sa = osax.OSAX() > > print sa.do_shell_script("ls -l", administrator_privileges=True) If you look in the Applescript dictionary, it appears the function syntax is: > set theResult to do shell script unicode text ? > as type class ? > administrator privileges boolean ? > user name unicode text ? > password unicode text ? > altering line endings boolean So administrator privileges is a boolean. Have a look at the documentation for py-appscript OSAX: And there's this about invoking the shell from Applescript: HTH, Charles From amorris at mistermorris.com Thu Dec 23 04:08:26 2010 From: amorris at mistermorris.com (Adam Morris) Date: Thu, 23 Dec 2010 10:08:26 +0700 Subject: [Pythonmac-SIG] [ann] ASDictionary, ASTranslate updates In-Reply-To: <3D20E91C-D55B-4043-B0E0-345222E5CD68@optonline.net> References: <3F15593D-9544-4B04-A00F-AA4D11440761@optonline.net> <3D20E91C-D55B-4043-B0E0-345222E5CD68@optonline.net> Message-ID: > print sa.do_shell_script("ls -l", administrator_privileges=True) Thanks Charles, I had forgotten that do shell script is a part of the Standard Addition osax. Now I know how to run a script that needs the user's permission without having to use some GUI scripts to get the admin/password dialog. From amorris at mistermorris.com Mon Dec 27 12:35:00 2010 From: amorris at mistermorris.com (Adam Morris) Date: Mon, 27 Dec 2010 18:35:00 +0700 Subject: [Pythonmac-SIG] Popen and py2app Message-ID: py2app experts, I have a script that is packaged using and py2app that does a pre-check to see if a command line utility is installed, using Popen and "which name". (The script downloads and installs it if not.) I pass subprocess.PIPE for stdout and stderr, with shell=True. When I run the script "raw" from the terminal it always prints, correctly, with the path to the desired utility, i.e. ('/usr/local/bin/name', '') When I run the program after compiling with py2app, exactly as documented on the website, the console always gets ('', '') as the response, which is incorrect as it's definitely installed ... nor was an error reported. I even tried re-writing the Popen command as "/usr/bin/which name" to no avail. Using 10.6.5, py2app 0.5.2. Could this be a problem with py2app, or is there something about the run-time environment I've overlooked? Would also be interested if there is a better way of checking to see if a command line utility is currently located in the path for the current user's system. (Just a hobbyist here, go easy on me!) -Adam From bruno.bottazzini at cti.gov.br Mon Dec 27 14:23:57 2010 From: bruno.bottazzini at cti.gov.br (Bruno Lara Bottazzini) Date: Mon, 27 Dec 2010 11:23:57 -0200 Subject: [Pythonmac-SIG] py2app cutomize up-level main.py Message-ID: Hi there how are you doing? My main.py is up-level in other folder and I would like to know how can I customize the py2app setup script to create a folder on the Resources/folder/main.py and then boot it automatically. Thanks. -- -------------- next part -------------- An HTML attachment was scrubbed... URL: From Chris.Barker at noaa.gov Mon Dec 27 18:46:24 2010 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Mon, 27 Dec 2010 09:46:24 -0800 Subject: [Pythonmac-SIG] Popen and py2app In-Reply-To: References: Message-ID: <4D18D0F0.2080900@noaa.gov> Adam Morris wrote: > Could this be a problem with py2app, or is there something about the > run-time environment I've overlooked? > > Would also be interested if there is a better way of checking to see > if a command line utility is currently located in the path for the > current user's system. I think what you've done is correct -- i.e. it's not on the PATH for the users system. For the most part, the PATH for the command line is added to the shell rc scripts, so if you are not running from a shell (i.e. from a py2app bundle) you won't have the additional entries on PATH (like /usr/local/bin). I'm pretty sure there is a way to edit a plist somewhere to add to the PATH system (or user?) wide. However, if you're delivering an app bundle, you probably don't want to require your users to do this. I may misunderstand your use case, but I think you could specifically search for the utility in places it might be expected to be found: /usr/bin /usr/local/bin /sw/... (for fink) /opt/... (for macports) rather then expect it to be on the PATH. -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 amorris at mistermorris.com Mon Dec 27 20:33:43 2010 From: amorris at mistermorris.com (Adam Morris) Date: Tue, 28 Dec 2010 02:33:43 +0700 Subject: [Pythonmac-SIG] Popen and py2app In-Reply-To: <4D18D0F0.2080900@noaa.gov> References: <4D18D0F0.2080900@noaa.gov> Message-ID: On Dec 28, 2010, at 12:46 AM, Christopher Barker wrote: > I think you could specifically search for the utility in places it might be expected to be found: > > /usr/bin > /usr/local/bin > /sw/... (for fink) > /opt/... (for macports) That's the first thing I tried; maybe I typed wrong? I'll give it yet another look. ... Right! Understandably, I wrote "/usr/bin/which name" and it should be "/usr/bin/which /usr/local/bin/name". Should have included the full path for the argument as well. Thanks! From aahz at pythoncraft.com Tue Dec 28 06:24:10 2010 From: aahz at pythoncraft.com (Aahz) Date: Mon, 27 Dec 2010 21:24:10 -0800 Subject: [Pythonmac-SIG] Popen and py2app In-Reply-To: References: <4D18D0F0.2080900@noaa.gov> Message-ID: <20101228052410.GA1962@panix.com> On Tue, Dec 28, 2010, Adam Morris wrote: > On Dec 28, 2010, at 12:46 AM, Christopher Barker wrote: > >> I think you could specifically search for the utility in places it >> might be expected to be found: >> >> /usr/bin >> /usr/local/bin >> /sw/... (for fink) >> /opt/... (for macports) > > That's the first thing I tried; maybe I typed wrong? I'll give it yet > another look. ... > > Right! > > Understandably, I wrote "/usr/bin/which name" and it should be > "/usr/bin/which /usr/local/bin/name". > > Should have included the full path for the argument as well. Thanks! Nope. If you're doing that, just use os.path.exists() or isfile(). Faster and safer. -- Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/ "Think of it as evolution in action." --Tony Rand From amorris at mistermorris.com Tue Dec 28 07:57:08 2010 From: amorris at mistermorris.com (Adam Morris) Date: Tue, 28 Dec 2010 13:57:08 +0700 Subject: [Pythonmac-SIG] Popen and py2app In-Reply-To: <20101228052410.GA1962@panix.com> References: <4D18D0F0.2080900@noaa.gov> <20101228052410.GA1962@panix.com> Message-ID: <443AE250-1000-4CCE-9C93-2C470E666EBD@mistermorris.com> On Dec 28, 2010, at 12:24 PM, Aahz wrote: > Nope. If you're doing that, just use os.path.exists() or isfile(). > Faster and safer. I was hoping that I could detect it no matter where it was so advanced users could do symlinks or move it to their own folders or whatever which made me think of bash's which. You're right though, if I'm relegated to typing out the full path might as well use os.path.exists and allow the user to modify the path it looks in with a preference. From rik at cogsci.ucsd.edu Wed Dec 29 22:13:23 2010 From: rik at cogsci.ucsd.edu (richard k belew) Date: Wed, 29 Dec 2010 13:13:23 -0800 Subject: [Pythonmac-SIG] PytDev intro documentation review? Message-ID: <4D1BA473.6050503@cogsci.ucsd.edu> i'm getting ready to teach a Python-based intro programming course, and i've committed to a development stack leading to PyDev on Eclipse. (yes, my sanity has already been questioned.) if this class is like most others, most kids will come in with Windoz laptops, but some with Macs, and (long shot) maybe even a Linux user or two. So i've written up some instructions for getting their environments put together, at: http://cogs18.edurik.org/syllabus/resources/installation-of-python-eclipse-pydev-environment i'm wondering if members of this experienced list might give it a read and see if they can suggest any sources of confusion i might avoid? in particular, if you look at http://cogs18.edurik.org/syllabus/resources/installation-of-python-eclipse-pydev-environment#section-1 Item#3 has to do with the Mac install of Python. here i lay out two alternatives, one using the standard system installed Python and the other installing the standard Python release. since my ultimate goal is to simply get the PyDev plugin for Eclipse operational, and PyDev says it'll work with any Python >= 2.1, this SEEMs safe. do y'all agree? any other suggestions? the students-to-come thank you! Rik From matgeek at gmail.com Thu Dec 30 17:59:40 2010 From: matgeek at gmail.com (matgeek at gmail.com) Date: Thu, 30 Dec 2010 12:59:40 -0400 Subject: [Pythonmac-SIG] py2app w/ setuptools Message-ID: Hi Everyone, I've been playing around with py2app for the last few days, trying to assemble Deluge 1.3.1 (a rather large python/gtk project that links against the C++ project *libtorrent*) into an .app and I'm at the point now where I should probably verify that what I'm attempting to do is actually possible, before spending several more hours pounding my head against my monitor. I have a few years of *nix experience and a small amount of programming background, but I'm certainly not a unix power-user by any stretch of the imagination - this is proving to be a limiting factor in my journey so far. I'm not sure that I'm fully understanding the specifics, so forgive me if the following sounds ridiculous. I have installed Deluge via MacPorts using this command: "*sudo port install boost +python26 pango +no_x11+quartz cairo +no_x11+quartz gtk2 +no_x11+quartz libnotify +no_x11+quartz deluge*"... Which gets Deluge up and running, so I know at least the dependcies have been satisfied. After a little digging, I've come to realize that it's being run by setuptools, which is where things get a little foggy for me. The file that is called, which opens Deluge, is not an executable unix file, nor does it have a python file extension. It's simply called 'deluge' - the contents of which are: #!/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python # EASY-INSTALL-ENTRY-SCRIPT: 'deluge==1.3.1','gui_scripts','deluge' __requires__ = 'deluge==1.3.1' import sys from pkg_resources import load_entry_point > if __name__ == '__main__': sys.exit( load_entry_point('deluge==1.3.1', 'gui_scripts', 'deluge')() ) My assumption is that this file is where setuptools is working it's magic, but it leaves me completely stumped as to which file I should be passing into py2applet (and ultimately py2app). Since that left me stumped, I thought I'd try to create an .app from the Deluge source code (not the installed, running version - just an extracted tar ball). I first renamed the setup.py included in the source to Deluge.py and issued "py2applet --make-setup Deluge.py" followed by "python setup.py py2app -A". But the resulting .app is created way too quickly to be legit and when I attempt to run it I get the following output: Traceback (most recent call last): File > "/Users/mat/Coding/Deluge/python/deluge-1.3.1/dist/Deluge.app/Contents/Resources/__boot__.py", > line 164, in > _run(('\x00\x00\x00\x00\x01\x1e\x00\x02\x00\x00\x04iMat\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc6Y\xdb\xecH+\x00\x00\x00\xe5\xcd\xf3\tDeluge.py\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf4ua\xc9As\xa2\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00I > \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x08\x00\x00\xc6Z\x06\x1c\x00\x00\x00\x11\x00\x08\x00\x00\xc9A\xab\xe2\x00\x00\x00\x0e\x00\x14\x00\t\x00D\x00e\x00l\x00u\x00g\x00e\x00.\x00p\x00y\x00\x0f\x00\n\x00\x04\x00i\x00M\x00a\x00t\x00\x12\x005Users/mat/Coding/Deluge/python/deluge-1.3.1/Deluge.py\x00\x00\x13\x00\x01/\x00\x00\x15\x00\x02\x00\n\xff\xff\x00\x00', > '/Users/mat/Coding/Deluge/python/deluge-1.3.1/Deluge.py')) File > "/Users/mat/Coding/Deluge/python/deluge-1.3.1/dist/Deluge.app/Contents/Resources/__boot__.py", > line 160, in _run execfile(path, globals(), globals()) File "/Users/mat/Coding/Deluge/python/deluge-1.3.1/Deluge.py", line 29, in > from setuptools import setup, find_packages, Extension File > "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/__init__.py", > line 2, in File > "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/extension.py", > line 2, in File > "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/dist.py", > line 5, in File > "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/command/install.py", > line 2, in File > "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/command/install.py", > line 21, in from site import USER_BASE ImportError: cannot import name USER_BASE My assumption now is that py2app needs to be run against the installed, running version in order to track the various libraries that need to be bundled in the final .App - but perhaps I'm incorrect here? Again, I'm mostly looking to find out if my efforts have been in vain or if there is actually hope in getting Deluge packaged up? If you think it should possible, any insights you might have would be greatly appreciated and very much welcomed. Best Regards, Mat -------------- next part -------------- An HTML attachment was scrubbed... URL: From matgeek at gmail.com Thu Dec 30 17:16:55 2010 From: matgeek at gmail.com (matgeek at gmail.com) Date: Thu, 30 Dec 2010 12:16:55 -0400 Subject: [Pythonmac-SIG] py2app question In-Reply-To: References: Message-ID: Hi Everyone, I've been playing around with py2app for the last few days, trying to assemble Deluge 1.3.1 (a rather large python/gtk project that links against the C++ project *libtorrent*) into an .app and I'm at the point now where I should probably verify that what I'm attempting to do is actually possible, before spending several more hours pounding my head against my monitor. I have a few years of *nix experience and a small amount of programming background, but I'm certainly not a unix power-user by any stretch of the imagination - this is proving to be a limiting factor in my journey so far. I'm not sure that I'm fully understanding the specifics, so forgive me if the following sounds ridiculous. I have installed Deluge via MacPorts using this command: "*sudo port install boost +python26 pango +no_x11+quartz cairo +no_x11+quartz gtk2 +no_x11+quartz libnotify +no_x11+quartz deluge*"... Which gets Deluge up and running, so I know at least the dependcies have been satisfied. After a little digging, I've come to realize that it's being run by setuptools, which is where things get a little foggy for me. The file that is called, which opens Deluge, is not an executable unix file, nor does it have a python file extension. It's simply called 'deluge' - the contents of which are: #!/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python # EASY-INSTALL-ENTRY-SCRIPT: 'deluge==1.3.1','gui_scripts','deluge' __requires__ = 'deluge==1.3.1' import sys from pkg_resources import load_entry_point > if __name__ == '__main__': sys.exit( load_entry_point('deluge==1.3.1', 'gui_scripts', 'deluge')() ) My assumption is that this file is where setuptools is working it's magic, but it leaves me completely stumped as to which file I should be passing into py2applet (and ultimately py2app). Since that left me stumped, I thought I'd try to create an .app from the Deluge source code (not the installed, running version - just an extracted tar ball). I first renamed the setup.py included in the source to Deluge.py and issued "py2applet --make-setup Deluge.py" followed by "python setup.py py2app -A". But the resulting .app is created way too quickly to be legit and when I attempt to run it I get the following output: Traceback (most recent call last): File > "/Users/mat/Coding/Deluge/python/deluge-1.3.1/dist/Deluge.app/Contents/Resources/__boot__.py", > line 164, in > _run(('\x00\x00\x00\x00\x01\x1e\x00\x02\x00\x00\x04iMat\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc6Y\xdb\xecH+\x00\x00\x00\xe5\xcd\xf3\tDeluge.py\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf4ua\xc9As\xa2\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00I > \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x08\x00\x00\xc6Z\x06\x1c\x00\x00\x00\x11\x00\x08\x00\x00\xc9A\xab\xe2\x00\x00\x00\x0e\x00\x14\x00\t\x00D\x00e\x00l\x00u\x00g\x00e\x00.\x00p\x00y\x00\x0f\x00\n\x00\x04\x00i\x00M\x00a\x00t\x00\x12\x005Users/mat/Coding/Deluge/python/deluge-1.3.1/Deluge.py\x00\x00\x13\x00\x01/\x00\x00\x15\x00\x02\x00\n\xff\xff\x00\x00', > '/Users/mat/Coding/Deluge/python/deluge-1.3.1/Deluge.py')) File > "/Users/mat/Coding/Deluge/python/deluge-1.3.1/dist/Deluge.app/Contents/Resources/__boot__.py", > line 160, in _run execfile(path, globals(), globals()) File "/Users/mat/Coding/Deluge/python/deluge-1.3.1/Deluge.py", line 29, in > from setuptools import setup, find_packages, Extension File > "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/__init__.py", > line 2, in File > "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/extension.py", > line 2, in File > "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/dist.py", > line 5, in File > "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/command/install.py", > line 2, in File > "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/command/install.py", > line 21, in from site import USER_BASE ImportError: cannot import name USER_BASE My assumption now is that py2app needs to be run against the installed, running version in order to track the various libraries that need to be bundled in the final .App - but perhaps I'm incorrect here? Again, I'm mostly looking to find out if my efforts have been in vain or if there is actually hope in getting Deluge packaged up? If you think it should possible, any insights you might have would be greatly appreciated and very much welcomed. Best Regards, Mat -------------- next part -------------- An HTML attachment was scrubbed... URL: