From vip at avatar.com.au Fri Aug 1 00:54:00 2008 From: vip at avatar.com.au (DavidW) Date: Fri, 1 Aug 2008 08:54:00 +1000 Subject: [Pythonmac-SIG] py access to speech synth? In-Reply-To: <4AEAF986-AD57-48E5-9754-D55BD9638296@alcidesfonseca.com> References: <4AEAF986-AD57-48E5-9754-D55BD9638296@alcidesfonseca.com> Message-ID: <457598F2-84D6-4B9E-B2DC-40161B214E3F@avatar.com.au> Thanks for replying. I know about "say". What's wrong with such high-level control is, for example, that there isn't any tempo or prosody control or phoneme control - if that's their synthesis method - (a 'cello that is fixated on the Hall of the Mountain King would soon become my enemy :-) I haven't used PyObjC before so I'll have a go at NSSpeechSynthesizer. Thanks! Any other views? David On 31/07/2008, at 9:08 PM, Alcides Fonseca wrote: > > Em 2008/07/31, ?s 10:54, DavidW escreveu: > >> Hello all, >> >> Does anyone know whether there's any work being done on a python >> interface to the OSX speech synthesiser? >> > > What's wrong with > > import os > os.system("say -v Cellos Python does not have braces have braces > have bracesThats why I love python so much") > > I guess there is already a OSA interface, and you can translate the > following AppleScript to Python: > > say "To see other application windows again, select Show All from > the Finder menu." using "Vicki" > > Hope it helped... > > Alcides From patrick at raptr.com Fri Aug 1 23:52:26 2008 From: patrick at raptr.com (Patrick Li) Date: Fri, 1 Aug 2008 14:52:26 -0700 Subject: [Pythonmac-SIG] using py2app to include the python interpreter? Message-ID: <2b5a48740808011452k697c7f70kf840eea7d89889b4@mail.gmail.com> Hi, I just used py2app to bundle my app on Leopard. It works fine on my computer. However, when I let my friend run the app on his machine that is running Tiger, it returned an error regarding the python runtime: "A Python runtime could be located. You may need to install a framework build of Python, or edit the PyRuntimeLocations array in this application's Info.plist file." After further investigation, it appears that Leopard comes with python 2.5 and Tiger comes with python 2.3. As a result, it was not able to find the python runtime to execute my application. I was under the assumption that py2app is supposed to bundle python all together so that it can run on any machine as a standalone without depending on python being installed on their machine? Am I missing something? Thanks in advance, Patrick -------------- next part -------------- An HTML attachment was scrubbed... URL: From rowen at cesmail.net Sat Aug 2 02:08:46 2008 From: rowen at cesmail.net (Russell E. Owen) Date: Fri, 01 Aug 2008 17:08:46 -0700 Subject: [Pythonmac-SIG] using py2app to include the python interpreter? References: <2b5a48740808011452k697c7f70kf840eea7d89889b4@mail.gmail.com> Message-ID: In article <2b5a48740808011452k697c7f70kf840eea7d89889b4 at mail.gmail.com>, "Patrick Li" wrote: > Hi, > > I just used py2app to bundle my app on Leopard. It works fine on my > computer. However, when I let my friend run the app on his machine that is > running Tiger, it returned an error regarding the python runtime: > > "A Python runtime could be located. You may need to install a framework > build of Python, or edit the PyRuntimeLocations array in this application's > Info.plist file." > > After further investigation, it appears that Leopard comes with python 2.5 > and Tiger comes with python 2.3. As a result, it was not able to find the > python runtime to execute my application. > > I was under the assumption that py2app is supposed to bundle python all > together so that it can run on any machine as a standalone without depending > on python being installed on their machine? Am I missing something? All you have to do is install your own python and use that to run py2app. then py2app will bundle the python in your app. (It will not bundle the system python for various good reasons.) Installing your own python is a good thing to do in any case. You can add and update packages and you can update python without fear of messing up the system. -- Russell From patrick at raptr.com Sat Aug 2 02:47:26 2008 From: patrick at raptr.com (Patrick Li) Date: Fri, 1 Aug 2008 17:47:26 -0700 Subject: [Pythonmac-SIG] using py2app to include the python interpreter? In-Reply-To: References: <2b5a48740808011452k697c7f70kf840eea7d89889b4@mail.gmail.com> Message-ID: <2b5a48740808011747s3850e7e0w1d32d9a63c6b300e@mail.gmail.com> Thanks! It took me further... However, I'm now getting the following error. Do you know what may cause this? *** creating application bundle: Raptr *** copying build/bdist.macosx-10.3-i386/python2.5-standalone/app/site-packages.zip -> /Users/patrickli/client/gxl/trunk/client/src/dist/Raptr.app/Contents/Resources/lib/python2.5 Traceback (most recent call last): File "/Users/patrickli/python/lib/python2.5/site-packages/py2app-0.4.2-py2.5.egg/py2app/build_app.py", line 579, in _run self.run_normal() File "/Users/patrickli/python/lib/python2.5/site-packages/py2app-0.4.2-py2.5.egg/py2app/build_app.py", line 650, in run_normal self.create_binaries(py_files, pkgdirs, extensions, loader_files) File "/Users/patrickli/python/lib/python2.5/site-packages/py2app-0.4.2-py2.5.egg/py2app/build_app.py", line 767, in create_binaries platfiles = mm.run() File "build/bdist.macosx-10.3-i386/egg/macholib/MachOStandalone.py", line 102, in run mm.run_file(fn) File "build/bdist.macosx-10.3-i386/egg/macholib/MachOGraph.py", line 66, in run_file m = self.createNode(MachO, pathname) File "build/bdist.macosx-10.3-i386/egg/macholib/MachOStandalone.py", line 23, in createNode res = super(FilteredMachOGraph, self).createNode(cls, name) File "build/bdist.macosx-10.3-i386/egg/altgraph/ObjectGraph.py", line 148, in createNode m = cls(name, *args, **kw) File "build/bdist.macosx-10.3-i386/egg/macholib/MachO.py", line 61, in __init__ self.load(file(filename, 'rb')) File "build/bdist.macosx-10.3-i386/egg/macholib/MachO.py", line 76, in load self.load_header(fh, 0, size) File "build/bdist.macosx-10.3-i386/egg/macholib/MachO.py", line 106, in load_header hdr = MachOHeader(self, fh, offset, size, magic, hdr, endian) File "build/bdist.macosx-10.3-i386/egg/macholib/MachO.py", line 146, in __init__ self.load(fh) File "build/bdist.macosx-10.3-i386/egg/macholib/MachO.py", line 178, in load raise ValueError("Unknown load command: %d" % (cmd_load.cmd,)) ValueError: Unknown load command: 27 > /Users/patrickli/client/gxl/trunk/client/src/build/bdist.macosx-10.3-i386/egg/macholib/MachO.py(178)load() (Pdb) On Fri, Aug 1, 2008 at 5:08 PM, Russell E. Owen wrote: > In article > <2b5a48740808011452k697c7f70kf840eea7d89889b4 at mail.gmail.com>, > "Patrick Li" wrote: > > > Hi, > > > > I just used py2app to bundle my app on Leopard. It works fine on my > > computer. However, when I let my friend run the app on his machine that > is > > running Tiger, it returned an error regarding the python runtime: > > > > "A Python runtime could be located. You may need to install a framework > > build of Python, or edit the PyRuntimeLocations array in this > application's > > Info.plist file." > > > > After further investigation, it appears that Leopard comes with python > 2.5 > > and Tiger comes with python 2.3. As a result, it was not able to find > the > > python runtime to execute my application. > > > > I was under the assumption that py2app is supposed to bundle python all > > together so that it can run on any machine as a standalone without > depending > > on python being installed on their machine? Am I missing something? > > All you have to do is install your own python and use that to run > py2app. then py2app will bundle the python in your app. (It will not > bundle the system python for various good reasons.) > > Installing your own python is a good thing to do in any case. You can > add and update packages and you can update python without fear of > messing up the system. > > -- Russell > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From georgewr at bigpond.net.au Sat Aug 2 14:28:41 2008 From: georgewr at bigpond.net.au (George Wright) Date: Sat, 2 Aug 2008 22:28:41 +1000 Subject: [Pythonmac-SIG] New Installation of 2.5 In-Reply-To: References: Message-ID: Gidday I have just purchased a new MacBook with OS X 10.5.2 installed. I want to set up a virtualenv with the latest python.org version of 2.5 There has been heaps of discussion on this list about this kind of thing and I doubt If I have read and understood it all. Does anyone have a reference to a simple step by step "how to" for this installation? George Wright georgewr at bigpond.net.au http://mywebsite.bigpond.net.au/georgewr/ http://labyrinth.net.au/~gwright/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From tkpmep at gmail.com Sun Aug 3 04:39:14 2008 From: tkpmep at gmail.com (Thomas Philips) Date: Sat, 2 Aug 2008 22:39:14 -0400 Subject: [Pythonmac-SIG] Teething troubles - Getting up an running on a mac Message-ID: <9fb0d900808021939w2c5819ddo65e319d6ff2f3254@mail.gmail.com> I've got a new iMac, have installed Python 2.5.2 on it, and am now trying to run my existing Python programs on it (these are typically number crunching programs that I run from IDLE). Some things work, while others don't, and as this is my first time grappling with Unix and MacOS X, I appreciate some guidance on how to get up and running. Here are details of my setup interspersed with my woes and my questions. Your assistance is greatly appreciated. Item 1. I downloaded and installed 2.5.2 from python.org. Runs fine, it installed a MacPython directory under applications, which has a few icons, including IDLE. However, I have absolutely NO idea where all the Python files are kept. Question 1: How can I locate the Python installation? There a few files under Applications > MacPython 2.5, but this is clearly not the entire installation. Question 2: In Finder, If I click on Search For > Past week, I can see a sequence of folders under the horizontal scroll bar at the bottom of the window, allowing me to determine that some files that were placed under Applications > MacPython 2.5> Extra> Demo. But I do not seem to be able to see the sequence of folders under the horizontal scroll bar in any finder window. What do I need to do to make the folder sequence visible in all Finder Windows? Item 2. I downloaded and installed the SciPy superpack from Macinscience,org. Scipy seems to import correctly into the Python 2.5.1 that comes with the Mac, but i cannot import it into MacPython 2.5.2. Question 3. What do I have to do in order to make SciPy work with both Python 2.5.1 (that comes with the Mac) and 2.5.2 (that I installed myself)? Item 3. I accidentally clicked on something (not sure what) and suddenly found the path to the numpy folder was Macintosh HD > Developer > SDKs > MacOSX10.5.sdk>System> Library>Frameworks>Python.framework>Versions>2.5>extras>lib>Python>numpy. This is insane!!! Where would the superpack have installed SciPy, and how can I find it? Question 4. How do I get MacPython 2.5.2 to see SciPy, NumPy etc. Question 5. How can I find the current value of the PYTHONPATH environment variable, and how can I edit it and add a directory in which I keep my Python programs. Question 6. Apparently there's a Property List Editor that must be used to create a file called ~ /.MacOSX/environment.plist. I can't find a directory called ~/.MacOSX. Is this a hidden directory? Item 4. I opened a terminal window, and typed ipython. Here's what I got: Welcome to IPython. I will try to create a personal configuration directory where you can customize many aspects of IPython's functionality in: /Users/tom/.ipython WARNING: Installation error. IPython's directory was not found. Check the following: The ipython/IPython directory should be in a directory belonging to your PYTHONPATH environment variable (that is, it should be in a directory belonging to sys.path). You can copy it explicitly there or just link to it. IPython will create a minimal default configuration for you. Ipython actually runs once I hit enter, but I do not seem to be able to import and run my programs. Question 7. What is this cryptic message all about? I'm completely confused. I never thought I'd say this, but it actually seemed a lot easier to get Python and any associated programs up and running on Windows! I suspect that a large fraction of my troubles are due to the fact that I am brand new to the Mac and to Unix, but I bought the Mac in part because I thought that using it was effortless. Thank you in advance for your help. Sincerely Thomas Philips -------------- next part -------------- An HTML attachment was scrubbed... URL: From kw at codebykevin.com Sun Aug 3 16:12:23 2008 From: kw at codebykevin.com (Kevin Walzer) Date: Sun, 03 Aug 2008 10:12:23 -0400 Subject: [Pythonmac-SIG] Teething troubles - Getting up an running on a mac In-Reply-To: <9fb0d900808021939w2c5819ddo65e319d6ff2f3254@mail.gmail.com> References: <9fb0d900808021939w2c5819ddo65e319d6ff2f3254@mail.gmail.com> Message-ID: <4895BCC7.8000008@codebykevin.com> Thomas Philips wrote: > Item 1. I downloaded and installed 2.5.2 from python.org. Runs fine, it > installed a MacPython directory under applications, which has a few icons, > including IDLE. However, I have absolutely NO idea where all the Python > files are kept. /Library/Frameworks/Python > > Question 1: How can I locate the Python installation? There a few files > under Applications > MacPython 2.5, but this is clearly not the entire > installation. Those are just the GUI bits, see above. > > Question 2: In Finder, If I click on Search For > Past week, I can see a > sequence of folders under the horizontal scroll bar at the bottom of the > window, allowing me to determine that some files that were placed under > Applications > MacPython 2.5> Extra> Demo. But I do not seem to be able to > see the sequence of folders under the horizontal scroll bar in any finder > window. What do I need to do to make the folder sequence visible in all > Finder Windows? Finder doesn't work that way--not sure what to tell you. > > > Item 2. I downloaded and installed the SciPy superpack from > Macinscience,org. Scipy seems to import correctly into the Python 2.5.1 that > comes with the Mac, but i cannot import it into MacPython 2.5.2. Looks like it works with the System Python, not the one you installed? > > Question 3. What do I have to do in order to make SciPy work with both > Python 2.5.1 (that comes with the Mac) and 2.5.2 (that I installed myself)? > You can't. They have different library paths. > > Item 3. I accidentally clicked on something (not sure what) and suddenly > found the path to the numpy folder was Macintosh HD > Developer > SDKs > > MacOSX10.5.sdk>System> > Library>Frameworks>Python.framework>Versions>2.5>extras>lib>Python>numpy. > This is insane!!! Where would the superpack have installed SciPy, and how > can I find it? Ask the Macsinscience developers. > > Question 4. How do I get MacPython 2.5.2 to see SciPy, NumPy etc. > Question 5. How can I find the current value of the PYTHONPATH environment > variable, and how can I edit it and add a directory in which I keep my > Python programs. Not sure. Pythonpath is more used on Unix, not on OS X. > Question 6. Apparently there's a Property List Editor that must be used to > create a file called ~ /.MacOSX/environment.plist. I can't find a directory > called ~/.MacOSX. Is this a hidden directory? Yes. > > > Item 4. I opened a terminal window, and typed ipython. Here's what I got: > > Welcome to IPython. I will try to create a personal configuration directory > where you can customize many aspects of IPython's functionality in: > > /Users/tom/.ipython > WARNING: > Installation error. IPython's directory was not found. > > Check the following: > > The ipython/IPython directory should be in a directory belonging to your > PYTHONPATH environment variable (that is, it should be in a directory > belonging to sys.path). You can copy it explicitly there or just link to it. > > IPython will create a minimal default configuration for you. > Ipython actually runs once I hit enter, but I do not seem to be able to > import and run my programs. > > Question 7. What is this cryptic message all about? I'm completely confused. Not sure. Looks like ipython doesn't see Python? > > > I never thought I'd say this, but it actually seemed a lot easier to get > Python and any associated programs up and running on Windows! I suspect that > a large fraction of my troubles are due to the fact that I am brand new to > the Mac and to Unix, but I bought the Mac in part because I thought that > using it was effortless. It isn't the same as Windows and other Unixes, so it's not surprising that you're having some difficulty adjusting to the platform-specific quirks.Once you work through them, things should be smooth. Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com From njriley at uiuc.edu Sun Aug 3 19:10:25 2008 From: njriley at uiuc.edu (Nicholas Riley) Date: Sun, 3 Aug 2008 12:10:25 -0500 Subject: [Pythonmac-SIG] Teething troubles - Getting up an running on a mac In-Reply-To: <4895BCC7.8000008@codebykevin.com> References: <9fb0d900808021939w2c5819ddo65e319d6ff2f3254@mail.gmail.com> <4895BCC7.8000008@codebykevin.com> Message-ID: <20080803171025.GA6745@uiuc.edu> On Sun, Aug 03, 2008 at 10:12:23AM -0400, Kevin Walzer wrote: > >Question 2: In Finder, If I click on Search For > Past week, I can see a > >sequence of folders under the horizontal scroll bar at the bottom of the > >window, allowing me to determine that some files that were placed under > >Applications > MacPython 2.5> Extra> Demo. But I do not seem to be able to > >see the sequence of folders under the horizontal scroll bar in any finder > >window. What do I need to do to make the folder sequence visible in all > >Finder Windows? > > Finder doesn't work that way--not sure what to tell you. Actually, this isn't the case in Leopard - you can use View > Show Path Bar to turn it on. (However, this uses way too much screen space for me - I find it easier to Command-click - or, also new in Leopard, right-click - on the window title.) -- Nicholas Riley | From vivacarlie at gmail.com Sun Aug 3 22:48:43 2008 From: vivacarlie at gmail.com (Nehemiah Dacres) Date: Sun, 3 Aug 2008 15:48:43 -0500 Subject: [Pythonmac-SIG] Teething troubles - Getting up an running on a mac In-Reply-To: <4895BCC7.8000008@codebykevin.com> References: <9fb0d900808021939w2c5819ddo65e319d6ff2f3254@mail.gmail.com> <4895BCC7.8000008@codebykevin.com> Message-ID: <65fadfc30808031348q1f445469o6aaef40e302d474d@mail.gmail.com> > > > >> Question 3. What do I have to do in order to make SciPy work with both >> Python 2.5.1 (that comes with the Mac) and 2.5.2 (that I installed >> myself)? >> >> You can't. They have different library paths. hmm, I wouldn't say that You probiblly shouldln't have even bothered with installing 5,2 im not sure what the improvements are but the system python has a perfectly fine terminal interface. juset pick one. python packages installed via the installer now install for system python becasue thats what ran the "setup.py" script > > Item 3. I accidentally clicked on something (not sure what) and suddenly > found the path to the numpy folder was Macintosh HD > Developer > SDKs > > MacOSX10.5.sdk>System> > Library>Frameworks>Python.framework>Versions>2.5>extras>lib>Python>numpy. > This is insane!!! Where would the superpack have installed SciPy, and how > can I find it? > Ask the Macsinscience developers. have you actually checked the documentation on SciPy, try looking in /Library/Python/site-packages or everything else listed by python >>> import sys >>> print sys.path that lists everything in pythonpath. also, if you want to include any other files, just drop them in one of those directories or put symlinks(or aliases aka shortcuts) to them in one of those folders. > > >> Question 4. How do I get MacPython 2.5.2 to see SciPy, NumPy etc. >> Question 5. How can I find the current value of the PYTHONPATH environment >> variable, and how can I edit it and add a directory in which I keep my >> Python programs. >> > > Not sure. Pythonpath is more used on Unix, not on OS X. > like i said, drop them in one of the site-packagees directories or put links to them from those directories. otherwise, in your shell's environment (did u even google this? google : "edit mac path or environmen") or edit the envrionmental plist or better yet, theres a free GUI tool to do that, http://www.rubicode.com/Software/RCEnvironment/ > > >> >> Item 4. I opened a terminal window, and typed ipython. Here's what I got: >> >> Welcome to IPython. I will try to create a personal configuration >> directory >> where you can customize many aspects of IPython's functionality in: > > or perhaps you never installed iPython, Why r u using this? > > > I never thought I'd say this, but it actually seemed a lot easier to get > Python and any associated programs up and running on Windows! I suspect > that > a large fraction of my troubles are due to the fact that I am brand new to > the Mac and to Unix, but I bought the Mac in part because I thought that > using it was effortless. > It isn't the same as Windows and other Unixes, so it's not surprising that > you're having some difficulty adjusting to the platform-specific quirks.Once > you work through them, things should be smooth. > > DIDO, you want a GUI inviornment in a unix python world, now that macs are unix, you can have a unix python which is much less intrusive. If you keep using IDLE instead of ipython and realize you dont have to install more python, you'll be fine. I realize I'm a cs major not a mathmatition or scientist so i use it differently but I do all my programming as scripts and then execute them, i only use it interactively when I want to test something out. Otherwise, have u looked at R? http://www.r-project.org/ -- "lalalalala! it's not broken because I can use it" http://linux.slashdot.org/comments.pl?sid=194281&threshold=1&commentsort=0&mode=thread&cid=15927703 -------------- next part -------------- An HTML attachment was scrubbed... URL: From georgewr at bigpond.net.au Mon Aug 4 00:43:28 2008 From: georgewr at bigpond.net.au (George Wright) Date: Mon, 4 Aug 2008 08:43:28 +1000 Subject: [Pythonmac-SIG] New Installation of 2.5 In-Reply-To: <65fadfc30808021618k3af4c79rfeafecf8a29dc50d@mail.gmail.com> References: <65fadfc30808021618k3af4c79rfeafecf8a29dc50d@mail.gmail.com> Message-ID: On 03/08/2008, at 9:18 AM, Nehemiah Dacres wrote: > r u talking about sandboxing? thats a little difficult, apple > didn't provide much documentation on that. there's 3rd party > documentation here > http://www.318.com/techjournal/?p=107 > Well no. Just a simple installation of python.org 2.5.2 behind a virtualenv See for example these threads: [Pythonmac-SIG] newbie Mac switcher trying to set up django on Intel MacBook Pro Tiger [Pythonmac-SIG] non-framework Python 2.5.2 has empty lib-dynload Re: [Pythonmac-SIG] problems with sys.path Re: [Pythonmac-SIG] Leopard easy_install chokes on appscript egg and maybe others > or are u refering to this http://mail.python.org/pipermail/python- > dev/2006-July/067046.html > that i referenced from here (do a string search for sandboxing) > http://old.itconnection.ru/pipermail/zopyrus/2006-August/083936.html > > > On Sat, Aug 2, 2008 at 7:28 AM, George Wright > wrote: > Gidday > I have just purchased a new MacBook with OS X 10.5.2 installed. Actually the preinstalled is 2.5.1 - just a typo sorry. > I want to set up a virtualenv with the latest python.org version of > 2.5 > There has been heaps of discussion on this list about this kind of > thing and I doubt If I have > read and understood it all. > Does anyone have a reference to a simple step by step "how to" for > this installation? > George Wright georgewr at bigpond.net.au http://mywebsite.bigpond.net.au/georgewr/ http://labyrinth.net.au/~gwright/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From santagada at gmail.com Mon Aug 4 04:12:11 2008 From: santagada at gmail.com (Leonardo Santagada) Date: Sun, 3 Aug 2008 23:12:11 -0300 Subject: [Pythonmac-SIG] [py2app] problems running .app built on 10.5 on standard 10.4 In-Reply-To: <4E286598-0A14-4782-A0E9-4ACC985F3650@mac.com> References: <1de4b0f00807310649s2b377f55pb17f7eb457cf948d@mail.gmail.com> <4891E972.3010107@noaa.gov> <4E286598-0A14-4782-A0E9-4ACC985F3650@mac.com> Message-ID: <1A8CBC9C-C904-462E-8D3A-5F6960F98843@gmail.com> On 31/07/2008, at 17:40, Mike Covill wrote: > On 31-Jul-08, at 12:33 PM, Christopher Barker wrote: > >> Mike Keith wrote: >>> are my problems down to the fact that i'm using apple's python 2.5 >>> to >>> build the .app? >> >> yes. >> >>> if so, any advice on how to proceed? >> >> Install the python.org python ,and use that to built your app -- it >> should then run on all systems >= 10.3.9 >> >> -Chris >> > > > Corollary to installing python.org python (currently 2.5.2, I > believe), how can I install and use the PyObjC version 2.0 for > Leopard packages? I have tried downloading the subversion copy of > PyObjC at "http://svn.red-bean.com/pyobjc/trunk" and the script > inside pyobjc fails (02-develop-all.sh). Is this script working for > everyone else? > > Any hints would be appreciated, thanks. I would like to know this, and if anything else is going to stop working how to fix it. Leopard's default python has support for Instruments right? Is this supported on python.org build? -- Leonardo Santagada From the_shelter at yahoo.com Mon Aug 4 18:45:46 2008 From: the_shelter at yahoo.com (the Shelter) Date: Mon, 4 Aug 2008 09:45:46 -0700 (PDT) Subject: [Pythonmac-SIG] py2app- python code packed in clear ascii Message-ID: <656617.10764.qm@web56306.mail.re3.yahoo.com> Hi, after a lot of python programming on linux and windows I have now taken up the task of converting/ adapting my apps (python/wxPython) to the mac. I tried to bundle my apps w/ py2app but had to find out that it seems like it packs my sources in clear ascii and not in binary form- somewhat unusual after having worked w/ py2exe ... Am I missing something? Right now I am on 10.4 w/ latest python and py2app- all from python.org- not the Apple versions. thanX From Chris.Barker at noaa.gov Mon Aug 4 20:53:52 2008 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Mon, 04 Aug 2008 11:53:52 -0700 Subject: [Pythonmac-SIG] using py2app to include the python interpreter? In-Reply-To: <2b5a48740808011747s3850e7e0w1d32d9a63c6b300e@mail.gmail.com> References: <2b5a48740808011452k697c7f70kf840eea7d89889b4@mail.gmail.com> <2b5a48740808011747s3850e7e0w1d32d9a63c6b300e@mail.gmail.com> Message-ID: <48975040.2010403@noaa.gov> Patrick Li wrote: > Thanks! It took me further... However, I'm now getting the following > error. Do you know what may cause this? > File "build/bdist.macosx-10.3-i386/egg/macholib/MachO.py", line 178, > in load > raise ValueError("Unknown load command: %d" % (cmd_load.cmd,)) > ValueError: Unknown load command: 27 I think you need a newer macholib. I had hoped the would be updated in the latest release version, but I guess not. try: $ easy_install macholib==dev -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 Chris.Barker at noaa.gov Mon Aug 4 20:59:51 2008 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Mon, 04 Aug 2008 11:59:51 -0700 Subject: [Pythonmac-SIG] New Installation of 2.5 In-Reply-To: References: Message-ID: <489751A7.1080909@noaa.gov> George Wright wrote: > Does anyone have a reference to a simple step by step "how to" for this > installation? just got to python.,org, and download and install the 2.5.2 *.pkg. Then make sure that any other packages you install are built for that version. There are some here: http://pythonmac.org/packages/py25-fat/index.html Though that's not being maintained well at this point :-( The other option is to build from source: $ python setup.py build $ sudo python setup.py install Which works with many packages. You do need to have the developer tools installed for this to work with C-coded extensions. setuptools also often works: $ easy_install ThePackageName -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 Chris.Barker at noaa.gov Mon Aug 4 21:15:36 2008 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Mon, 04 Aug 2008 12:15:36 -0700 Subject: [Pythonmac-SIG] Teething troubles - Getting up an running on a mac In-Reply-To: <4895BCC7.8000008@codebykevin.com> References: <9fb0d900808021939w2c5819ddo65e319d6ff2f3254@mail.gmail.com> <4895BCC7.8000008@codebykevin.com> Message-ID: <48975558.9040002@noaa.gov> Kevin Walzer wrote: >> Item 2. I downloaded and installed the SciPy superpack from >> Macinscience,org. Scipy seems to import correctly into the Python >> 2.5.1 that >> comes with the Mac, but i cannot import it into MacPython 2.5.2. > > Looks like it works with the System Python, not the one you installed? The Superpack is supposed to install into either one. I think the key is to make sure that MacPython is the default one on your path before installing the superpack. What do you get if you type: $ which python At the command line? I get: /Library/Frameworks/Python.framework/Versions/Current/bin/python which is python.org python. You can also try: >>> import datetime >>> datetime.__file__ '/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-dynload/datetime.so' to see which python you are running -- the above is from python.org python >> Question 3. What do I have to do in order to make SciPy work with both >> Python 2.5.1 (that comes with the Mac) and 2.5.2 (that I installed >> myself)? You may be able to install it in both places, but that can get ugly -- just choose one (and if you listen to me, you'll choose python.org version) >> Item 3. I accidentally clicked on something (not sure what) and suddenly >> found the path to the numpy folder was Macintosh HD > Developer > SDKs > >> MacOSX10.5.sdk>System> >> Library>Frameworks>Python.framework>Versions>2.5>extras>lib>Python>numpy. >> This is insane!!! It does seem so, but that may be their trick to get it seen by either version. wxPython installs into /usr/local/lib/, so that both pythons can see it. Another option is to check out the Enthought Python Distribution. I haven't tried it yet, but there is a lot of nice stuff in there. >> Question 4. How do I get MacPython 2.5.2 to see SciPy, NumPy etc. >> Question 5. How can I find the current value of the PYTHONPATH >> environment variable, echo $PYTHONPATH >> and how can I edit it and add a directory in which I keep my >> Python programs. change it in your .profile folder. However, I have never needed to use it -- are you sure you do? If you have a bunch of your own pacakges, you might want to install them with: easy_install develop which seems less fragile than PYTHONPATH. >> Question 6. Apparently there's a Property List Editor that must be >> used to >> create a file called ~ /.MacOSX/environment.plist. I can't find a >> directory I've never gotten this to work, but you're right, that's supposed to be how you can set an environment variable that will be seen everywhere, even outside of a login shell. >> called ~/.MacOSX. Is this a hidden directory? I recommend you figure out how to set the Finder to show hidden files -- it's really handy. I did it with a utility called "Tinker Tool" or something like that. >> I never thought I'd say this, but it actually seemed a lot easier to get >> Python and any associated programs up and running on Windows! > It isn't the same as Windows and other Unixes, so it's not surprising > that you're having some difficulty adjusting to the platform-specific > quirks.Once you work through them, things should be smooth. Yes, but it really is a lot harder -- why? because There are WAY TOO MANY ways to get Python on the Mac. Almost everyone uses python.org on Windows (with a few using ActiveState, though they are very compatible), so that's what you do and you're done. On the Mac, there is Apple's python, python.org's, fink, macports, build-your-own, ..... Then you have PPC, and Intel, and it's really a mess. Can't we all just agree on using the python.org one? Oh well, -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 mcovill at mac.com Tue Aug 5 14:08:53 2008 From: mcovill at mac.com (Mike Covill) Date: Tue, 5 Aug 2008 08:08:53 -0400 Subject: [Pythonmac-SIG] py2app- python code packed in clear ascii In-Reply-To: <656617.10764.qm@web56306.mail.re3.yahoo.com> References: <656617.10764.qm@web56306.mail.re3.yahoo.com> Message-ID: the shelter, The last time I built an app bundle, the only source file from my code in plain ascii was my main.py file. Everything else was precompiled and zipped up in a sub-folder. So the strategy to hide all source code was to create a main.py file which simply imports another file containing what used to be in the main.py file, and run it from there. Here are some py2app resources I found useful: http://svn.pythonmac.org/py2app/py2app/trunk/doc/index.html http://undefined.org/python/py2app.html Mike On 4-Aug-08, at 12:45 PM, the Shelter wrote: > Hi, > > after a lot of python programming on linux and windows I have now > taken up the task of converting/ adapting my apps (python/wxPython) > to the mac. > I tried to bundle my apps w/ py2app but had to find out that it > seems like it packs my sources in clear ascii and not in binary > form- somewhat unusual after having worked w/ py2exe ... > > Am I missing something? > > Right now I am on 10.4 w/ latest python and py2app- all from > python.org- not the Apple versions. > > thanX > > > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig From noboru.yamamoto at kek.jp Wed Aug 6 08:48:57 2008 From: noboru.yamamoto at kek.jp (Noboru Yamamoto) Date: Wed, 06 Aug 2008 15:48:57 +0900 Subject: [Pythonmac-SIG] py access to speech synth? In-Reply-To: References: Message-ID: <48994959.5050808@kek.jp> Hi David, > Hello all, > > Does anyone know whether there's any work being done on a python > interface to the OSX speech synthesiser? > > thanks, > > ________________________________________________ > David Worrall. I wrote the macspeechX.py for MacOSX sometime before. You can just replace macspeech.py for Mac OS. I just test it with python 2.4/2.5 and it uses ctype module to access system library. You should be able to find the code at: http://www-acc.kek.jp/WWW-ACC-exp/KEKB/control/member/N.Yamamoto/Python/macspeech/macspeechX.py If you have problem to get the source code, please let me know. Thanks. Noboru From anjiro at cc.gatech.edu Wed Aug 6 20:43:16 2008 From: anjiro at cc.gatech.edu (Daniel Ashbrook) Date: Wed, 06 Aug 2008 14:43:16 -0400 Subject: [Pythonmac-SIG] including python interpreter window? Message-ID: <4899F0C4.5090801@cc.gatech.edu> I've done some searching but can't exactly figure out how to do this. How can I include a menu item or somesuch that will bring up a live python interpreter window in my PyObjC app? I've seen the examples of injecting a python interpreter into a running app, but I want to build in the functionality (it seems like it would be awesome for debugging), and I think somewhere I saw a comment from Bob that it wouldn't work for PyObjC apps anyway... Thanks for any help, dan From mattjomeara at gmail.com Wed Aug 6 22:37:47 2008 From: mattjomeara at gmail.com (Matthew O'Meara) Date: Wed, 6 Aug 2008 16:37:47 -0400 Subject: [Pythonmac-SIG] module 'New' no in MacPython? Message-ID: Hi I'm trying to port a swig based application to run on OSX. But it seems that MacPython does not build the module 'New' by default (upon which Swig depends)? Can someone confirm that this is the case and or comment on it's status in past/current/future releases? Thanks, Matt From Chris.Barker at noaa.gov Wed Aug 6 22:43:44 2008 From: Chris.Barker at noaa.gov (Chris Barker) Date: Wed, 06 Aug 2008 13:43:44 -0700 Subject: [Pythonmac-SIG] module 'New' no in MacPython? In-Reply-To: References: Message-ID: <489A0D00.70608@noaa.gov> Matthew O'Meara wrote: > I'm trying to port a swig based application to run on OSX. But it > seems that MacPython does not build the module 'New' by default I haven't had any issues with SWIG on OS-X. I also have no idea what the module "New" is. Can you be more specific as to what exactly you are doing, and what errors you get? You also may want to try on the SWIG list. -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 mattjomeara at gmail.com Wed Aug 6 23:46:30 2008 From: mattjomeara at gmail.com (Matthew O'Meara) Date: Wed, 6 Aug 2008 17:46:30 -0400 Subject: [Pythonmac-SIG] module 'New' no in MacPython? In-Reply-To: <489A0D00.70608@noaa.gov> References: <489A0D00.70608@noaa.gov> Message-ID: Thanks for your quick response, It seems like the issue is due to running python in an X11 terminal. It seems to run fine through Terminal. I don't know if I'll dig into the problem, but that at least gives me somewhere to look first. Thanks again, Matt On Wed, Aug 6, 2008 at 4:43 PM, Chris Barker wrote: > Matthew O'Meara wrote: >> >> I'm trying to port a swig based application to run on OSX. But it >> seems that MacPython does not build the module 'New' by default > > I haven't had any issues with SWIG on OS-X. I also have no idea what the > module "New" is. Can you be more specific as to what exactly you are doing, > and what errors you get? > > You also may want to try on the SWIG list. > > -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 > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > From janssen at parc.com Thu Aug 7 06:10:05 2008 From: janssen at parc.com (Bill Janssen) Date: Wed, 6 Aug 2008 21:10:05 PDT Subject: [Pythonmac-SIG] module 'New' no in MacPython? In-Reply-To: References: Message-ID: <08Aug6.211010pdt."58698"@synergy1.parc.xerox.com> There is a Python standard library module called "new", and the Mac filesystem is case-insensitive... Try doing % touch new % touch New % ls Bill From pascal.bompard at gmail.com Thu Aug 7 15:34:27 2008 From: pascal.bompard at gmail.com (Pascal Bompard) Date: Thu, 7 Aug 2008 21:34:27 +0800 Subject: [Pythonmac-SIG] Yet another problem with path In-Reply-To: <487BA49E.4000206@noaa.gov> References: <7FCB2300-D7D7-4205-87CB-62014F590F85@gmail.com> <487AAC30.2080808@codebykevin.com> <6FFC88EC-39E1-4A18-8D71-5ED6206094B6@gmail.com> <487AB0D4.6080607@codebykevin.com> <0EFC7A38-5599-460C-99F9-2A0FD59C59BA@gmail.com> <487BA49E.4000206@noaa.gov> Message-ID: Returning to this 3 week old chestnut, (apologies for delay - my second child was born in the interim), and thanks to all who attempted to help, but I am still struggling with this issue. > Christopher Barker wrote: > If you have scripts you want to run from anywhere, make them > executable: This is exactly what I need to occur with this particular script > chmod a+x MyScript.py permissions are set to 755 (i.e. full permissions) > and put: #!usr/bin/env python at the top. yes, that is in place > Then either: > > put them in a standard place that should be on your PATH, like: > > /usr/local/bin > > or put the path to your scripts in your PATH -- often people use: > > ~/bin I actually have this in my PATH, /Users/pascal/Documents/Python/Dev/myapp and with all the above I get: Administrator:~ pascal$ python test.py /System/Library/Frameworks/Python.framework/Versions/2.5/Resources/ Python.app/Contents/MacOS/Python: can't open file 'test.py': [Errno 2] No such file or directory whereas calling the script from within it's parent directory does work. What could I possibly be doing wrong here? > do buy a book or surf the web for info about using the terminal on > OS-X -- it's a great skill to have. You're right. I have recently acquired a great book called "From Bash to Z-Shell", but it's tough to retain all the tricks when I use the terminal so seldom. > -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 > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig From mcovill at mac.com Thu Aug 7 15:45:57 2008 From: mcovill at mac.com (Mike Covill) Date: Thu, 7 Aug 2008 09:45:57 -0400 Subject: [Pythonmac-SIG] Yet another problem with path In-Reply-To: References: <7FCB2300-D7D7-4205-87CB-62014F590F85@gmail.com> <487AAC30.2080808@codebykevin.com> <6FFC88EC-39E1-4A18-8D71-5ED6206094B6@gmail.com> <487AB0D4.6080607@codebykevin.com> <0EFC7A38-5599-460C-99F9-2A0FD59C59BA@gmail.com> <487BA49E.4000206@noaa.gov> Message-ID: On 7-Aug-08, at 9:34 AM, Pascal Bompard wrote: > Returning to this 3 week old chestnut, (apologies for delay - my > second child was born in the interim), and thanks to all who > attempted to help, but I am still struggling with this issue. > >> Christopher Barker wrote: >> If you have scripts you want to run from anywhere, make them >> executable: > > This is exactly what I need to occur with this particular script > >> chmod a+x MyScript.py > > permissions are set to 755 (i.e. full permissions) > >> and put: #!usr/bin/env python at the top. > > yes, that is in place > >> Then either: >> >> put them in a standard place that should be on your PATH, like: >> >> /usr/local/bin >> >> or put the path to your scripts in your PATH -- often people use: >> >> ~/bin > > I actually have this in my PATH, > /Users/pascal/Documents/Python/Dev/myapp > > and with all the above I get: > > Administrator:~ pascal$ python test.py > /System/Library/Frameworks/Python.framework/Versions/2.5/Resources/ > Python.app/Contents/MacOS/Python: can't open file 'test.py': [Errno > 2] No such file or directory > > whereas calling the script from within it's parent directory does > work. > > What could I possibly be doing wrong here? Your PATH is only used to find the executable (python), not the document (test.py). The document must include either the relative path from where you are, or the absolute path. Mike > > >> do buy a book or surf the web for info about using the terminal on >> OS-X -- it's a great skill to have. > > You're right. I have recently acquired a great book called "From > Bash to Z-Shell", but it's tough to retain all the tricks when I use > the terminal so seldom. > > > >> -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 >> _______________________________________________ >> Pythonmac-SIG maillist - Pythonmac-SIG at python.org >> http://mail.python.org/mailman/listinfo/pythonmac-sig > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig From mcovill at mac.com Thu Aug 7 15:58:26 2008 From: mcovill at mac.com (Mike Covill) Date: Thu, 7 Aug 2008 09:58:26 -0400 Subject: [Pythonmac-SIG] Yet another problem with path In-Reply-To: References: <7FCB2300-D7D7-4205-87CB-62014F590F85@gmail.com> <487AAC30.2080808@codebykevin.com> <6FFC88EC-39E1-4A18-8D71-5ED6206094B6@gmail.com> <487AB0D4.6080607@codebykevin.com> <0EFC7A38-5599-460C-99F9-2A0FD59C59BA@gmail.com> <487BA49E.4000206@noaa.gov> Message-ID: On 7-Aug-08, at 9:45 AM, Mike Covill wrote: > On 7-Aug-08, at 9:34 AM, Pascal Bompard wrote: > >> Returning to this 3 week old chestnut, (apologies for delay - my >> second child was born in the interim), and thanks to all who >> attempted to help, but I am still struggling with this issue. >> >>> Christopher Barker wrote: >>> If you have scripts you want to run from anywhere, make them >>> executable: >> >> This is exactly what I need to occur with this particular script >> >>> chmod a+x MyScript.py >> >> permissions are set to 755 (i.e. full permissions) >> >>> and put: #!usr/bin/env python at the top. >> >> yes, that is in place >> >>> Then either: >>> >>> put them in a standard place that should be on your PATH, like: >>> >>> /usr/local/bin >>> >>> or put the path to your scripts in your PATH -- often people use: >>> >>> ~/bin >> >> I actually have this in my PATH, >> /Users/pascal/Documents/Python/Dev/myapp >> >> and with all the above I get: >> >> Administrator:~ pascal$ python test.py >> /System/Library/Frameworks/Python.framework/Versions/2.5/Resources/ >> Python.app/Contents/MacOS/Python: can't open file 'test.py': [Errno >> 2] No such file or directory >> >> whereas calling the script from within it's parent directory does >> work. >> >> What could I possibly be doing wrong here? > > Your PATH is only used to find the executable (python), not the > document (test.py). The document must include either the relative > path from where you are, or the absolute path. You should be able to execute your script by typing just your script name from anywhere, leave out "python": Administrator:~ pascal$ test.py in this case test.py is the 'executable', and your system will look for it using your PATH setting. Mike > >> >> >>> do buy a book or surf the web for info about using the terminal on >>> OS-X -- it's a great skill to have. >> >> You're right. I have recently acquired a great book called "From >> Bash to Z-Shell", but it's tough to retain all the tricks when I >> use the terminal so seldom. >> >> >> >>> -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 >>> _______________________________________________ >>> Pythonmac-SIG maillist - Pythonmac-SIG at python.org >>> http://mail.python.org/mailman/listinfo/pythonmac-sig >> >> _______________________________________________ >> Pythonmac-SIG maillist - Pythonmac-SIG at python.org >> http://mail.python.org/mailman/listinfo/pythonmac-sig > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig From Chris.Barker at noaa.gov Thu Aug 7 18:17:16 2008 From: Chris.Barker at noaa.gov (Chris Barker) Date: Thu, 07 Aug 2008 09:17:16 -0700 Subject: [Pythonmac-SIG] module 'New' no in MacPython? In-Reply-To: <08Aug6.211010pdt.58698@synergy1.parc.xerox.com> References: <08Aug6.211010pdt.58698@synergy1.parc.xerox.com> Message-ID: <489B200C.4020607@noaa.gov> Bill Janssen wrote: > There is a Python standard library module called "new", and the Mac > filesystem is case-insensitive... Try doing > > % touch new > % touch New > % ls case-insensitive, yet case-preserving -- weird. apparently the case preserving does effect *nix apps like python. You can: import new but not: import New but if it's called "new" on other systems, why was the OP having problems? Matthew O'Meara wrote: > Thanks for your quick response, It seems like the issue is due to > running python in an X11 terminal. It seems to run fine through > Terminal. I don't know if I'll dig into the problem, but that at > least gives me somewhere to look first. Are you sure you're running the same python from the X11 terminal as from Terminal? is your PATH the same? Have you installed fink, macports, or some other python? -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 timothy.grant at gmail.com Thu Aug 7 18:28:44 2008 From: timothy.grant at gmail.com (Timothy Grant) Date: Thu, 7 Aug 2008 09:28:44 -0700 Subject: [Pythonmac-SIG] Yet another problem with path In-Reply-To: References: <7FCB2300-D7D7-4205-87CB-62014F590F85@gmail.com> <487AAC30.2080808@codebykevin.com> <6FFC88EC-39E1-4A18-8D71-5ED6206094B6@gmail.com> <487AB0D4.6080607@codebykevin.com> <0EFC7A38-5599-460C-99F9-2A0FD59C59BA@gmail.com> <487BA49E.4000206@noaa.gov> Message-ID: On Thu, Aug 7, 2008 at 6:58 AM, Mike Covill wrote: > > On 7-Aug-08, at 9:45 AM, Mike Covill wrote: > >> On 7-Aug-08, at 9:34 AM, Pascal Bompard wrote: >> >>> Returning to this 3 week old chestnut, (apologies for delay - my second >>> child was born in the interim), and thanks to all who attempted to help, but >>> I am still struggling with this issue. >>> >>>> Christopher Barker wrote: >>>> If you have scripts you want to run from anywhere, make them executable: >>> >>> This is exactly what I need to occur with this particular script >>> >>>> chmod a+x MyScript.py >>> >>> permissions are set to 755 (i.e. full permissions) >>> >>>> and put: #!usr/bin/env python at the top. >>> >>> yes, that is in place >>> >>>> Then either: >>>> >>>> put them in a standard place that should be on your PATH, like: >>>> >>>> /usr/local/bin >>>> >>>> or put the path to your scripts in your PATH -- often people use: >>>> >>>> ~/bin >>> >>> I actually have this in my PATH, >>> /Users/pascal/Documents/Python/Dev/myapp >>> >>> and with all the above I get: >>> >>> Administrator:~ pascal$ python test.py >>> >>> /System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python: >>> can't open file 'test.py': [Errno 2] No such file or directory >>> >>> whereas calling the script from within it's parent directory does work. >>> >>> What could I possibly be doing wrong here? >> >> Your PATH is only used to find the executable (python), not the document >> (test.py). The document must include either the relative path from where >> you are, or the absolute path. > > You should be able to execute your script by typing just your script name > from anywhere, leave out "python": > > Administrator:~ pascal$ test.py > > in this case test.py is the 'executable', and your system will look for it > using your PATH setting. > > Mike > >> >>> >>> >>>> do buy a book or surf the web for info about using the terminal on OS-X >>>> -- it's a great skill to have. >>> >>> You're right. I have recently acquired a great book called "From Bash to >>> Z-Shell", but it's tough to retain all the tricks when I use the terminal so >>> seldom. While command lines can be made to lie, it concerns me that it looks like you're using and Administrator account to do all this work. Administrators have far to much power and can do far too much damage far too quickly. Especially if you're writing code that might manipulate any files, I would strongly encourage you to use a regular user account for doing your real work and only log in as an administrator when required. Of course if the command line was lying about the type of account you're using completely ignore the previous paragraph. -- Stand Fast, tjg. [Timothy Grant] From Chris.Barker at noaa.gov Thu Aug 7 18:48:51 2008 From: Chris.Barker at noaa.gov (Chris Barker) Date: Thu, 07 Aug 2008 09:48:51 -0700 Subject: [Pythonmac-SIG] Yet another problem with path In-Reply-To: References: <7FCB2300-D7D7-4205-87CB-62014F590F85@gmail.com> <487AAC30.2080808@codebykevin.com> <6FFC88EC-39E1-4A18-8D71-5ED6206094B6@gmail.com> <487AB0D4.6080607@codebykevin.com> <0EFC7A38-5599-460C-99F9-2A0FD59C59BA@gmail.com> <487BA49E.4000206@noaa.gov> Message-ID: <489B2773.3070103@noaa.gov> Timothy Grant wrote: > While command lines can be made to lie, it concerns me that it looks > like you're using and Administrator account to do all this work. > Administrators have far to much power and can do far too much damage > far too quickly. very true. However, OS-X be default does not allow anyone to log in as root. An "Administrator" is someone that is allowed to use sudo to do administrative tasks, so he's probably safe. Do be careful with sudo though! -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 timothy.grant at gmail.com Thu Aug 7 20:27:11 2008 From: timothy.grant at gmail.com (Timothy Grant) Date: Thu, 7 Aug 2008 11:27:11 -0700 Subject: [Pythonmac-SIG] Yet another problem with path In-Reply-To: <489B2773.3070103@noaa.gov> References: <7FCB2300-D7D7-4205-87CB-62014F590F85@gmail.com> <6FFC88EC-39E1-4A18-8D71-5ED6206094B6@gmail.com> <487AB0D4.6080607@codebykevin.com> <0EFC7A38-5599-460C-99F9-2A0FD59C59BA@gmail.com> <487BA49E.4000206@noaa.gov> <489B2773.3070103@noaa.gov> Message-ID: On Thu, Aug 7, 2008 at 9:48 AM, Chris Barker wrote: > Timothy Grant wrote: > >> While command lines can be made to lie, it concerns me that it looks >> like you're using and Administrator account to do all this work. >> Administrators have far to much power and can do far too much damage >> far too quickly. > > very true. However, OS-X be default does not allow anyone to log in as root. > An "Administrator" is someone that is allowed to use sudo to do > administrative tasks, so he's probably safe. > > Do be careful with sudo though! > > -Chris Wow Chris, I've been using this PowerBook for nigh-unto four years now, vast quantities of that time at the command prompt and I didn't know that (I thought they were synonymous). Thank you for teaching me something new. -- Stand Fast, tjg. [Timothy Grant] From christopher.e.kees at usace.army.mil Thu Aug 7 20:16:10 2008 From: christopher.e.kees at usace.army.mil (Chris Kees) Date: Thu, 7 Aug 2008 13:16:10 -0500 Subject: [Pythonmac-SIG] python 2.6 trunk Message-ID: <74320681-2C94-40E2-B1C9-6A5327B8FF92@usace.army.mil> Hi, I'm trying to rebuild my 4-way universal framework build of python 2.6 using the latest revision in the trunk. I got a compile error due to a redefinition of FSIORefNum in some of the Mac/Modules files (see svn diff output at end of email). After changing that, I still get a problem running 'make test' at 'test_array'. My machine starts grinding away and the resident memory of the python process goes through the roof. I went ahead and tried 'make install' anyway, and got the problem below, which looks like a simple error in a config file. Has anybody seen these problems or have any suggestions? I may just need to roll it back to Ronald's revision (63955), but I thought I would try a more recent version. Thanks, Chris python-trunk/build: arch -386 -ppc ../python.exe ../../Mac/scripts/ cachersrc.py -v /Library/Frameworks/Python64.framework/Versions/2.6/ lib/python2.6/plat-mac /Library/Frameworks/Python64.framework/Versions/ 2.6/Mac/Tools arch: Unknown architecture: 386 Index: Mac/Modules/MacOS.c =================================================================== --- Mac/Modules/MacOS.c (revision 65574) +++ Mac/Modules/MacOS.c (working copy) @@ -30,10 +30,6 @@ #include #include -#ifndef HAVE_MACOS105_SDK -typedef SInt16 FSIORefNum; -#endif - static PyObject *MacOS_Error; /* Exception MacOS.Error */ #define PATHNAMELEN 1024 Index: Mac/Modules/file/_Filemodule.c =================================================================== --- Mac/Modules/file/_Filemodule.c (revision 65574) +++ Mac/Modules/file/_Filemodule.c (working copy) @@ -7,10 +7,6 @@ #include "pymactoolbox.h" -#ifndef HAVE_MACOS105_SDK -typedef SInt16 FSIORefNum; -#endif - /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ PyErr_SetString(PyExc_NotImplementedError, \ From xkenneth at gmail.com Thu Aug 7 21:32:44 2008 From: xkenneth at gmail.com (Kenneth Miller) Date: Thu, 7 Aug 2008 14:32:44 -0500 Subject: [Pythonmac-SIG] LXML with py2app Message-ID: Has anyone had success with this? This is what I'm encountering. Here i printed the sys.path, why does this include modules local to the machine? I want it to be independent of any local resources? 8/7/08 2:22:55 PM ['/Users/xkenneth/work/mwdconfig/tkpyro/dist/ MWDConfig.app/Contents/Resources', '/Users/xkenneth/work/mwdconfig/ tkpyro/dist/MWDConfig.app/Contents/Resources', '/System/Library/ Frameworks/Python.framework/Versions/2.5/lib/python25.zip', '/System/ Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5', '/ System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/ 2.5/lib/python2.5/plat-mac', '/System/Library/Frameworks/ Python.framework/Versions/2.5/lib/python2.5/plat-mac/lib- scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/ 2.5/Extras/lib/python', '/System/Library/Frameworks/Python.framework/ Versions/2.5/lib/python2.5/lib-tk', '/System/Library/Frameworks/ Python.framework/Versions/2.5/lib/python2.5/lib-dynload', '/Users/ xkenneth/work/mwdconfig/tkpyro/dist/MWDConfig.app/Contents/Resources/ lib/python2.5/site-packages.zip', '/Users/xkenneth/work/mwdconfig/ tkpyro/dist/MWDConfig.app/Contents/Resources/Python/site-packages'] [0x0-0x59059].org.pythonmac.unspecified.MWDConfig[1483] Here's the traceback of the error. 8/7/08 2:22:55 PM Traceback (most recent call last): [0x0-0x59059].org.pythonmac.unspecified.MWDConfig[1483] 8/7/08 2:22:55 PM File "/Users/xkenneth/work/mwdconfig/tkpyro/dist/ MWDConfig.app/Contents/Resources/__boot__.py", line 31, in [0x0-0x59059].org.pythonmac.unspecified.MWDConfig[1483] 8/7/08 2:22:55 PM _run('main.py') [0x0-0x59059].org.pythonmac.unspecified.MWDConfig[1483] 8/7/08 2:22:55 PM File "/Users/xkenneth/work/mwdconfig/tkpyro/dist/ MWDConfig.app/Contents/Resources/__boot__.py", line 28, in _run [0x0-0x59059].org.pythonmac.unspecified.MWDConfig[1483] 8/7/08 2:22:55 PM execfile(path, globals(), globals()) [0x0-0x59059].org.pythonmac.unspecified.MWDConfig[1483] 8/7/08 2:22:55 PM File "/Users/xkenneth/work/mwdconfig/tkpyro/dist/ MWDConfig.app/Contents/Resources/main.py", line 3, in [0x0-0x59059].org.pythonmac.unspecified.MWDConfig[1483] 8/7/08 2:22:55 PM from tkpyro import run [0x0-0x59059].org.pythonmac.unspecified.MWDConfig[1483] 8/7/08 2:22:55 PM File "tkpyro/__init__.pyc", line 2, in [0x0-0x59059].org.pythonmac.unspecified.MWDConfig[1483] 8/7/08 2:22:55 PM File "lxml/etree.pyc", line 18, in [0x0-0x59059].org.pythonmac.unspecified.MWDConfig[1483] 8/7/08 2:22:55 PM File "lxml/etree.pyc", line 15, in __load [0x0-0x59059].org.pythonmac.unspecified.MWDConfig[1483] 8/7/08 2:22:55 PM ImportError: '/System/Library/Frameworks/ Python.framework/Versions/2.5/lib/python2.5/lib-dynload/lxml/etree.so' not found [0x0-0x59059].org.pythonmac.unspecified.MWDConfig[1483] 8/7/08 2:22:55 PM MWDConfig Error MWDConfig[1483] 8/7/08 2:22:55 PM MWDConfig Error An unexpected error has occurred during execution of the main script ImportError: '/System/Library/Frameworks/Python.framework/Versions/2.5/ lib/python2.5/lib-dynload/lxml/etree.so' not found MWDConfig[1483] So it's looking for etree.so here: /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ lib-dynload/lxml/etree.so But it exists here in the app: ./Contents/Resources/lib/python2.5/lib-dynload/lxml Note: I'm using __import__ in certain sections of my code, but it's choking before it gets to this. Anyone have any ideas? Regards, Ken From anjiro at cc.gatech.edu Thu Aug 7 22:48:02 2008 From: anjiro at cc.gatech.edu (Daniel Ashbrook) Date: Thu, 07 Aug 2008 16:48:02 -0400 Subject: [Pythonmac-SIG] pragma mark with python in xcode? Message-ID: <489B5F82.2030202@cc.gatech.edu> Anybody know how to make #pragma mark work with python in xcode? dan From Chris.Barker at noaa.gov Thu Aug 7 22:59:41 2008 From: Chris.Barker at noaa.gov (Chris Barker) Date: Thu, 07 Aug 2008 13:59:41 -0700 Subject: [Pythonmac-SIG] LXML with py2app In-Reply-To: References: Message-ID: <489B623D.90905@noaa.gov> Kenneth Miller wrote: > This is what I'm encountering. > > Here i printed the sys.path, why does this include modules local to the > machine? I want it to be independent of any local resources? > '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5', This is Apple's installed python. by default, if you run py2app with Apple's system python, it will link to that, rather than embedding all of python with it. I don't know if you can override that, but if you want your app bundle to run on pre 10.5 machines, you need to install the python.org python, and use that. py2app will embed the whole thing in your app bundle, and it should run on any max, OS-X 10.3.9 and above. I don't know if there are any special issues with LXML, but I'd get a simple app with only the standard library working first, and then try your full app. -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 xkenneth at gmail.com Thu Aug 7 23:03:24 2008 From: xkenneth at gmail.com (Kenneth Miller) Date: Thu, 7 Aug 2008 16:03:24 -0500 Subject: [Pythonmac-SIG] LXML with py2app In-Reply-To: <489B623D.90905@noaa.gov> References: <489B623D.90905@noaa.gov> Message-ID: <6AEA8ED3-A920-4E2B-8E28-9270433E3B9D@gmail.com> Chris, How can I build python to link to the OS X Tkinter libraries? That's the ONLY reason I'm using the system python. I usually use the python built by macports. Regards, Ken On Aug 7, 2008, at 3:59 PM, Chris Barker wrote: > Kenneth Miller wrote: >> This is what I'm encountering. >> Here i printed the sys.path, why does this include modules local to >> the machine? I want it to be independent of any local resources? >> '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/ >> python2.5', > > This is Apple's installed python. by default, if you run py2app with > Apple's system python, it will link to that, rather than embedding > all of python with it. > > I don't know if you can override that, but if you want your app > bundle to run on pre 10.5 machines, you need to install the > python.org python, and use that. py2app will embed the whole thing > in your app bundle, and it should run on any max, OS-X 10.3.9 and > above. > > I don't know if there are any special issues with LXML, but I'd get > a simple app with only the standard library working first, and then > try your full app. > > -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 > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig -------------- next part -------------- An HTML attachment was scrubbed... URL: From Chris.Barker at noaa.gov Fri Aug 8 00:18:26 2008 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Thu, 07 Aug 2008 15:18:26 -0700 Subject: [Pythonmac-SIG] LXML with py2app In-Reply-To: <6AEA8ED3-A920-4E2B-8E28-9270433E3B9D@gmail.com> References: <489B623D.90905@noaa.gov> <6AEA8ED3-A920-4E2B-8E28-9270433E3B9D@gmail.com> Message-ID: <489B74B2.9000702@noaa.gov> Kenneth Miller wrote: > How can I build python to link to the OS X Tkinter libraries? That's > the ONLY reason I'm using the system python. I usually use the python > built by macports. I'm pretty sure the build you get from python.org works fine with Tkinter -- it is well integerated with OS-X, rather than separate and "unixy" like macports and fink. -Chris From pascal.bompard at gmail.com Fri Aug 8 04:20:54 2008 From: pascal.bompard at gmail.com (Pascal Bompard) Date: Fri, 8 Aug 2008 10:20:54 +0800 Subject: [Pythonmac-SIG] Yet another problem with path In-Reply-To: References: <7FCB2300-D7D7-4205-87CB-62014F590F85@gmail.com> <487AAC30.2080808@codebykevin.com> <6FFC88EC-39E1-4A18-8D71-5ED6206094B6@gmail.com> <487AB0D4.6080607@codebykevin.com> <0EFC7A38-5599-460C-99F9-2A0FD59C59BA@gmail.com> <487BA49E.4000206@noaa.gov> Message-ID: <7BB6D438-821B-45BC-8FC7-E5314E84967B@gmail.com> Thank you! This solved it for me. I knew it had to be something as ridiculously n00bish as keeping "python" in the script call. On 07/08/2008, at 9:58 PM, Mike Covill wrote: > You should be able to execute your script by typing just your script > name from anywhere, leave out "python": > > Administrator:~ pascal$ test.py > > in this case test.py is the 'executable', and your system will look > for it using your PATH setting. From krabby at mac.com Fri Aug 8 07:29:22 2008 From: krabby at mac.com (Mike Keith) Date: Fri, 8 Aug 2008 06:29:22 +0100 Subject: [Pythonmac-SIG] LXML with py2app In-Reply-To: <489B74B2.9000702@noaa.gov> References: <489B623D.90905@noaa.gov> <6AEA8ED3-A920-4E2B-8E28-9270433E3B9D@gmail.com> <489B74B2.9000702@noaa.gov> Message-ID: <1de4b0f00808072229x71d8b15budd2fad372ee3d199@mail.gmail.com> On Thu, Aug 7, 2008 at 11:18 PM, Christopher Barker wrote: > Kenneth Miller wrote: >> >> How can I build python to link to the OS X Tkinter libraries? That's >> the ONLY reason I'm using the system python. I usually use the python built >> by macports. > > I'm pretty sure the build you get from python.org works fine with Tkinter -- > it is well integerated with OS-X, rather than separate and "unixy" like > macports and fink. i used the python.org build for exactly this (a script using Tkinter) and it worked great. cheers, Mike From kw at codebykevin.com Fri Aug 8 16:00:18 2008 From: kw at codebykevin.com (Kevin Walzer) Date: Fri, 08 Aug 2008 10:00:18 -0400 Subject: [Pythonmac-SIG] LXML with py2app In-Reply-To: <6AEA8ED3-A920-4E2B-8E28-9270433E3B9D@gmail.com> References: <489B623D.90905@noaa.gov> <6AEA8ED3-A920-4E2B-8E28-9270433E3B9D@gmail.com> Message-ID: <489C5172.5080803@codebykevin.com> Kenneth Miller wrote: > Chris, > > How can I build python to link to the OS X Tkinter libraries? That's > the ONLY reason I'm using the system python. I usually use the python > built by macports. > > Regards, > Ken > You can build Python yourself using the source code at Python.org. I think the flags are ./configure --enable-framework --enable-universalsdk. That will link to the system Tcl/Tk installation. -- Kevin Walzer Code by Kevin http://www.codebykevin.com From xkenneth at gmail.com Fri Aug 8 16:06:31 2008 From: xkenneth at gmail.com (Kenneth Miller) Date: Fri, 8 Aug 2008 09:06:31 -0500 Subject: [Pythonmac-SIG] LXML with py2app In-Reply-To: <489B74B2.9000702@noaa.gov> References: <489B623D.90905@noaa.gov> <6AEA8ED3-A920-4E2B-8E28-9270433E3B9D@gmail.com> <489B74B2.9000702@noaa.gov> Message-ID: Alright, So i get macpython, and after this is the problem I run into.. Installed /Users/xkenneth/work/mwdconfig/tkpyro/altgraph-0.6.7-py2.5.egg Traceback (most recent call last): File "setup.py", line 17, in setup_requires = modules, 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.6c8-py2.5.egg/setuptools/ dist.py", line 223, in __init__ 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/setuptools-0.6c8-py2.5.egg/setuptools/ dist.py", line 256, in finalize_options File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ python2.5/site-packages/setuptools-0.6c8-py2.5.egg/pkg_resources.py", line 1912, in load File "/Users/xkenneth/work/mwdconfig/tkpyro/py2app-0.3.6-py2.5.egg/ py2app/build_app.py", line 27, in import macholib.MachOStandalone File "build/bdist.macosx-10.3-i386/egg/macholib/MachOStandalone.py", line 8, in File "build/bdist.macosx-10.3-i386/egg/macholib/MachOGraph.py", line 17, in File "build/bdist.macosx-10.3-i386/egg/macholib/MachO.py", line 15, in File "build/bdist.macosx-10.3-i386/egg/macholib/util.py", line 56, in TypeError: Error when calling the metaclass bases cannot create 'builtin_function_or_method' instances Any ideas? Regards, Ken On Aug 7, 2008, at 5:18 PM, Christopher Barker wrote: > Kenneth Miller wrote: >> How can I build python to link to the OS X Tkinter libraries? >> That's the ONLY reason I'm using the system python. I usually use >> the python built by macports. > > I'm pretty sure the build you get from python.org works fine with > Tkinter -- it is well integerated with OS-X, rather than separate > and "unixy" like macports and fink. > > -Chris > > > From vivacarlie at gmail.com Fri Aug 8 16:11:55 2008 From: vivacarlie at gmail.com (Nehemiah Dacres) Date: Fri, 8 Aug 2008 09:11:55 -0500 Subject: [Pythonmac-SIG] Yet another problem with path In-Reply-To: <7BB6D438-821B-45BC-8FC7-E5314E84967B@gmail.com> References: <7FCB2300-D7D7-4205-87CB-62014F590F85@gmail.com> <487AAC30.2080808@codebykevin.com> <6FFC88EC-39E1-4A18-8D71-5ED6206094B6@gmail.com> <487AB0D4.6080607@codebykevin.com> <0EFC7A38-5599-460C-99F9-2A0FD59C59BA@gmail.com> <487BA49E.4000206@noaa.gov> <7BB6D438-821B-45BC-8FC7-E5314E84967B@gmail.com> Message-ID: <65fadfc30808080711m20de968cpfdf0c9606b3238bc@mail.gmail.com> have all of you forgotten that the current directory isn't in the path either? to excecute a script in the current directory at the command line, you type at the '$' $ ./MyScript else you do $python MyScript but then you wouldn't need the 'shebang' line '#!/bin/env python' or '#!/usr/bin/python On Thu, Aug 7, 2008 at 9:20 PM, Pascal Bompard wrote: > Thank you! This solved it for me. > > I knew it had to be something as ridiculously n00bish as keeping "python" > in the script call. > > On 07/08/2008, at 9:58 PM, Mike Covill wrote: > > You should be able to execute your script by typing just your script name >> from anywhere, leave out "python": >> >> Administrator:~ pascal$ test.py >> >> in this case test.py is the 'executable', and your system will look for it >> using your PATH setting. >> > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > -- "lalalalala! it's not broken because I can use it" http://linux.slashdot.org/comments.pl?sid=194281&threshold=1&commentsort=0&mode=thread&cid=15927703 -------------- next part -------------- An HTML attachment was scrubbed... URL: From vivacarlie at gmail.com Fri Aug 8 18:36:48 2008 From: vivacarlie at gmail.com (Nehemiah Dacres) Date: Fri, 8 Aug 2008 11:36:48 -0500 Subject: [Pythonmac-SIG] pragma mark with python in xcode? In-Reply-To: <489B5F82.2030202@cc.gatech.edu> References: <489B5F82.2030202@cc.gatech.edu> Message-ID: <65fadfc30808080936i3fc2e87csda9f8f8c24b9309d@mail.gmail.com> python has pragmas? I dont thinks so On Thu, Aug 7, 2008 at 3:48 PM, Daniel Ashbrook wrote: > Anybody know how to make #pragma mark work with python in xcode? > > > dan > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > -- "lalalalala! it's not broken because I can use it" http://linux.slashdot.org/comments.pl?sid=194281&threshold=1&commentsort=0&mode=thread&cid=15927703 -------------- next part -------------- An HTML attachment was scrubbed... URL: From bwinton at latte.ca Fri Aug 8 18:45:12 2008 From: bwinton at latte.ca (Blake Winton) Date: Fri, 08 Aug 2008 12:45:12 -0400 Subject: [Pythonmac-SIG] pragma mark with python in xcode? In-Reply-To: <65fadfc30808080936i3fc2e87csda9f8f8c24b9309d@mail.gmail.com> References: <489B5F82.2030202@cc.gatech.edu> <65fadfc30808080936i3fc2e87csda9f8f8c24b9309d@mail.gmail.com> Message-ID: <489C7818.6040508@latte.ca> Nehemiah Dacres wrote: > Daniel Ashbrook wrote: >> Anybody know how to make #pragma mark work with python in xcode? > python has pragmas? I dont thinks so No, but XCode has pragmas. Well, #pragma mark at least. Sadly, Dan, I don't know the answer to your question, but I am interested in any (intelligent) replies you get, because I've been using the #pragma mark in my Objective-C stuff for a while, and found it quite handy. Thanks, Blake. From negativesum at gmail.com Fri Aug 8 23:52:07 2008 From: negativesum at gmail.com (David Hostetler) Date: Fri, 8 Aug 2008 17:52:07 -0400 Subject: [Pythonmac-SIG] Help! I can't get py2app v0.4.2 to correctly embed Authorization Message-ID: <687a7c670808081452x8c6be67i15b957243eb3cf5e@mail.gmail.com> I'm trying to build a fairly simple app (on osx 10.5.4) that leverages the Authorization module (v0.1). The py2app build succeeds, but when I run the app, I get an exception that says: '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-dynload/Authorization/_Authorization.so' not found A bit of investigation makes this look like a macholib problem - i.e. it's not correcting the path reference to use the '@execution_path/../Frameworks/etc/etc..' stunt which would allow the app to use a relative copy. I can't figure out how to get this to work correctly. I'm on the svn tip of py2app as well as all of the associated dependencies (macholib, modulegraph, altgraph, etc..). Note that in my resulting app bundle, there is *nothing* in Contents/Frameworks, but there is a '_Authorization.so' in Contents/Resources/lib/python2.5/lib-dynload/Authorization/. Am I failing to pass some critical option to my setup.py? I'm not particularly OSX saavy, so any help is appreciated. regards, -David From nabble.5.warren at recursor.net Sat Aug 9 00:20:47 2008 From: nabble.5.warren at recursor.net (Warren Harris) Date: Fri, 8 Aug 2008 15:20:47 -0700 (PDT) Subject: [Pythonmac-SIG] managing python 2.4 and 2.5 on leopard Message-ID: <18899870.post@talk.nabble.com> I'm trying to understand the correct way to manage both a 2.4 and 2.5 installation on the same machine (mac 10.5.4). Actually, I have several installed already, and I'd like to clean up this mess, but I'm afraid of breaking things. Here's what I have installed: 1) python that comes with leopard: $ /usr/bin/python -V Python 2.5.1 $ ll /usr/bin/python lrwxr-xr-x 1 root wheel 72 Mar 2 23:58 /usr/bin/python@ -> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/python 2) python installed by macports (can't remember why I seemed to need this, or that the system python wasn't enough): $ /opt/local/bin/python2.5 -V Python 2.5.2 3) python 2.4 installed from dmg: http://www.pythonmac.org/packages/py24-fat/dmg/python-2.4.4-macosx2006-10-18.dmg (I had tried to install 2.4 from macports, but this failed for some reason -- I needed 2.4 for a project): $ /usr/local/bin/python -V Python 2.4.4 $ ll /usr/local/bin/python lrwxr-xr-x 1 root wheel 68 Jul 24 16:24 /usr/local/bin/python@ -> ../../../Library/Frameworks/Python.framework/Versions/2.4/bin/python 4) looks like I've got a 2.3 installed too (/System/Library/Frameworks/Python.framework/Versions/2.3) My questions are: - Is there a better way to install 2.4 to live along side 2.5? - How to uninstall the 2.4 version cleanly? - Why does one live under /System/Library and the other under /Library (I notice a bunch of things under /Library that appear to be duplicates, e.g. perl, tcl, etc)? - Should I upgrade my system 2.5 version to 2.5.2 (and the correct method)? Thanks, wh -- View this message in context: http://www.nabble.com/managing-python-2.4-and-2.5-on-leopard-tp18899870p18899870.html Sent from the Python - pythonmac-sig mailing list archive at Nabble.com. From georg.seifert at gmx.de Sat Aug 9 17:56:31 2008 From: georg.seifert at gmx.de (Georg Seifert) Date: Sat, 9 Aug 2008 17:56:31 +0200 Subject: [Pythonmac-SIG] Problem with Framework Message-ID: <63E50C2B-DA5C-49DB-BC9C-FC04C1B7B0F4@gmx.de> Hello, I use some python code in my Cocoa app witch target Leopard. main.m: #import and: Py_Initialize(); in my code I use: PyRun_SimpleString(..) It works fine on my machine but on other machines it crashes on startup with: Date/Time: 2008-08-07 00:08:39.219 +0100 OS Version: Mac OS X 10.5.4 (9E17) Report Version: 6 Exception Type: EXC_BREAKPOINT (SIGTRAP) Exception Codes: 0x0000000000000002, 0x0000000000000000 Crashed Thread: 0 Dyld Error Message: Library not loaded: /Library/Frameworks/Python.framework/Versions/ 2.4/Python Referenced from: /Users/Tim/Desktop/Pantografer.app/Contents/MacOS/ Pantografer Reason: image not found I do not have any python 2.4 on my machine and link again the 2.5 framework. what could be wrong. Thanks Georg From georg.seifert at gmx.de Sun Aug 10 12:06:10 2008 From: georg.seifert at gmx.de (Georg Seifert) Date: Sun, 10 Aug 2008 12:06:10 +0200 Subject: [Pythonmac-SIG] Problem with Framework In-Reply-To: References: <63E50C2B-DA5C-49DB-BC9C-FC04C1B7B0F4@gmx.de> Message-ID: is there a way to select witch framework to use? Georg > > On 9-Aug-2008, at 17:56 , Georg Seifert wrote: > >> Dyld Error Message: >> Library not loaded: /Library/Frameworks/Python.framework/Versions/ >> 2.4/Python >> Referenced from: /Users/Tim/Desktop/Pantografer.app/Contents/MacOS/ >> Pantografer >> Reason: image not found > > Here's the smoking gun: it tries to load a user-installed copy of > Python 2.4 which doesn't exist. > > I assume that on your development machine you have 2.4 installed, > and /Library (with the user-installed 2.4) takes precedence over / > System/Library (with the Apple-installed 2.5) when you built the app. > > > -- > Jack Jansen, , http://www.cwi.nl/~jack > If I can't dance I don't want to be part of your revolution -- Emma > Goldman > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jack.Jansen at cwi.nl Sun Aug 10 21:39:58 2008 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Sun, 10 Aug 2008 21:39:58 +0200 Subject: [Pythonmac-SIG] Problem with Framework In-Reply-To: References: <63E50C2B-DA5C-49DB-BC9C-FC04C1B7B0F4@gmx.de> Message-ID: <20C5497C-3FD9-4CB8-8B24-E4B6699EC1EF@cwi.nl> On 10-Aug-2008, at 12:06 , Georg Seifert wrote: > is there a way to select witch framework to use? I've never found one. I have two tricks (working together) I use when I build software to distribute: 1. After building my distribution, I run a script "testdependencies" (attached to this message) that uses otool -L to ensure all dependencies are in Apple-maintained locations (i.e. no / Library, no /usr/local, etc). -------------- next part -------------- A non-text attachment was scrubbed... Name: testdependencies Type: application/octet-stream Size: 313 bytes Desc: not available URL: -------------- next part -------------- 2. If this script returns a warning (about one out of two times:-) I do a temporary "sudo chmod 0 /usr/local /Library/Frameworks/ Python ..." and rebuild the whole distribution. If there's anything that I really need from /Library or /usr/local I copy it into the bundle and mangle the name with install_name_tool. For Python-based projects py2app can do this for you, too. > > Georg >> >> On 9-Aug-2008, at 17:56 , Georg Seifert wrote: >> >>> Dyld Error Message: >>> Library not loaded: /Library/Frameworks/Python.framework/Versions/ >>> 2.4/Python >>> Referenced from: /Users/Tim/Desktop/Pantografer.app/Contents/ >>> MacOS/Pantografer >>> Reason: image not found >> >> Here's the smoking gun: it tries to load a user-installed copy of >> Python 2.4 which doesn't exist. >> >> I assume that on your development machine you have 2.4 installed, >> and /Library (with the user-installed 2.4) takes precedence over / >> System/Library (with the Apple-installed 2.5) when you built the app. >> >> >> -- >> Jack Jansen, , http://www.cwi.nl/~jack >> If I can't dance I don't want to be part of your revolution -- Emma >> Goldman >> >> > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig From Chris.Barker at noaa.gov Mon Aug 11 06:03:40 2008 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Sun, 10 Aug 2008 21:03:40 -0700 Subject: [Pythonmac-SIG] managing python 2.4 and 2.5 on leopard In-Reply-To: <18899870.post@talk.nabble.com> References: <18899870.post@talk.nabble.com> Message-ID: <489FBA1C.5020204@noaa.gov> Warren Harris wrote: > I'm trying to understand the correct way to manage both a 2.4 and 2.5 > installation on the same machine (mac 10.5.4). Actually, I have several > installed already, and I'd like to clean up this mess, but I'm afraid of > breaking things. You'll only break things if the things you uninstall are using them! Anyway, here is my advise: For 2.5: use either Apple's or the one from python .org. You can search this list for pluses and minuses, but I'd go with python.org's. A bit more about that later... > 1) python that comes with leopard: This is Apple's -- don't mess with it -- Apple uses it for some utilities. > 2) python installed by macports (can't remember why I seemed to need this, > or that the system python wasn't enough): If you're not using macports for other stuff, I'd get rid of this one. > 3) python 2.4 installed from dmg: > http://www.pythonmac.org/packages/py24-fat/dmg/python-2.4.4-macosx2006-10-18.dmg > -- I needed 2.4 for a project): If you still need 2.4 for something then keep this one. > 4) looks like I've got a 2.3 installed too > (/System/Library/Frameworks/Python.framework/Versions/2.3) If you're not using it, you don't need it, but it won't hurt to have it there. > - Is there a better way to install 2.4 to live along side 2.5? nope, you've got it fine. > - How to uninstall the 2.4 version cleanly? 1) you don't need to -- it won't hurt to have it there. 2) delete: /Library/Frameworks/Python.framework/Versions/2.4 delete whatever says 2.4 under Applications/MacPython (I think -- I don't have a mac at home) > - Why does one live under /System/Library and the other under /Library (I > notice a bunch of things under /Library that appear to be duplicates, e.g. > perl, tcl, etc)? /System is for stuff installed and maintained by Apple -- don't mess with anything there. /Library is for stuff installed by third parties -- that's where you put an updated python, etc. > - Should I upgrade my system 2.5 version to 2.5.2 (and the correct method)? No. Do not upgrade anything of Apple's. However, you might want 2.5.2, in which case, install the binary from python.org, it will go into /Library/Frameworks/... Any number of python installations can live quite happily on one system. The question is, which do you get when you type: $ python That will be determined by your PATH environment variable. Type: $ echo $PATH to see what yours is. YOU can change it by editing your ~/.profile or ~./bash_profile file (whichever you have). Once you've got the one you want as default, you can get another one by typing: $ python24 or $ python25 (or putting that in your #! line) Any extra packages you need will need to be installed in the version you want them for, maybe one for each version. If you install binaries, make sure they are for the version you want. If you install with setup.py, make sure to run setup.py with the version you want. If you use easy_install, it's a bit trickier. easy_install will use one of them by default. I'm not entirely sure how to get it to use another python -- I'd have to poke around a bit on my Mac. Maybe someone else here knows. -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception From anjiro at cc.gatech.edu Mon Aug 11 14:45:19 2008 From: anjiro at cc.gatech.edu (Daniel Ashbrook) Date: Mon, 11 Aug 2008 08:45:19 -0400 Subject: [Pythonmac-SIG] Can't import QTKit: Fatal Python error Message-ID: <48A0345F.1040206@cc.gatech.edu> When I try to import QTKit and build and run my app, I get "Fatal Python error: Interpreter not initialized (version mismatch?)". Any ideas? dan From porter.mike at gmail.com Mon Aug 11 15:25:52 2008 From: porter.mike at gmail.com (Mike Porter) Date: Mon, 11 Aug 2008 10:25:52 -0300 Subject: [Pythonmac-SIG] py2app OpenGL example error Message-ID: Hello, I am unable to run an app of the OpenGL example (found at http://svn.pythonmac.org/py2app/py2app/trunk/examples/PyOpenGL/) using py2app. The app is created successfully, but when I run it I get "ImportError: No module named OpenGL.GL". If I look inside the app, the OpenGL directory is there (in Contents/Resources/lib/python2.5/)... so I know it is being copied from my Python site-packages folder. The script itself (lesson5.py) runs fine. Using --alias or --packages OpenGL doesn't help. I tried re-installing both py2app and PyOpenGL, and have searched the mailing list archives to no avail. If anyone can suggest why I might be getting this error, I would appreciate the help. Thanks, Mike Porter From vivacarlie at gmail.com Mon Aug 11 16:21:41 2008 From: vivacarlie at gmail.com (Nehemiah Dacres) Date: Mon, 11 Aug 2008 09:21:41 -0500 Subject: [Pythonmac-SIG] pragma mark with python in xcode? In-Reply-To: <489C7818.6040508@latte.ca> References: <489B5F82.2030202@cc.gatech.edu> <65fadfc30808080936i3fc2e87csda9f8f8c24b9309d@mail.gmail.com> <489C7818.6040508@latte.ca> Message-ID: <65fadfc30808110721h50aaad26x4a5ca33ea38382d8@mail.gmail.com> On Fri, Aug 8, 2008 at 11:45 AM, Blake Winton wrote: > Nehemiah Dacres wrote: > >> Daniel Ashbrook wrote: >> >>> Anybody know how to make #pragma mark work with python in xcode? >>> >> python has pragmas? I dont thinks so >> > > No, but XCode has pragmas. Well, #pragma mark at least. > > Sadly, Dan, I don't know the answer to your question, but I am interested > in any (intelligent) replies you get, because I've been using the #pragma > mark in my Objective-C stuff for a while, and found it quite handy. > > Thanks, > Blake. > > What are u using a #pragma for in python? You See that POUND sign your using, thats a COMPILER DIRECTIVE, python is an interpreted scripting language, no PREPROCESSING allowed , (except for the .pyc code but thats compiled if you want to get technical with me) Am I misinterpreting you intentions? -- "lalalalala! it's not broken because I can use it" http://linux.slashdot.org/comments.pl?sid=194281&threshold=1&commentsort=0&mode=thread&cid=15927703 -------------- next part -------------- An HTML attachment was scrubbed... URL: From anjiro at cc.gatech.edu Mon Aug 11 17:10:38 2008 From: anjiro at cc.gatech.edu (Daniel Ashbrook) Date: Mon, 11 Aug 2008 11:10:38 -0400 Subject: [Pythonmac-SIG] pragma mark with python in xcode? In-Reply-To: <65fadfc30808110721h50aaad26x4a5ca33ea38382d8@mail.gmail.com> References: <489B5F82.2030202@cc.gatech.edu> <65fadfc30808080936i3fc2e87csda9f8f8c24b9309d@mail.gmail.com> <489C7818.6040508@latte.ca> <65fadfc30808110721h50aaad26x4a5ca33ea38382d8@mail.gmail.com> Message-ID: <48A0566E.7010709@cc.gatech.edu> Nehemiah Dacres wrote: > What are u using a #pragma for in python? You See that POUND sign your > using, thats a COMPILER DIRECTIVE, python is an interpreted scripting > language, no PREPROCESSING allowed , (except for the .pyc code but thats > compiled if you want to get technical with me) > Am I misinterpreting you intentions? Yes. Xcode supports "#pragma mark foo" that puts "foo" into a dropdown menu above your code in the editor so you can quickly jump between sections. dan From hengist.podd at virgin.net Mon Aug 11 19:50:13 2008 From: hengist.podd at virgin.net (has) Date: Mon, 11 Aug 2008 18:50:13 +0100 Subject: [Pythonmac-SIG] Problem with Framework In-Reply-To: References: Message-ID: <9FF037A4-D85F-4359-8B9C-746095F2E0B6@virgin.net> Georg Seifert wrote: > is there a way to select witch framework to use? You need to bind the framework yourself rather than using #import, e.g. see py2app's bundletemplate/src/main.m, or PyOSA's pythonloader.c file. HTH has -- Control AppleScriptable applications from Python, Ruby and ObjC: http://appscript.sourceforge.net From Chris.Barker at noaa.gov Mon Aug 11 22:02:43 2008 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Mon, 11 Aug 2008 13:02:43 -0700 Subject: [Pythonmac-SIG] pragma mark with python in xcode? In-Reply-To: <48A0566E.7010709@cc.gatech.edu> References: <489B5F82.2030202@cc.gatech.edu> <65fadfc30808080936i3fc2e87csda9f8f8c24b9309d@mail.gmail.com> <489C7818.6040508@latte.ca> <65fadfc30808110721h50aaad26x4a5ca33ea38382d8@mail.gmail.com> <48A0566E.7010709@cc.gatech.edu> Message-ID: <48A09AE3.2060206@noaa.gov> Daniel Ashbrook wrote: > Xcode supports "#pragma mark foo" that puts "foo" into a dropdown menu > above your code in the editor so you can quickly jump between sections. As "#" is a comment in python, it certainly could be done just the same way, but not if Apple hasn't enabled that. Well, XCode, as a rule, does not support python that well. Nor does Apple show any intention of opening up XCode so that good language-specific modes could be written by third parties. So I suggest you find another editor! -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 Tue Aug 12 14:30:43 2008 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Tue, 12 Aug 2008 14:30:43 +0200 Subject: [Pythonmac-SIG] python 2.6 trunk In-Reply-To: <74320681-2C94-40E2-B1C9-6A5327B8FF92@usace.army.mil> References: <74320681-2C94-40E2-B1C9-6A5327B8FF92@usace.army.mil> Message-ID: On 7 Aug, 2008, at 20:16, Chris Kees wrote: > Hi, > > I'm trying to rebuild my 4-way universal framework build of python > 2.6 using the latest revision in the trunk. I got a compile error > due to a redefinition of FSIORefNum in some of the Mac/Modules files > (see svn diff output at end of email). After changing that, I > still get a problem running 'make test' at 'test_array'. My machine > starts grinding away and the resident memory of the python process > goes through the roof. I have the same problems when testing, that's due to exterme memory usage in the testset. I had to reset my machine the last time I tried to run the tests. At least one test creates a list a very large numer of elements (look for test_overflow in Lib/test/test_list.py). > I went ahead and tried 'make install' anyway, and got the problem > below, which looks like a simple error in a config file. Has > anybody seen these problems or have any suggestions? I may just need > to roll it back to Ronald's revision (63955), but I thought I would > try a more recent version. For some reason configure doesn't seem to have detected that the 10.5 SDK. Are you building on OSX 10.5? If so, could you check pyconfig.h to check if HAVE_MACOS105_SDK is defined? (Which it should be when you're building a 4-way universal binary). Reverting to the 63955 version wouldn't be helpful in this case, the typedef on the trunk is needed to ensure that the code compiles on 10.4. BTW. I build the 4-way universal framework using: mkdir build64 ../configure --with-universal-archs=all --with-framework- name=Python64 --enable-framework --enable-universalsdk=/ make make install The --with-framework-name option is optional and allows you to have both a regular 32-bit build and a 4-way universal build (which is helpful while testing). > > > Thanks, > Chris > > python-trunk/build: arch -386 -ppc ../python.exe ../../Mac/scripts/ > cachersrc.py -v /Library/Frameworks/Python64.framework/Versions/2.6/ > lib/python2.6/plat-mac /Library/Frameworks/Python64.framework/ > Versions/2.6/Mac/Tools > arch: Unknown architecture: 386 That's a real bug, that should be "-i386" instead of "-386". I've just commited a fix for this (rev. 65652). To anyone that is interested in a 4-way build: please test this configuration, the 2.6 release is getting closer and hence there is little time left to get bugfixes into the repository. > > > > Index: Mac/Modules/MacOS.c > =================================================================== > --- Mac/Modules/MacOS.c (revision 65574) > +++ Mac/Modules/MacOS.c (working copy) > @@ -30,10 +30,6 @@ > #include > #include > > -#ifndef HAVE_MACOS105_SDK > -typedef SInt16 FSIORefNum; > -#endif > - > static PyObject *MacOS_Error; /* Exception MacOS.Error */ > > #define PATHNAMELEN 1024 > Index: Mac/Modules/file/_Filemodule.c > =================================================================== > --- Mac/Modules/file/_Filemodule.c (revision 65574) > +++ Mac/Modules/file/_Filemodule.c (working copy) > @@ -7,10 +7,6 @@ > > #include "pymactoolbox.h" > > -#ifndef HAVE_MACOS105_SDK > -typedef SInt16 FSIORefNum; > -#endif > - > /* Macro to test whether a weak-loaded CFM function exists */ > #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ > PyErr_SetString(PyExc_NotImplementedError, \ > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig From ronaldoussoren at mac.com Tue Aug 12 14:36:03 2008 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Tue, 12 Aug 2008 14:36:03 +0200 Subject: [Pythonmac-SIG] pragma mark with python in xcode? In-Reply-To: <489B5F82.2030202@cc.gatech.edu> References: <489B5F82.2030202@cc.gatech.edu> Message-ID: On 7 Aug, 2008, at 22:48, Daniel Ashbrook wrote: > Anybody know how to make #pragma mark work with python in xcode? That doesn't seem to work, I guess Xcode only looks for "#pragma mark" in C code and not in python code. If you have an ADC account you can file a feature request for this at bugreport.apple.com. Ronald From ronaldoussoren at mac.com Tue Aug 12 14:43:38 2008 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Tue, 12 Aug 2008 14:43:38 +0200 Subject: [Pythonmac-SIG] python 2.6 trunk In-Reply-To: References: <74320681-2C94-40E2-B1C9-6A5327B8FF92@usace.army.mil> Message-ID: <6F8BDE2B-42F7-42E1-B87C-9BDA64F959DB@mac.com> On 12 Aug, 2008, at 14:30, Ronald Oussoren wrote: >> > > For some reason configure doesn't seem to have detected that the > 10.5 SDK. Are you building on OSX 10.5? If so, could you check > pyconfig.h to check if HAVE_MACOS105_SDK is defined? (Which it > should be when you're building a 4-way universal binary). Never mind, there was a real bug here. The actual #define is called HAVE_OSX105_SDK. I've fixed this in r65653. Ronald From mcovill at mac.com Tue Aug 12 14:49:04 2008 From: mcovill at mac.com (Mike Covill) Date: Tue, 12 Aug 2008 08:49:04 -0400 Subject: [Pythonmac-SIG] pragma mark with python in xcode? In-Reply-To: <48A0566E.7010709@cc.gatech.edu> References: <489B5F82.2030202@cc.gatech.edu> <65fadfc30808080936i3fc2e87csda9f8f8c24b9309d@mail.gmail.com> <489C7818.6040508@latte.ca> <65fadfc30808110721h50aaad26x4a5ca33ea38382d8@mail.gmail.com> <48A0566E.7010709@cc.gatech.edu> Message-ID: <7705530B-FD45-44DC-9F3C-299E9AF32988@mac.com> On 11-Aug-08, at 11:10 AM, Daniel Ashbrook wrote: > Nehemiah Dacres wrote: > > What are u using a #pragma for in python? You See that POUND sign > your >> using, thats a COMPILER DIRECTIVE, python is an interpreted >> scripting language, no PREPROCESSING allowed , (except for the .pyc >> code but thats compiled if you want to get technical with me) >> Am I misinterpreting you intentions? > > Yes. > > Xcode supports "#pragma mark foo" that puts "foo" into a dropdown > menu above your code in the editor so you can quickly jump between > sections. > > > dan From Apple's "Xcode Workspace Guide:, chapter 6, section 2: http://developer.apple.com/documentation/DeveloperTools/Conceptual/XcodeWorkspace/600-The_Text_Editor/chapter_6_section_2.html you can use these inside a comment and the drop down will display them in bold, like the #pragma mark does in C code: MARK: TODO: FIXME: !!!: ???: You can use "MARK:" just like you use "#pragma mark" in C code, and it ("MARK:") will not show up in the drop down, just the comment following it. The others will be included in the drop down item. #MARK: Section 1 displays as: "Section 1" #!!!: Look at this now! displays as: "!!! Look at this now" Mike From joaoleao at gmx.net Tue Aug 12 14:56:28 2008 From: joaoleao at gmx.net (=?ISO-8859-1?Q?Jo=E3o_Le=E3o?=) Date: Tue, 12 Aug 2008 13:56:28 +0100 Subject: [Pythonmac-SIG] Problem with CoreGraphics and py2app Message-ID: <8CD707B9-104D-485F-B905-17970CC52A6E@gmx.net> Hi list Is anyone having trouble building applications from CoreGraphics scripts? Details here: (meanwhile I updated to 10.5.4 but the behavior is the same) > Hi > > I'm running Mac OS X 10.5.2 on a G4 MacBook and I didn't install any > addons in what concerns Python. > I was happy to see that apple is now including PyObjc and py2app. > > I tried to build applications with py2app from my old CoreGraphics > scripts (made on 10.4 / python2.3) that used to work ok. py2app > actually creates the application but when I run it, it unexpectedly > quits. The Console spits this: > 5/23/08 7:12:19 PM [0x0-0x85085].org.pythonmac.unspecified.Test[647] > Fatal Python error: Interpreter not initialized (version mismatch?) > 5/23/08 7:12:36 PM com.apple.launchd[66] > ([0x0-0x85085].org.pythonmac.unspecified.Test[647]) Exited > abnormally: Abort trap > > To exclude some error in my script, I tried this with one the Apple > supplied examples under /Developer/Examples/Quartz/Python/. > I ran py2app with the following "setup.py" (I chose the example > "circle.py"): > ### > from distutils.core import setup > import py2app > > setup( > name='Test', > app=["circle.py"], > ) > ### > > Incidentally, I discovered that my system isn't finding py2applet too: > ibook-joao:Desktop joao$ py2applet --make-setup circle.py > -bash: py2applet: command not found > > Finally, py2app seems to work ok with other scripts that don't use > CoreGraphics. > > Thanks. > Jo?o From anjiro at cc.gatech.edu Tue Aug 12 15:16:28 2008 From: anjiro at cc.gatech.edu (Daniel Ashbrook) Date: Tue, 12 Aug 2008 09:16:28 -0400 Subject: [Pythonmac-SIG] pragma mark with python in xcode? In-Reply-To: <7705530B-FD45-44DC-9F3C-299E9AF32988@mac.com> References: <489B5F82.2030202@cc.gatech.edu> <65fadfc30808080936i3fc2e87csda9f8f8c24b9309d@mail.gmail.com> <489C7818.6040508@latte.ca> <65fadfc30808110721h50aaad26x4a5ca33ea38382d8@mail.gmail.com> <48A0566E.7010709@cc.gatech.edu> <7705530B-FD45-44DC-9F3C-299E9AF32988@mac.com> Message-ID: <48A18D2C.6040305@cc.gatech.edu> Heeeey, awesome! Who woulda thought that reading the documentation would actually come in handy? Much obliged, Mike! dan Mike Covill wrote: > From Apple's "Xcode Workspace Guide:, chapter 6, section 2: > > http://developer.apple.com/documentation/DeveloperTools/Conceptual/XcodeWorkspace/600-The_Text_Editor/chapter_6_section_2.html > > > you can use these inside a comment and the drop down will display them > in bold, like the #pragma mark does in C code: > > MARK: > TODO: > FIXME: > !!!: > ???: > > You can use "MARK:" just like you use "#pragma mark" in C code, and it > ("MARK:") will not show up in the drop down, just the comment following > it. The others will be included in the drop down item. > > #MARK: Section 1 > displays as: "Section 1" > > #!!!: Look at this now! > displays as: "!!! Look at this now" > > Mike > From Christopher.E.Kees at usace.army.mil Wed Aug 13 04:49:51 2008 From: Christopher.E.Kees at usace.army.mil (Kees, Christopher E) Date: Tue, 12 Aug 2008 21:49:51 -0500 Subject: [Pythonmac-SIG] python 2.6 trunk In-Reply-To: <6F8BDE2B-42F7-42E1-B87C-9BDA64F959DB@mac.com> Message-ID: I updated to r65653 and it seems to be working OK. There are some test failures. I saved all the output in case it's of any use. My problem is now with the numpy module, which builds fine but says it can't install when cross-compiling. I apparently had an old version of numpy in site-packages that must not have been a universal but which was running without any problems as long as I was running in 32 bit. Anybody had any luck with a 4-way universal numpy build? Thanks, Chris ... 317 tests OK. 10 tests failed: test_aepack test_applesingle test_array test_distutils test_httpservers test_macostools test_scriptpackages test_signal test_site test_socket 33 tests skipped: test_al test_bsddb test_bsddb3 test_cd test_cl test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw test_curses test_dl test_epoll test_gdbm test_gl test_imageop test_imgfile test_largefile test_linuxaudiodev test_normalization test_ossaudiodev test_pep277 test_py3kwarn test_socketserver test_startfile test_sunaudiodev test_tcl test_timeout test_urllib2net test_urllibnet test_winreg test_winsound test_zipfile64 2 skips unexpected on darwin: test_tcl test_dl make: *** [test] Error 1 On 8/12/08 7:43 AM, "Ronald Oussoren" wrote: > > On 12 Aug, 2008, at 14:30, Ronald Oussoren wrote: >>> >> >> For some reason configure doesn't seem to have detected that the >> 10.5 SDK. Are you building on OSX 10.5? If so, could you check >> pyconfig.h to check if HAVE_MACOS105_SDK is defined? (Which it >> should be when you're building a 4-way universal binary). > > Never mind, there was a real bug here. The actual #define is called > HAVE_OSX105_SDK. > > I've fixed this in r65653. > > Ronald > > From JKelly at nemetschek.net Wed Aug 13 08:09:05 2008 From: JKelly at nemetschek.net (Jim Kelly) Date: Wed, 13 Aug 2008 02:09:05 -0400 Subject: [Pythonmac-SIG] Problems with py2app and wx on leopard Message-ID: I'm experiencing a bit of odd behavior with py2app and wx. The shared object files from wx, when inspected with otool, are looking for: /usr/lib/libwx_macud-2.8.0.dylib (compatibility version 2.6.0, current version 2.8.4) That is based on wx installed in the site-packages of the system python that ships with leopard. Now I installed python from python.org, got wxPython source, and tried again. This time, in my wx directory, otool shows no such requirement. That's what I want, so that works well. But it turns out that py2app was still pulling from the system wx. So I set use_pythonpath to True, thinking it would prefer mine over the system one. Now it is including *both*, mine goes to Frameworks in the app bundle, while the system one goes into Resources in the app bundle. At runtime, if I'm running on a system without the libwx_macud-2.8.0.dylib file, it still fails. This is what I am seeing when I grep for _windows_ (one of the so files from wx) from my py2app build output: byte-compiling /Users/jkelly/Documents/Code/Projects/Installer/Dev/demo/demovwinstaller/bui ld/bdist.macosx-10.3-i386/python2.5-standalone/app/temp/wx/_windows_.py to wx/_windows_.pyc copying /System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/w x-2.8-mac-unicode/wx/_windows_.so -> /Users/jkelly/Documents/Code/Projects/Installer/Dev/demo/demovwinstaller/dis t_osx/VWInstaller.app/Contents/Resources/lib/python2.5/lib-dynload/wx copying /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-package s/wx-2.8-mac-unicode/wx/_windows_.so -> /Users/jkelly/Documents/Code/Projects/Installer/Dev/demo/demovwinstaller/dis t_osx/VWInstaller.app/Contents/Frameworks stripping _windows_.so So how do I make py2app ignore the system install version of wx completely? Thanks! Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: From vivacarlie at gmail.com Wed Aug 13 17:16:45 2008 From: vivacarlie at gmail.com (Nehemiah Dacres) Date: Wed, 13 Aug 2008 10:16:45 -0500 Subject: [Pythonmac-SIG] pragma mark with python in xcode? In-Reply-To: <48A18D2C.6040305@cc.gatech.edu> References: <489B5F82.2030202@cc.gatech.edu> <65fadfc30808080936i3fc2e87csda9f8f8c24b9309d@mail.gmail.com> <489C7818.6040508@latte.ca> <65fadfc30808110721h50aaad26x4a5ca33ea38382d8@mail.gmail.com> <48A0566E.7010709@cc.gatech.edu> <7705530B-FD45-44DC-9F3C-299E9AF32988@mac.com> <48A18D2C.6040305@cc.gatech.edu> Message-ID: <65fadfc30808130816v13312e0u4f9ae5d2fd5ace99@mail.gmail.com> Sigh, now you see my misunderstanding, sorry for the abuse of CAPS LOCK but #pragma marks are only called #pragma because of the preprocessor, which is why GCC is getting away from that. (note the gcc handbook, i checked it out one week) anyway, it would be silly for an editor to detect things that are language specific in a non language spesific way. if you just said you wanted to mark places in your code, then you would have gotten that sooner. (in an editor spesific manor) note : I use Vim On Tue, Aug 12, 2008 at 8:16 AM, Daniel Ashbrook wrote: > Heeeey, awesome! Who woulda thought that reading the documentation would > actually come in handy? Much obliged, Mike! > > > dan > > > > Mike Covill wrote: > >> From Apple's "Xcode Workspace Guide:, chapter 6, section 2: >> >> >> http://developer.apple.com/documentation/DeveloperTools/Conceptual/XcodeWorkspace/600-The_Text_Editor/chapter_6_section_2.html >> >> you can use these inside a comment and the drop down will display them in >> bold, like the #pragma mark does in C code: >> >> MARK: >> TODO: >> FIXME: >> !!!: >> ???: >> >> You can use "MARK:" just like you use "#pragma mark" in C code, and it >> ("MARK:") will not show up in the drop down, just the comment following it. >> The others will be included in the drop down item. >> >> #MARK: Section 1 >> displays as: "Section 1" >> >> #!!!: Look at this now! >> displays as: "!!! Look at this now" >> >> Mike >> >> > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > -- "lalalalala! it's not broken because I can use it" http://linux.slashdot.org/comments.pl?sid=194281&threshold=1&commentsort=0&mode=thread&cid=15927703 -------------- next part -------------- An HTML attachment was scrubbed... URL: From Chris.Barker at noaa.gov Wed Aug 13 19:25:53 2008 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Wed, 13 Aug 2008 10:25:53 -0700 Subject: [Pythonmac-SIG] Problems with py2app and wx on leopard In-Reply-To: References: Message-ID: <48A31921.1090801@noaa.gov> Jim Kelly wrote: > So how do I make py2app ignore the system install version of wx completely? The easiest way is to not use the system python at all -- use the python.org build. Then py2app will bundle up all of that and what you've installed. If you want to distribute to 1.4 users, you'll need to do that anyway. Is there a reason you want to use Apple's Python? -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 Chris.Barker at noaa.gov Wed Aug 13 19:27:04 2008 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Wed, 13 Aug 2008 10:27:04 -0700 Subject: [Pythonmac-SIG] python 2.6 trunk In-Reply-To: References: Message-ID: <48A31968.8040702@noaa.gov> Kees, Christopher E wrote: > Anybody had any > luck with a 4-way universal numpy build? I'd ask on the numpy list, but I don't think I've seen anyone talk about it. -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 JKelly at nemetschek.net Wed Aug 13 23:05:12 2008 From: JKelly at nemetschek.net (James Kelly) Date: Wed, 13 Aug 2008 17:05:12 -0400 Subject: [Pythonmac-SIG] Problems with py2app and wx on leopard In-Reply-To: Message-ID: Okay, with the benefit of some sleep, I've been able to resolve this problem. I'll recount what was wrong below for the benefit of others. To clear up what was probably a confusing email based on Chris's response, I was tring to use the python.org python, not the system python, but there were some problems, mostly caused by some stupid moves on my part while trying to solve other problems. The problem I had was that I had added the system python site-packages to my $PYTHONPATH, so it makes sense now why py2app was looking in there. Perhaps a little odd that it was sucking up two versions of wx libraries, but it seems a plausible explanation as the the behavior I was seeing. Do something dumb while debugging, get dumb results. :) So then, after getting the py2app and related dependencies from svn, the app actually built. I then had another issue. First, I tried to run the app on Tiger, and it was not happy about the version of libiconv. No problem, I built the app on Tiger. We've had to do this before, so it didn't phase me too much. When I build on Tiger, and run on leopard, it complains: Library not loaded: @executable_path/../Frameworks/libwx_macud-2.8.0.dylib. It goes on to say that the reason is that the image is not found. But it is indeed there, in the app bundle, with read and execute permissions for all. With the app bundle built on Tiger and run on Tiger, I get an os import error. It turns out this was related to our use of the Authorization module. We were just passing sys.argv[0] into executeWithPrivileges, which, as it makes sense now, was just the path to our primary python file in the Resources directory. I tried a few things here, using /usr/bin/open on the app bundle for example, but in the end what worked properly is passing the path to the app itself in side Contents/MacOS. This clears up all the issues above. Anyway, if there is any lesson to be learned from this, it's that marathon debugging sessions are a bad idea. You just keep doing increasingly stupid things until you wrap yourself in a circle. :) Jim On 8/13/08 2:09 AM, "Jim Kelly" wrote: > I'm experiencing a bit of odd behavior with py2app and wx. The shared > object files from wx, when inspected with otool, are looking for: > > /usr/lib/libwx_macud-2.8.0.dylib (compatibility version 2.6.0, current > version 2.8.4) > > That is based on wx installed in the site-packages of the system python that > ships with leopard. > > Now I installed python from python.org, got wxPython source, and tried > again. This time, in my wx directory, otool shows no such requirement. > That's what I want, so that works well. > > But it turns out that py2app was still pulling from the system wx. So I set > use_pythonpath to True, thinking it would prefer mine over the system one. > Now it is including *both*, mine goes to Frameworks in the app bundle, while > the system one goes into Resources in the app bundle. At runtime, if I'm > running on a system without the libwx_macud-2.8.0.dylib file, it still > fails. This is what I am seeing when I grep for _windows_ (one of the so > files from wx) from my py2app build output: > > byte-compiling > /Users/jkelly/Documents/Code/Projects/Installer/Dev/demo/demovwinstaller/bui > ld/bdist.macosx-10.3-i386/python2.5-standalone/app/temp/wx/_windows_.py to > wx/_windows_.pyc > copying > /System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/w > x-2.8-mac-unicode/wx/_windows_.so -> > /Users/jkelly/Documents/Code/Projects/Installer/Dev/demo/demovwinstaller/dis > t_osx/VWInstaller.app/Contents/Resources/lib/python2.5/lib-dynload/wx > copying > /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-package > s/wx-2.8-mac-unicode/wx/_windows_.so -> > /Users/jkelly/Documents/Code/Projects/Installer/Dev/demo/demovwinstaller/dis > t_osx/VWInstaller.app/Contents/Frameworks > stripping _windows_.so > > So how do I make py2app ignore the system install version of wx completely? > > Thanks! > Jim > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig From christopher.e.kees at usace.army.mil Thu Aug 14 20:38:54 2008 From: christopher.e.kees at usace.army.mil (Chris Kees) Date: Thu, 14 Aug 2008 13:38:54 -0500 Subject: [Pythonmac-SIG] [Numpy-discussion] Mac OSX 4-way universal Re: python 2.6 trunk In-Reply-To: <3d375d730808131608p2e3233feq40aac81906e88543@mail.gmail.com> Message-ID: The 4-way universal install of numpy-1.1.1 is working now with the Python 2.6b2+ (trunk:65678), and all the tests pass (running as i386 and x86_64 at least). Unfortunately, I didn't find exactly what was causing it. I just erased /Library/Frameworks/Python64.framework and rebuilt the 4-way universal python and numpy module again because I had noticed that the numpy build directory kept coming up with this structure: %ls build lib.macosx-10.5-universal-2.6 scripts.macosx-10.5-universal-2.6 src.macosx-10.3-i386-2.6 temp.macosx-10.5-universal-2.6 Apparently something in my python framework was leftover from a previous install and causing the src.macosx-10.3-i386-2.6 to get built, which seems to be related to distutils deciding that I was cross-compiling. Anyway, thanks for the help and sorry for the trouble. I guess one should always erase the python framework before re-installing it? Should I be running an uninstall script instead of just erasing it? Chris On 8/13/08 6:08 PM, "robert.kern at gmail.com" wrote: > On 2008-08-13, David Cournapeau wrote: >> On Wed, Aug 13, 2008 at 4:20 PM, Robert Kern wrote: >>> >>> Hmm. Odd. I can't find the string "Can't install when cross-compiling" >>> anywhere in the numpy or Python sources. Can you try again with the >>> environment variable DISTUTILS_DEBUG=1 set? >> >> You can find it in python svn: the message seems python 2.6 specific. > > Okay, it looks like this happens when distutils.util.get_platform() > and the build command's plat_name are different. Chris, can you do the > following and show me the output? > > $ python setup.py build --help > ... > $ python -c "from distutils import util;print util.get_platform()" > ... > > Probably a workaround is to do > > $ python setup.py build --plat-name=... install > > where ... is whatever the output of the second command above gives. From jwt at onjapan.net Fri Aug 15 04:41:41 2008 From: jwt at onjapan.net (Jim Tittsler) Date: Fri, 15 Aug 2008 14:41:41 +1200 Subject: [Pythonmac-SIG] py2app: email.iterators Message-ID: I'm using py2app 0.3.6 and python.org Python 2.5.2 to bundle up a new application that uses the email module. The special 'email' recipe seems to pick up all of the files in email/ except iterators.pyc and generator.pyc... and when I launch my newly made application an error appears: ImportError: No module named iterators Do I need to something more than just specify the email package? From georgewr at bigpond.net.au Fri Aug 15 08:59:34 2008 From: georgewr at bigpond.net.au (George Wright) Date: Fri, 15 Aug 2008 16:59:34 +1000 Subject: [Pythonmac-SIG] virtualenv problems In-Reply-To: References: Message-ID: <906989F2-4625-468D-A2BE-9EC9EAF1EA30@bigpond.net.au> Gidday again I am having trouble getting a virtualenv to use the python version I want on my OSX 10.5.4. ? I have installed Python 2.5.2 and used ~/.bash_profile to export PATH so that this one comes up when I type python at the shell prompt. (I haven't made a ~/.profile entry. I wonder if that would help?) ? I have installed the latest "virtualenv" ? When I create a virtualenv from the command line like this: $ virtualenv ENV that works but the python available after activating is the OSX installed global version 2.5.1 and not the 2.5.2 I hoped for. ?? ? The virtualenv docs suggest you can call it like this: $ python virtualenv.py ENV Which might ensure that 252 came up - But I get this error message: /Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/ Contents/MacOS/Python: can't open file 'virtualenv.py': [Errno 2] No such file or directory AND I can't find a virtualenv.py anywhere ? The docs (http://pypi.python.org/pypi/virtualenv#id2) suggest that one can 'name a python' but there is no indication as to how that is done. ? I have tried the no_site-packages option too. Any suggestions? George Wright From rowen at u.washington.edu Fri Aug 15 19:42:26 2008 From: rowen at u.washington.edu (Russell E. Owen) Date: Fri, 15 Aug 2008 10:42:26 -0700 Subject: [Pythonmac-SIG] Build Tkinter against custom tcl/tk? Message-ID: I'm trying to build a non-framework python on MacOS X 10.5 using a custom tcl/tk that lives in an arbitrary directory. (For complicated reasons we don't want the system tcl/tk). It is easy to build an X11 tcl/tk this way (and we are content with X11) so I did that. Unfortunately I can't seem to build Python in such a way that it sees this tcl/tk. The only documented way to do this I found was to edit Modules/Setup or Setup.local, so I did the following: $ /configure --prefix=/Users/rowen/TestBuild/pythonroot/ --disable-framework Edit Modules/Setup.local to add this text (based on comments in Modules/Setup): _tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \ -L/Users/rowen/TestBuild/tcltkroot/lib \ -I/Users/rowen/TestBuild/tcltkroot/include \ -ltk8.4 -ltcl8.4 \ -I/usr/X11R6/include \ -L/usr/X11R6/lib \ -lX11 $ make $ make install This builds, but the resulting python is missing the _tkinter library. I tried setting CFLAGS: $ export CFLAGS="-I/Users/rowen/TestBuild/tcltkroot/include -L/Users/rowen/TestBuild/tcltkroot/bin" before running configure, but that didn't help. So...any advice? Any obvious mistake? (I did double-check each path in the text I added to Setup.local) Is there some way to convince configure to use my tcl/tk (that would potentially be simpler than editing Modules/Setup.local). -- Russell From travis_caldwell2000 at yahoo.com Sat Aug 16 05:20:32 2008 From: travis_caldwell2000 at yahoo.com (Travis Caldwell) Date: Fri, 15 Aug 2008 20:20:32 -0700 (PDT) Subject: [Pythonmac-SIG] appscript -- Getting 1708 Error on count command for word 2008 Message-ID: <799565.27802.qm@web45315.mail.sp1.yahoo.com> Not sure if this is user error or a bug, but I can't seem to send the count command to Word 2008 via appscript. >>> word.documents.count() Traceback (most recent call last): File "", line 1, in File "/Library/Python/2.5/site-packages/appscript-0.18.1-py2.5-macosx-10.5-i386.egg/appscript/reference.py", line 439, in __call__ appscript.reference.CommandError: CommandError -1708: Application could not handle this command. Failed command: app(u'/Applications/Microsoft Office 2008/Microsoft Word.app').documents.count() I can call help on the count command via the same path so I think I'm calling count() from the right place: >>> word.documents.count.help() ============================================================================== Help (-t) Reference: app(u'/Applications/Microsoft Office 2008/Microsoft Word.app').documents.count ------------------------------------------------------------------------------ Description of reference Terminology for count command [...] And Word seems to support the count command since this works from the script editor: tell application "Microsoft Word" display dialog (get count of documents) end tell And finally, I tried doing a count with TextEdit and that seems to work fine: >>> te = app('TextEdit') >>> te.activate() >>> te.documents.count() 3 Any help would be appreciated. _Travis_Caldwell_ From hengist.podd at virgin.net Sat Aug 16 23:50:08 2008 From: hengist.podd at virgin.net (has) Date: Sat, 16 Aug 2008 22:50:08 +0100 Subject: [Pythonmac-SIG] appscript -- Getting 1708 Error on count command for word 2008 In-Reply-To: References: Message-ID: Travis Caldwell wrote: > Not sure if this is user error or a bug, but I can't seem to send > the count command to Word 2008 via appscript. Word's count command requires an 'each' parameter, e.g.: app('microsoft word').count(each=k.document) A number of Carbon apps do require an 'each' parameter, e.g. Word, Finder. The reason you can get away with not specifying one yourself in AppleScript is that AppleScript quietly munges the reference passed as the direct parameter to create one. Appscript mimics quite a bit of AppleScript's behind-the-scenes chicanery for compatibility's sake, but this isn't one of them. (The 'each' parameter is itself a design wart; Apple event IPC has a lot of those.) Adding a note about this particular issue to the FAQ is on the TODO list... along with the rest of the FAQ. (I'm afraid work's keeping me pretty busy these days, but fingers crossed it'll happen someday.) HTH has -- Control AppleScriptable applications from Python, Ruby and ObjC: http://appscript.sourceforge.net From christopher.e.kees at usace.army.mil Mon Aug 18 21:09:35 2008 From: christopher.e.kees at usace.army.mil (Chris Kees) Date: Mon, 18 Aug 2008 14:09:35 -0500 Subject: [Pythonmac-SIG] 2.6 universal problems Message-ID: I'm running into a problem building/installing from svn source r65809 for the 64-bit universal configuration on 10.5. The installer can't find the FSpOpenResFile function during the install phase. Here is a summary of what is happening: % uname -a Darwin ... 9.4.0 Darwin Kernel Version 9.4.0: Mon Jun 9 19:30:53 PDT 2008; root:xnu-1228.5.20~1/RELEASE_I386 i386 %gcc --version i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5484) %../configure --with-universal-archs=64-bit --with-framework-name=Python64 --enable-framework --enable-universalsdk=/ MACOSX_DEPLOYMENT_TARGET=10.5 %make %make test ... 319 tests OK. 8 tests failed: test_aepack test_applesingle test_array test_distutils test_httpservers test_macostools test_scriptpackages test_signal 33 tests skipped: test_al test_bsddb test_bsddb3 test_cd test_cl test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw test_curses test_dl test_epoll test_gdbm test_gl test_imageop test_imgfile test_largefile test_linuxaudiodev test_normalization test_ossaudiodev test_pep277 test_py3kwarn test_socketserver test_startfile test_sunaudiodev test_tcl test_timeout test_urllib2net test_urllibnet test_winreg test_winsound test_zipfile64 2 skips unexpected on darwin: test_tcl test_dl %sudo make install ... running install_egg_info Removing /Library/Frameworks/Python64.framework/Versions/2.6/lib/python2.6/lib-dynloa d/Python-2.6b2_-py2.6.egg-info Writing /Library/Frameworks/Python64.framework/Versions/2.6/lib/python2.6/lib-dynloa d/Python-2.6b2_-py2.6.egg-info ln -fs "../../../Python64" "/Library/Frameworks/Python64.framework/Versions/2.6/lib/python2.6/config/li bpython2.6.a" cd Mac && make installmacsubtree DESTDIR="" DYLD_FRAMEWORK_PATH=/Users/cekees/src/pyadh-compilers/python-trunk/build4wu: ../python.exe ../../Mac/scripts/cachersrc.py -v /Library/Frameworks/Python64.framework/Versions/2.6/lib/python2.6/plat-mac /Library/Frameworks/Python64.framework/Versions/2.6/Mac/Tools Traceback (most recent call last): File "../../Mac/scripts/cachersrc.py", line 44, in main() File "../../Mac/scripts/cachersrc.py", line 41, in main os.path.walk(dir, handler, (verbose, force)) File "./../Lib/posixpath.py", line 224, in walk func(arg, top, names) File "../../Mac/scripts/cachersrc.py", line 23, in handler macresource.open_pathname(os.path.join(dirname, fn), verbose=verbose) File "/Users/cekees/src/pyadh-compilers/python-trunk/Lib/plat-mac/macresource.py" , line 81, in open_pathname refno = Res.FSpOpenResFile(pathname, 1) AttributeError: 'module' object has no attribute 'FSpOpenResFile' make[1]: *** [installmacsubtree] Error 1 make: *** [frameworkinstallmaclib] Error 2 I looked in the Mac subdirectory at the source for the _Res extension module where FSpOpenResFile is defined, but it looks like if _LP64_ is defined these function definitions are skipped. Also, if I build the 32-bit or 4-way ('all') universals I get the same output from 'make test' but the installer is happy. After some additional testing with the 4-way universal I'm beginning to find that it has some problems with some extension modules when run as 64-bit, which is why I went back to test the 64-bit universal. Does anybody recognize this error? Is anybody actually using a 64-bit framework build on OSX 10.5 (of 2.6 or 2.5.2)? Chris From raine001 at tc.umn.edu Tue Aug 19 01:53:11 2008 From: raine001 at tc.umn.edu (John Raines) Date: Mon, 18 Aug 2008 18:53:11 -0500 Subject: [Pythonmac-SIG] Leopard Python library ?missing functions? Message-ID: I did a google search on "python calendar" and was surprised to see that several new modules have been added in Python 2.5. I was preparing to try to fix a bug in some code that turned the old calendar modules result into an html version, so I thought I would look at what the new functions did. I was further surprised to get: > ImportError: No module named HTMLCalendar Did they not implement all of the new library on Leopard? Whyever not? From nad at acm.org Tue Aug 19 04:31:50 2008 From: nad at acm.org (Ned Deily) Date: Mon, 18 Aug 2008 19:31:50 -0700 Subject: [Pythonmac-SIG] Leopard Python library ?missing functions? References: Message-ID: In article , John Raines wrote: > I did a google search on "python calendar" and was surprised to see > that several new modules have been added in Python 2.5. I was > preparing to try to fix a bug in some code that turned the old > calendar modules result into an html version, so I thought I would > look at what the new functions did. > > I was further surprised to get: > > ImportError: No module named HTMLCalendar > > Did they not implement all of the new library on Leopard? Whyever not? AFAIK, HTMLCalendar has never been part of the standard Python library. See the Python Package Index here: http://pypi.python.org/pypi/HTMLCalendar/ and install via setuptools: easy_install HTMLCalendar -- Ned Deily, nad at acm.org From ronaldoussoren at mac.com Tue Aug 19 08:41:07 2008 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Tue, 19 Aug 2008 08:41:07 +0200 Subject: [Pythonmac-SIG] 2.6 universal problems In-Reply-To: References: Message-ID: The cachersrc.py module uses API's that are not available in 64-bit mode. I don't have time to look into fixing that (or even research if the cachersrc.py script should be called for a 64-bit install, there's a significant chance that it is not needed). Ronald On 18 Aug, 2008, at 21:09, Chris Kees wrote: > I'm running into a problem building/installing from svn source > r65809 for > the 64-bit universal configuration on 10.5. The installer can't find > the > FSpOpenResFile function during the install phase. Here is a summary > of what > is happening: > > % uname -a > Darwin ... 9.4.0 Darwin Kernel Version 9.4.0: Mon Jun 9 19:30:53 > PDT 2008; > root:xnu-1228.5.20~1/RELEASE_I386 i386 > %gcc --version > i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5484) > %../configure --with-universal-archs=64-bit --with-framework- > name=Python64 > --enable-framework --enable-universalsdk=/ > MACOSX_DEPLOYMENT_TARGET=10.5 > %make > %make test > ... > 319 tests OK. > 8 tests failed: > test_aepack test_applesingle test_array test_distutils > test_httpservers test_macostools test_scriptpackages test_signal > 33 tests skipped: > test_al test_bsddb test_bsddb3 test_cd test_cl test_codecmaps_cn > test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr > test_codecmaps_tw test_curses test_dl test_epoll test_gdbm test_gl > test_imageop test_imgfile test_largefile test_linuxaudiodev > test_normalization test_ossaudiodev test_pep277 test_py3kwarn > test_socketserver test_startfile test_sunaudiodev test_tcl > test_timeout test_urllib2net test_urllibnet test_winreg > test_winsound test_zipfile64 > 2 skips unexpected on darwin: > test_tcl test_dl > %sudo make install > ... > running install_egg_info > Removing > /Library/Frameworks/Python64.framework/Versions/2.6/lib/python2.6/ > lib-dynloa > d/Python-2.6b2_-py2.6.egg-info > Writing > /Library/Frameworks/Python64.framework/Versions/2.6/lib/python2.6/ > lib-dynloa > d/Python-2.6b2_-py2.6.egg-info > ln -fs "../../../Python64" > "/Library/Frameworks/Python64.framework/Versions/2.6/lib/python2.6/ > config/li > bpython2.6.a" > cd Mac && make installmacsubtree DESTDIR="" > DYLD_FRAMEWORK_PATH=/Users/cekees/src/pyadh-compilers/python-trunk/ > build4wu: > ../python.exe ../../Mac/scripts/cachersrc.py -v > /Library/Frameworks/Python64.framework/Versions/2.6/lib/python2.6/ > plat-mac > /Library/Frameworks/Python64.framework/Versions/2.6/Mac/Tools > Traceback (most recent call last): > File "../../Mac/scripts/cachersrc.py", line 44, in > main() > File "../../Mac/scripts/cachersrc.py", line 41, in main > os.path.walk(dir, handler, (verbose, force)) > File "./../Lib/posixpath.py", line 224, in walk > func(arg, top, names) > File "../../Mac/scripts/cachersrc.py", line 23, in handler > macresource.open_pathname(os.path.join(dirname, fn), > verbose=verbose) > File > "/Users/cekees/src/pyadh-compilers/python-trunk/Lib/plat-mac/ > macresource.py" > , line 81, in open_pathname > refno = Res.FSpOpenResFile(pathname, 1) > AttributeError: 'module' object has no attribute 'FSpOpenResFile' > make[1]: *** [installmacsubtree] Error 1 > make: *** [frameworkinstallmaclib] Error 2 > > I looked in the Mac subdirectory at the source for the _Res > extension module > where FSpOpenResFile is defined, but it looks like if _LP64_ is > defined > these function definitions are skipped. Also, if I build the 32-bit > or 4-way > ('all') universals I get the same output from 'make test' but the > installer > is happy. After some additional testing with the 4-way universal I'm > beginning to find that it has some problems with some extension > modules when > run as 64-bit, which is why I went back to test the 64-bit > universal. Does > anybody recognize this error? Is anybody actually using a 64-bit > framework > build on OSX 10.5 (of 2.6 or 2.5.2)? > > Chris > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig From james.collins75 at yahoo.com Tue Aug 19 19:32:46 2008 From: james.collins75 at yahoo.com (James Collins) Date: Tue, 19 Aug 2008 10:32:46 -0700 (PDT) Subject: [Pythonmac-SIG] unsiscribe Message-ID: <251265.55407.qm@web44915.mail.sp1.yahoo.com> how do i unsiscribe? -------------- next part -------------- An HTML attachment was scrubbed... URL: From vivacarlie at gmail.com Tue Aug 19 19:42:53 2008 From: vivacarlie at gmail.com (Nehemiah Dacres) Date: Tue, 19 Aug 2008 12:42:53 -0500 Subject: [Pythonmac-SIG] unsiscribe In-Reply-To: <251265.55407.qm@web44915.mail.sp1.yahoo.com> References: <251265.55407.qm@web44915.mail.sp1.yahoo.com> Message-ID: <65fadfc30808191042y28193996of46ad0ecd8b03f0b@mail.gmail.com> http://mail.python.org/mailman/listinfo/pythonmac-sig funny you should ask, On Tue, Aug 19, 2008 at 12:32 PM, James Collins wrote: > how do i unsiscribe? > > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org <<< > http://mail.python.org/mailman/listinfo/pythonmac-sig <<< -- "lalalalala! it's not broken because I can use it" http://linux.slashdot.org/comments.pl?sid=194281&threshold=1&commentsort=0&mode=thread&cid=15927703 -------------- next part -------------- An HTML attachment was scrubbed... URL: From m.vanland at gmail.com Wed Aug 20 05:05:04 2008 From: m.vanland at gmail.com (Michael VanLandingham) Date: Tue, 19 Aug 2008 20:05:04 -0700 Subject: [Pythonmac-SIG] building bundles with setuptools, py2app, 64-bit python 2.6 Message-ID: I recently built a Python64.framework & interpreter from the 2.6 sources (using Ronald O's recently recommended build settings), and then build PyObjC. Because I got an error running PyObjC's build script, (setup tries to pull down an URL that's non-existent: http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c8-py2.6.egg), I built and installed setuptools from svn.python.org with/for my 4-way fat python build. I need to create 64-bit compatible versions of some PyObjC bundles that we're using. However, when I tried to use it, like this: $ /usr/local/python64 setup.py py2app I got the error below. Which points to what looks like a problem in setuptools. Can anyone offer any advice here? Maybe I need a less cutting edge version of setuptools? Is anyone using 64-bit python, PyObjC to build 64-bit or 4-way fat apps or plugin bundles, and if so, how? Thanks in advance, Michael here's the traceback: ------ running py2app Traceback (most recent call last): File "/Volumes/Sandbox/pyobjc/py2app/py2app/build_app.py", line 579, in _run self.run_normal() File "/Volumes/Sandbox/pyobjc/py2app/py2app/build_app.py", line 631, in run_normal mf = self.get_modulefinder() File "/Volumes/Sandbox/pyobjc/py2app/py2app/build_app.py", line 539, in get_modulefinder debug=debug, File "/Volumes/Sandbox/pyobjc/modulegraph/modulegraph/find_modules.py", line 255, in find_modules find_needed_modules(mf, scripts, includes, packages) File "/Volumes/Sandbox/pyobjc/modulegraph/modulegraph/find_modules.py", line 176, in find_needed_modules mf.run_script(path) File "/Volumes/Sandbox/pyobjc/modulegraph/modulegraph/modulegraph.py", line 369, in run_script self.scan_code(co, m) File "/Volumes/Sandbox/pyobjc/modulegraph/modulegraph/modulegraph.py", line 610, in scan_code self._safe_import_hook(name, m, fromlist) File "/Volumes/Sandbox/pyobjc/modulegraph/modulegraph/modulegraph.py", line 540, in _safe_import_hook mods = self.import_hook(name, caller) File "/Volumes/Sandbox/pyobjc/modulegraph/modulegraph/modulegraph.py", line 380, in import_hook q, tail = self.find_head_package(parent, name) File "/Volumes/Sandbox/pyobjc/modulegraph/modulegraph/modulegraph.py", line 419, in find_head_package q = self.import_module(head, qname, parent) File "/Volumes/Sandbox/pyobjc/modulegraph/modulegraph/modulegraph.py", line 493, in import_module parent and parent.packagepath, parent) File "/Volumes/Sandbox/pyobjc/modulegraph/modulegraph/modulegraph.py", line 680, in find_module fp, buf, stuff = find_module(name, path) File "/Volumes/Sandbox/pyobjc/modulegraph/modulegraph/modulegraph.py", line 114, in find_module if isinstance(importer, pkg_resources.ImpWrapper): AttributeError: 'module' object has no attribute 'ImpWrapper' > /Volumes/Sandbox/pyobjc/modulegraph/modulegraph/modulegraph.py(114)find_module() -> if isinstance(importer, pkg_resources.ImpWrapper): (Pdb) pkg_resources (Pdb) list 109 for entry in path: 110 importer = pkg_resources.get_importer(entry) 111 loader = importer.find_module(name) 112 if loader is None: continue 113 114 -> if isinstance(importer, pkg_resources.ImpWrapper): 115 filename = loader.filename 116 if filename.endswith('.pyc') or filename.endswith('.pyo'): 117 fp = open(filename, 'rb') 118 description = ('.pyc', 'rb', imp.PY_COMPILED) 119 return (fp, filename, description) (Pdb) -------------- next part -------------- An HTML attachment was scrubbed... URL: From rowen at u.washington.edu Thu Aug 21 01:34:51 2008 From: rowen at u.washington.edu (Russell E. Owen) Date: Wed, 20 Aug 2008 16:34:51 -0700 Subject: [Pythonmac-SIG] Getting py2app to work with svn 1.5.1? Message-ID: I just realized I can no longer build my Python application using py2app since upgrading to svn 1.5.1. The application uses Tkinter, matplotlib and Image (PIL). I am on MacOS X 10.4.11 using Python 2.5.2 from python.org and ActiveState Tcl/Tk 8.4.19. The first symptom were well-known problems "Unknown load command: 27" and "global name 'log' is not defined". After reading these: and trying various fixes I got rid of those problems and ended up with a new one (more below) which I've not found a solution for. I decided to try a clean install of easy_install and py2app so: - Delete everything from site-packages related to easy_install and py2app including bdist_mpkg , macholib and modulegraph and setuptools. - Download ez_setup.py $ python ez_setup.py This installed setuptools==0.6c8 $ easy_install py2app This installed: - py2app 0.3.6 - bdist-mpkg 0.4.3 - modulegraph 0.7 py2app fails to build my app with the following error: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-pac kages/py2app-0.3.6-py2.5.egg/py2app/build_app.py", line 548, in _run self.run_normal() File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-pac kages/py2app-0.3.6-py2.5.egg/py2app/build_app.py", line 600, in run_normal mf = self.get_modulefinder() File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-pac kages/py2app-0.3.6-py2.5.egg/py2app/build_app.py", line 508, in get_modulefinder debug=debug, File "build/bdist.macosx-10.3-i386/egg/modulegraph/find_modules.py", line 243, in find_modules find_needed_modules(mf, scripts, includes, packages) File "build/bdist.macosx-10.3-i386/egg/modulegraph/find_modules.py", line 179, in find_needed_modules path = m.packagepath[0] TypeError: 'NoneType' object is unsubscriptable I then tried installing the dev version of py2app: $ easy_install py2app==dev complains about modulegraph so: $ easy_install modulegraph==dev But I still get the same error (and I'd rather not use these dev versions without some idea if they are stable and recommended). I have not located this one on google (except one unanswered query from a wx user from May). Any ideas? -- Russell From djcypod at gmail.com Thu Aug 21 03:08:42 2008 From: djcypod at gmail.com (beau) Date: Wed, 20 Aug 2008 18:08:42 -0700 Subject: [Pythonmac-SIG] applescript bundle droplet Message-ID: I am using apple script to create a droplet that basically lets you pass the incoming file as an argument to a bundled python script. The python script then displays the output in a UI made with Tkinter. Questions: 1. is it possible to quit the apple script before python sends it's exit code? 2. Is there anyway to suppress the console so only the UI shows up on screen? 3. How can I change the name of the title on the menu bar from python to my app's name? From ronaldoussoren at mac.com Thu Aug 21 13:02:40 2008 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Thu, 21 Aug 2008 13:02:40 +0200 Subject: [Pythonmac-SIG] building bundles with setuptools, py2app, 64-bit python 2.6 In-Reply-To: References: Message-ID: On 20 Aug, 2008, at 5:05, Michael VanLandingham wrote: > > I recently built a Python64.framework & interpreter from the 2.6 > sources (using Ronald O's recently recommended build settings), and > then build PyObjC. Because I got an error running PyObjC's build > script, (setup tries to pull down an URL that's non-existent: http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c8-py2.6.egg) > , I built and installed setuptools from svn.python.org with/for my 4- > way fat python build. > > I need to create 64-bit compatible versions of some PyObjC bundles > that we're using. However, when I tried to use it, like this: > > $ /usr/local/python64 setup.py py2app > > I got the error below. Which points to what looks like a problem in > setuptools. Can anyone offer any advice here? Maybe I need a less > cutting edge version of setuptools? > Is anyone using 64-bit python, PyObjC to build 64-bit or 4-way fat > apps or plugin bundles, and if so, how? There might be issues with py2app and setuptools 0.7 (the trunk of setuptools), the 0.6 branch of setuptools should work fine. The main problem at the moment is PyObjC: the code supports 4-way builds (or rather, 3-way builds, libffi is broken on PPC64), but the repository is not as stable as it should be. I want to do a proper release of PyObjC, but progress is going very slowly at the moment due to lack of time and due to the general suckiness of the work that IMO must be done before a next release. I'm very, very slowly adding unittests for all global functions, and other interesting items, in wrapped frameworks because that's the only way to be sure that the wrappers work as advertised. I'm also working on my own copy of the bridgesupport files that Apple ships with Leopard, mostly because I ran into several issues with those files and would prefer shipping my own, correct, version of the metadata files rather than trying to work around the issues in Apple's build. Writing these tests takes quite a lot of time and is not intellectually rewarding, which results in slow progress. Ronald -------------- next part -------------- An HTML attachment was scrubbed... URL: From ronaldoussoren at mac.com Thu Aug 21 13:07:55 2008 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Thu, 21 Aug 2008 13:07:55 +0200 Subject: [Pythonmac-SIG] applescript bundle droplet In-Reply-To: References: Message-ID: On 21 Aug, 2008, at 3:08, beau wrote: > I am using apple script to create a droplet that basically lets you > pass the incoming file as an argument to a bundled python script. The > python script then displays the output in a UI made with Tkinter. > Questions: > > 1. is it possible to quit the apple script before python sends it's > exit code? > 2. Is there anyway to suppress the console so only the UI shows up > on screen? > 3. How can I change the name of the title on the menu bar from python > to my app's name? I'd drop the apple script and go for a .app bundle instead. Py2app (which is included with the system install of Python on Leopard) can build standalone application bundles for you, as an alternative you could use the same trick as I use to build the IDLE.app that's included with the binary installers on Python.org (see http://svn.python.org/view/python/trunk/Mac/IDLE/ for the code that builds the app bundle and http://svn.python.org/view/python/trunk/Lib/idlelib/macosxSupport.py?view=markup for the code in IDLE that deals with "open file" events. Either option would solve all of your questions. Ronald From ronaldoussoren at mac.com Thu Aug 21 14:13:12 2008 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Thu, 21 Aug 2008 14:13:12 +0200 Subject: [Pythonmac-SIG] Next PyObjC release -- help with unit tests? In-Reply-To: <7F3800F2-A535-496C-8CDF-046CCDF27584@integrateddevcorp.com> References: <7F3800F2-A535-496C-8CDF-046CCDF27584@integrateddevcorp.com> Message-ID: On 21 Aug, 2008, at 13:31, s s wrote: > > On Aug 21, 2008, at 7:02 AM, Ronald Oussoren wrote: > >> The main problem at the moment is PyObjC: the code supports 4-way >> builds (or rather, 3-way builds, libffi is broken on PPC64), but >> the repository is not as stable as it should be. I want to do a >> proper release of PyObjC, but progress is going very slowly at the >> moment due to lack of time and due to the general suckiness of the >> work that IMO must be done before a next release. > > Sorry if this is obvious but is there a list of these generally > sucky parts? The most important things that should be done for PyObjC itself: 1) Modernize all sample projects. A signficant subset of the examples in the repository still use PyObjCTools.NibClassBuilder. That module is deprecated and shouldn't be used in new code (and doesn't work with IB3 at all), all examples should be modified to work without NibClassBuilder. This means: - Add explicit base classes instead of NibClassBuilder.AutoBaseClass - Add outlet definitions (objc.IBOutlet definitions) - Add @objc.IBAction decorator to actions (needed for IB3) All examples should have a "readme.txt" and a "summary.txt", the latter is used on the website in the list of examples. 2) There are a number of examples in the pyobjc-core project, those should be moved to the most appropriate pyobjc-framework-* framework wrapper 3) IMHO there should be sample code for all wrapped framework, if only be translating an existing (Objective-)C example 4) All metadata (bridgesupport files) should be verified, see below 5) (very hard): Libffi is broken on PPC64 To be precise: the basic functionality works, but calls through libffi break Objective-C exception handling. This totally breaks PyObjC and fixing that probably requires help from a compiler guru. My gut fealing is to ignore PPC64, fixing libffi is too much of an effort. 6) Port PyObjC to OSX 10.4. This should be fairly easy once step 4 is finished, the code already contains the hooks that are necessary for this port and has worked on 10.4 in the past. 7) Move pyobjc-core/Lib/objc/test to pyobjc-core/PyObjCTest. I've already moved the tests for framework wrappers out of the package that is installed by distutils, the same should be done for pyobjc- core. This can wait until a later release. Py2app also needs some loving (proper egg support, testsuite), but that can wait until after a release of PyObjC itself. > > >> I'm very, very slowly adding unittests for all global functions, >> and other interesting items, in wrapped frameworks because that's >> the only way to be sure that the wrappers work as advertised. I'm >> also working on my own copy of the bridgesupport files that Apple >> ships with Leopard, mostly because I ran into several issues with >> those files and would prefer shipping my own, correct, version of >> the metadata files rather than trying to work around the issues in >> Apple's build. >> >> Writing these tests takes quite a lot of time and is not >> intellectually rewarding, which results in slow progress. > > Again, is there a list? I could put in a bit of time on some of the > mechanical tests if I had a place to find the checklist. There is no list, at least not outside of my head. I've just commited the current state of the tests for the Cocoa frameworks, see . Adding tests for other frameworks should be a lot easier, most of them should contain almost no entities for which tests are needed. I'd like to see tests for all: * C functions (CGContextCreate, ...) * All structs: are the right fields present * All methods that have a custom wrapper (that is, anything with a manually written wrapper in the Modules directory) * All methods with pointer arguments The tests should check if the Python wrapper works and has the right interface (as described in the PyObjC intro.txt document). Testing if the framework functions correctly is not a goal, unless a OS bug affects the functioning of PyObjC itself. During this task we might run into API's that we don't want to support, or cannnot support, in Python. Those should be documented. I'm currently also adding tests that check the presence of global variables (and values of enums), but those are less important. Ronald From a.h.jaffe at gmail.com Thu Aug 21 17:11:16 2008 From: a.h.jaffe at gmail.com (Andrew Jaffe) Date: Thu, 21 Aug 2008 16:11:16 +0100 Subject: [Pythonmac-SIG] "Best" Mac Python under Leopard? Message-ID: Hi All, I know this comes up every few months, but there is never a definitive answer given. The short version is: what is the best Python to use under Leopard? The longer version is: What is the best Python to use under leopard if: - I want to use PyObjC - I want to use more recent versions of packages like numpy that come installed - I want to use ipython and readline - I think I want to be able to use more recent versions of Python (and I certainly will once 2.6 comes out). Currently I am using a framework build of 2.5.1 (since I was doing so under Tiger) but this seems to be a problem for pyobjc. It would also be great if there were a single place on the web where this is answered; if you search -- even with this group -- you get very different pieces of advice. Yours, Andrew From kw at codebykevin.com Thu Aug 21 17:53:36 2008 From: kw at codebykevin.com (Kevin Walzer) Date: Thu, 21 Aug 2008 11:53:36 -0400 Subject: [Pythonmac-SIG] "Best" Mac Python under Leopard? In-Reply-To: References: Message-ID: <48AD8F80.1050400@codebykevin.com> Andrew Jaffe wrote: > > > It would also be great if there were a single place on the web where > this is answered; if you search -- even with this group -- you get very > different pieces of advice. > The reason you get different pieces of advice is because there is no one correct answer. There are too many variables involved and everyone's situation is diffeent. If you are installing a bunch of Unix software that depends on Python, and using Fink or MacPorts to do it, you will get the Python that those systems install. It's because both systems build everything in their own sandbox to keep better control of dependencies. If you don't need Fink or MacPorts for one of their specific packages, I don't think there's a compelling reason to use them to install Python. This leaves the standard Python.org build of Python, Apple's system version of Python, or a Python you build yourself. The standard Python.org build is the easiest. It's more up-to-date than Apple's, which tends to change only when a new version of OS X comes out. You can install/build more recent versions of various packages such as numpy, as you've noted. The biggest advantage of Apple's version of Python is that, at the moment, it appears to play nicer with PyObjC 2.0 than anything else. Xcode integration seems to work well. From what I've seen, PyObjC 2.0 is in a state of flux outside Apple's sandbox--a lot of things, such as documentation, test suites and examples, are still getting updated. (Someone please correct me if I am wrong.) You can always build your own version of Python as well. I do, because my Tkinter Python apps need to link to Tk 8.5, and the official Python.org build (and Apple's version) links to 8.4. Hope this helps, Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com From schimaf at boulder.nist.gov Thu Aug 21 18:07:26 2008 From: schimaf at boulder.nist.gov (Frank Schima) Date: Thu, 21 Aug 2008 10:07:26 -0600 Subject: [Pythonmac-SIG] "Best" Mac Python under Leopard? In-Reply-To: References: Message-ID: <63DF957D-EBEC-48E9-AF99-7D187BE052D0@boulder.nist.gov> Hi Andrew, On Aug 21, 2008, at 9:11 AM, Andrew Jaffe wrote: > I know this comes up every few months, but there is never a > definitive answer given. > > The short version is: what is the best Python to use under Leopard? > > The longer version is: What is the best Python to use under leopard > if: > - I want to use PyObjC > - I want to use more recent versions of packages like numpy that > come installed > - I want to use ipython and readline > - I think I want to be able to use more recent versions of Python > (and I certainly will once 2.6 comes out). > > Currently I am using a framework build of 2.5.1 (since I was doing > so under Tiger) but this seems to be a problem for pyobjc. > > It would also be great if there were a single place on the web where > this is answered; if you search -- even with this group -- you get > very different pieces of advice. I can vouch for using MacPorts to do what you want. I currently use it for programming with the latest Python 2.5.x, numpy, scipy, ipython, wxpython, tkinter, pmw and many more add-ons. They are all kept up to date and it's very easy to install and maintain (i.e. keep up to date). Python 3.0 (alpha) is supported and 2.6 is close to being added. I cannot, though, personally vouch for pyObjC in MacPorts because I don't use it myself - I have to support multiple platforms. But pyObjC is supported in MacPorts. Cheers! Frank Schima Boulder, CO schimaf at boulder.nist.gov From a.h.jaffe at gmail.com Thu Aug 21 22:08:52 2008 From: a.h.jaffe at gmail.com (Andrew Jaffe) Date: Thu, 21 Aug 2008 21:08:52 +0100 Subject: [Pythonmac-SIG] "Best" Mac Python under Leopard? In-Reply-To: <63DF957D-EBEC-48E9-AF99-7D187BE052D0@boulder.nist.gov> References: <63DF957D-EBEC-48E9-AF99-7D187BE052D0@boulder.nist.gov> Message-ID: Hi All, Thanks for the advice! However, I'm pretty sure I don't need the overhead of a fink or MacPorts install -- I've been very happy with Framwork installs so far (and I'm pretty sure that's necessary for PyObjC). I think the detailed questions are: is there a way to use PyObjC with a self-installed Framework install (or at least, will it be possible once 2.6 comes out)? Alternately, is there any problem installing new versions of (say) numpy with the built-in python (e.g., by using easy_install)? Yours, Andrew Frank Schima wrote: > Hi Andrew, > > > On Aug 21, 2008, at 9:11 AM, Andrew Jaffe wrote: > >> I know this comes up every few months, but there is never a definitive >> answer given. >> >> The short version is: what is the best Python to use under Leopard? >> >> The longer version is: What is the best Python to use under leopard if: >> - I want to use PyObjC >> - I want to use more recent versions of packages like numpy that >> come installed >> - I want to use ipython and readline >> - I think I want to be able to use more recent versions of Python >> (and I certainly will once 2.6 comes out). >> >> Currently I am using a framework build of 2.5.1 (since I was doing so >> under Tiger) but this seems to be a problem for pyobjc. >> >> It would also be great if there were a single place on the web where >> this is answered; if you search -- even with this group -- you get >> very different pieces of advice. > > I can vouch for using MacPorts to do what you want. I currently use it > for programming with the latest Python 2.5.x, numpy, scipy, ipython, > wxpython, tkinter, pmw and many more add-ons. They are all kept up to > date and it's very easy to install and maintain (i.e. keep up to date). > Python 3.0 (alpha) is supported and 2.6 is close to being added. I > cannot, though, personally vouch for pyObjC in MacPorts because I don't > use it myself - I have to support multiple platforms. But pyObjC is > supported in MacPorts. > > > > > Cheers! > Frank Schima > Boulder, CO > schimaf at boulder.nist.gov > > > > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > From listservs at mac.com Thu Aug 21 23:10:46 2008 From: listservs at mac.com (Chris Fonnesbeck) Date: Thu, 21 Aug 2008 21:10:46 +0000 (UTC) Subject: [Pythonmac-SIG] "Best" Mac Python under Leopard? References: <63DF957D-EBEC-48E9-AF99-7D187BE052D0@boulder.nist.gov> Message-ID: Andrew Jaffe gmail.com> writes: > > Hi All, > > Thanks for the advice! > > However, I'm pretty sure I don't need the overhead of a fink or MacPorts > install -- I've been very happy with Framwork installs so far (and I'm > pretty sure that's necessary for PyObjC). > I can vouch for the new Enthought Python: http://www.enthought.com/products/epddownload.php It comes with a variety of scientific programming packages, and uses egg packages, so it is very easy to maintain and update. From pythonnutter at gmail.com Fri Aug 22 01:56:18 2008 From: pythonnutter at gmail.com (Python Nutter) Date: Fri, 22 Aug 2008 09:56:18 +1000 Subject: [Pythonmac-SIG] "Best" Mac Python under Leopard? In-Reply-To: References: <63DF957D-EBEC-48E9-AF99-7D187BE052D0@boulder.nist.gov> Message-ID: If you go the ports route, download and install Porticus (highly recommended) to give you graphical management of the ports packages, to clean, download, install, activate/deactivate, handle dependencies, show you all variations of a particular port and just checkmark all the optional compiles you want to build. I went for the Python.org framework over Apple's framework because it was a simple install without worrying about ports. The only problem you may encounter is if you start doing game programming with Pygame, etc. While this may not be a worry because for years Pygame.org never had any up-to-date current OS X binaries. However, they just released the latest version for OS X and if you use the Python.org framework you will have to install PyObjC 1.4 (on their download page) to make it work with Leopard. Other than that I've found no headaches or worries by going with the Python.org framework install. Other things I added to my framework install to make life easier was iPython, virtualenv (and virtualenvwrapper from the python magazine article) which will also make use of the PEAK easy install setup tool. If it was not for these last few tools working together I would probably have gone full hog into the port route of making sure I got the most up-to-date files. With them its more like an apt management system in Debian/Ubuntu systems for binaries/eggs instead of ports and the whole compilation process. Whichever you choose, bets of luck. Cheers, PN 2008/8/22 Chris Fonnesbeck : > Andrew Jaffe gmail.com> writes: > >> >> Hi All, >> >> Thanks for the advice! >> >> However, I'm pretty sure I don't need the overhead of a fink or MacPorts >> install -- I've been very happy with Framwork installs so far (and I'm >> pretty sure that's necessary for PyObjC). >> > I can vouch for the new Enthought Python: > > http://www.enthought.com/products/epddownload.php > > It comes with a variety of scientific programming packages, and uses egg > packages, so it is very easy to maintain and update. > > > > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > From djcypod at gmail.com Sat Aug 23 01:47:55 2008 From: djcypod at gmail.com (beau) Date: Fri, 22 Aug 2008 16:47:55 -0700 Subject: [Pythonmac-SIG] Tkinter save image of GUI Message-ID: what is the best way to export an image of the GUI that Tkinter makes? maybe: Python Image LIbrary(PIL) py2svg: http://wmula.republika.pl/proj/canvas2svg/canvasvg.py Ideally I would like to end up with a tif file equivalent to a screen grab of the UI that Tkinter made. Possible options would include various sizes? From muralimkrishna26 at yahoo.com Sat Aug 23 09:05:28 2008 From: muralimkrishna26 at yahoo.com (murali krishna) Date: Sat, 23 Aug 2008 12:35:28 +0530 (IST) Subject: [Pythonmac-SIG] How to click on a Mac OS X button using python Message-ID: <154905.27573.qm@web94710.mail.in2.yahoo.com> Hi, Can anyone tell how to click on a MAC OS X button using python script...I can do that easily in Windows but i have no clue to do it on Mac. Check out the all-new face of Yahoo! India. Go to http://in.yahoo.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From muralimkrishna26 at yahoo.com Sat Aug 23 11:03:57 2008 From: muralimkrishna26 at yahoo.com (murali krishna) Date: Sat, 23 Aug 2008 14:33:57 +0530 (IST) Subject: [Pythonmac-SIG] How to click on a Mac OS X button using python Message-ID: <519069.8093.qm@web94710.mail.in2.yahoo.com> ping Add more friends to your messenger and enjoy! Go to http://in.messenger.yahoo.com/invite/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From muralimkrishna26 at yahoo.com Sat Aug 23 11:03:57 2008 From: muralimkrishna26 at yahoo.com (murali krishna) Date: Sat, 23 Aug 2008 14:33:57 +0530 (IST) Subject: [Pythonmac-SIG] How to click on a Mac OS X button using python Message-ID: <519069.8093.qm@web94710.mail.in2.yahoo.com> ping Add more friends to your messenger and enjoy! Go to http://in.messenger.yahoo.com/invite/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From dav at alum.mit.edu Sat Aug 23 18:25:21 2008 From: dav at alum.mit.edu (Dav Clark) Date: Sat, 23 Aug 2008 09:25:21 -0700 Subject: [Pythonmac-SIG] "Best" Mac Python under Leopard? In-Reply-To: References: <63DF957D-EBEC-48E9-AF99-7D187BE052D0@boulder.nist.gov> Message-ID: Andrew, I have I will add that if you need pyobjc, I had weird problems with pyobjc 1.4 on leopard and a python.org framework build. Stuff just didn't work (wasn't receiving messages from an external library for hardware interface). I switched to the system python w/ objc 2.0 and everything worked fine. I don't know of any serious issues between 2.5.1 and 2.5.2 that provide a compelling argument to upgrade to the Framework build either. The eggs for the scipy superpack (at drop.io/superpack) install fine into the system python (and there is no longer, to my knowledge, a fortran compiler installed by the script - you should get that from macresearch.org). In my experience, it was a huge hassle keeping up with the bleeding edge dependencies for numpy, scipy and crew using ports or Fink. Installing the few libs that aren't already part of the OSX system was easy enough into /usr/local/lib. I know of no other way to get bleeding edge numpy, scipy, ipython, etc. on OSX except to build it yourself (which is not so bad these days - but does require install of some random things like fortran). But if you can try the system python with like 15 minutes of setup, you may as well. It's easy enough to switch to something else later! I'm at the SciPy conference right now, and they are interested in including objc 2.0 in EPD, but it is not currently there. I have added a ticket (with Dave Peterson's blessing) to the Trac to get this feature added. EPD is also, however, not really that bleeding edge. Cheers, DC > 2008/8/22 Chris Fonnesbeck : >> Andrew Jaffe gmail.com> writes: >> >>> >>> Hi All, >>> >>> Thanks for the advice! >>> >>> However, I'm pretty sure I don't need the overhead of a fink or >>> MacPorts >>> install -- I've been very happy with Framwork installs so far >>> (and I'm >>> pretty sure that's necessary for PyObjC). >>> >> I can vouch for the new Enthought Python: >> >> http://www.enthought.com/products/epddownload.php >> >> It comes with a variety of scientific programming packages, and >> uses egg >> packages, so it is very easy to maintain and update. >> >> >> >> >> _______________________________________________ >> Pythonmac-SIG maillist - Pythonmac-SIG at python.org >> http://mail.python.org/mailman/listinfo/pythonmac-sig >> > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig From dwf at cs.toronto.edu Sun Aug 24 08:41:38 2008 From: dwf at cs.toronto.edu (David Warde-Farley) Date: Sat, 23 Aug 2008 23:41:38 -0700 Subject: [Pythonmac-SIG] "Best" Mac Python under Leopard? In-Reply-To: References: <63DF957D-EBEC-48E9-AF99-7D187BE052D0@boulder.nist.gov> Message-ID: On 23-Aug-08, at 9:25 AM, Dav Clark wrote: > Andrew, I have > > I will add that if you need pyobjc, I had weird problems with pyobjc > 1.4 on leopard and a python.org framework build. Stuff just didn't > work (wasn't receiving messages from an external library for > hardware interface). I switched to the system python w/ objc 2.0 > and everything worked fine. I don't know of any serious issues > between 2.5.1 and 2.5.2 that provide a compelling argument to > upgrade to the Framework build either. Dav and I were arguing this in person at the SciPy08 code sprint :) Opinions in the room were mixed. First of all, if you want to build bundle .app's that are redistributable, it's a good idea not to use the system Python, especially if you want to support Tiger (10.4). There are things in Apple's Python (i.e. DTrace support) that I imagine won't play nicely on an older OS. That said, DTrace support is a huge bonus for some people. Personally I don't really trust the Apple engineers to care enough about Python to iron out all the issues one might face. > I know of no other way to get bleeding edge numpy, scipy, ipython, > etc. on OSX except to build it yourself (which is not so bad these > days - but does require install of some random things like > fortran). But if you can try the system python with like 15 minutes > of setup, you may as well. It's easy enough to switch to something > else later! gfortran is actually remarkably easy to install now thanks to a well maintained binary (the link is on scipy.org, which is undergoing a much-needed overhaul very soon). Building SciPy is indeed not too painful anymore, no matter what Python distribution you're using, and I personally feel it's worth it to check out the latest trunk from SVN -- SciPy is moving so fast that stable releases often don't include vital new features (NumPy is more stable, but there's still a lot of exciting stuff being added, particularly stride_tricks). The nice thing about EPD is that it's a one-stop shop for the scientific computing folks, and maintained by extremely competent folks who have a vested interest in making this stuff work on all the platforms they support (not to mention that well over half of the Enthought guys at SciPy08 were using Macs!). Unlike back in the Tiger days, it seems that most of the options on the table (System, Python.org, EPD) are quite acceptable, but YMMV. Certainly if you run into specific issues with any one of these distributions, please make a note of it on this list so that others can benefit. We really need to spruce up the MacPython FAQ again... Regards, David From dwf at cs.toronto.edu Sun Aug 24 08:58:31 2008 From: dwf at cs.toronto.edu (David Warde-Farley) Date: Sat, 23 Aug 2008 23:58:31 -0700 Subject: [Pythonmac-SIG] How to click on a Mac OS X button using python In-Reply-To: <154905.27573.qm@web94710.mail.in2.yahoo.com> References: <154905.27573.qm@web94710.mail.in2.yahoo.com> Message-ID: On 23-Aug-08, at 12:05 AM, murali krishna wrote: > Hi, > Can anyone tell how to click on a MAC OS X button using python > script...I can do that easily in Windows but i have no clue to do it > on Mac. Hi Murali, You really needn't send three messages to the list within he span of two hours. This isn't a terribly high traffic list and people will get back to you. Your message was also marked as spam for at least me, possibly due to the fact that you sent an HTML message, which is bad mailing list karma. Two "ping" messages in two hours might be appropriate on some web bulletin boards but it is certainly not appropriate here. To answer your question, almost all applications on Mac OS X are scriptable via AppleScript (which can be accessed from Python, with Python syntax, with the appscript module - http://appscript.sourceforge.net/ ). If the app exposes a scripting interface for the specific action that this button performs, you can use that. Open up the application in Script Editor with "File->Open Dictionary..." and take a look at what actions the app exposes. This is a good way of making sure your script does what you think it should do even if things about that button change in the future. If what you want to do is not in the dictionary for the app you're hoping to script, what you'll need to look into is GUI scripting. http://www.apple.com/applescript/uiscripting/ This exposes AppleScript support for "clicking a button" and things like that. Note that you need to have it enabled in the Universal Access preference pane. Good luck, and please be more patient with your messages in the future. David From dwf at cs.toronto.edu Sun Aug 24 10:41:37 2008 From: dwf at cs.toronto.edu (David Warde-Farley) Date: Sun, 24 Aug 2008 01:41:37 -0700 Subject: [Pythonmac-SIG] catching the Cmd+Q event Message-ID: <3CFD0273-F649-47E2-A9F5-5CD584C24B87@cs.toronto.edu> Hi all, I was wondering if anyone knew of a way to catch Cmd+Q in a threaded wx/Tkinter/etc. event loop. The reason is that ipython ( http://ipython.sourceforge.net/ ) supports several plotting toolkits for interactive data analysis, however if you habitually hit Cmd+Q to close the window, things get all screwy. Essentially the event somehow blocks and the thread goes stale. Ideally, we'd like to mask (i.e. ignore) it, or somehow map it to the close window action. Is there any way to do this, at all? (ideally it wouldn't involve PyObjC, but realistically I think it most likely will). Thanks, David From hraban at fiee.net Sun Aug 24 11:08:25 2008 From: hraban at fiee.net (Henning Hraban Ramm) Date: Sun, 24 Aug 2008 11:08:25 +0200 Subject: [Pythonmac-SIG] catching the Cmd+Q event In-Reply-To: <3CFD0273-F649-47E2-A9F5-5CD584C24B87@cs.toronto.edu> References: <3CFD0273-F649-47E2-A9F5-5CD584C24B87@cs.toronto.edu> Message-ID: <16E15E07-0BE0-4E91-A039-6182AD15E81A@fiee.net> Am 2008-08-24 um 10:41 schrieb David Warde-Farley: > I was wondering if anyone knew of a way to catch Cmd+Q in a threaded > wx/Tkinter/etc. event loop. I remember catching the quit event of a wxPython loop on Windows several years ago, because there was a zombie process left if I didn't close the last window carefully. As far as I can remember, I overwrote the __del__ method of the application. Greetlings from Lake Constance! Hraban --- http://www.fiee.net https://www.cacert.org (I'm an assurer) From hraban at fiee.net Sun Aug 24 12:02:55 2008 From: hraban at fiee.net (Henning Hraban Ramm) Date: Sun, 24 Aug 2008 12:02:55 +0200 Subject: [Pythonmac-SIG] controlling Mail.app and GnuPG Message-ID: <6BF57D23-DE0D-417D-B31F-2ADED40761D0@fiee.net> The issue was raised before, but I didn't find any hints how to solve my little problems... BTW, this is framework Python 2.5.2 on OSX 10.5 It is known that the public API of Apple's Mail.app is incomplete and buggy, therefore stuff like the GnuPG plugin stay in eternal beta (and just don't work on my German system - I guess i might my a language problem). Anyway. I tried to write a little helper for GPG encrypted mails - before I dragged the "encrypted.asc" attachment in some folder, called gpg in the bash, copied the decrypted text back in my reply window and replaced all the MIME codes with proper umlauts etc. (I can encrypt the mail via S/MIME, my friend can decrypt that, but didn't get S/MIME encryption to work in her Linux Thunderbird or Evolution, so she sends GPG encrypted...) So, my script gets the selected message in Mail.app... * issue (1) [appscript syntax for Mail.app]: I can list the attachments with appscript, but I didn't find a way to save them or to access them as files. Thus, I read the source of the message. * issue (2) [dysfunctional email module]: The email module (std lib) claims to be able to decode multipart MIME, but finds only 1 part in that text that consists of at least 2 attachments. So I cannot use that. Thus, I extract the "PGP MESSAGE" part using regular expressions. In the cheeseshop there are two modules to access GnuPG: http://pypi.python.org/pypi/pygpgme/0.1 http://pypi.python.org/pypi/GnuPGInterface/0.3.2 The first is from 2006 and seems unmaintained, the latter has a really ugly, un-pythonic syntax. I could also call gnupg via system calls. I don't care about security issues on my own system, otherwise I could just forget any approach, for I must store my passphrase anywhere, and if the decrypted text stays in my bash history, it isn't safe anymore. Ok, so I decrypt the encrypted part via GnuPGInterface (you must open and close 3 different file handles for that). The decrypted text still contains header information and signature and is in MIME encoding (i.e. "quoted-printable"). Using regular expressions I look for the MIME boundary string and extract the message part. The headers tell me, it's in ISO-8859-15 encoding (= latin-9), same as 8859-1 (= latin-1) plus Euro sign. unicode(text, 'quoted-printable') isn't possible, because it returns string, not unicode. Of course - "quoted-printable" is no encoding by itself, but needs an encoding defined. unicode(text.decode('quoted-printable'), 'iso-8859-15') should work. * issue (3) [missing encoding in Python]: Python doesn't know ISO-8859-15! -- Hey, that exists since 1999! So I can't just use the detected encoding, but hardcode 'latin-1' instead (should usually fit my needs, but isn't generally usable), i.e. unicode(text.decode('quoted-printable'), 'latin-1') Now I've finally the readable text of the message in proper unicode. Let's make a reply mail: reply = message.reply(opening_window=True) I don't understand why usually a message window is invisible, but anyway, that works so far. reply.content.set(decrypted_text) Doesn't work: If I try it in PyCrust, the new text appears above the initial content, can't delete that. In my script I get only a CommandError: CommandError -10000: Apple event handler failed. Failed command: app(u'/Applications/ Mail.app').outgoing_messages.ID(409455472).content.set(u'bla') Despite that error, when I close Mail.app, a new message containing my text appears, i.e. instead of setting the content of my previously created reply mail, it makes a new outgoing message in the background. * issue (4) [appscript syntax for Mail.app]: How can I set the complete content of a reply message? Your help on any of that issues is appreciated! Greetlings from Lake Constance! Hraban --- http://www.fiee.net https://www.cacert.org (I'm an assurer) -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 3708 bytes Desc: not available URL: From the.spider at gmx.de Sun Aug 24 21:28:21 2008 From: the.spider at gmx.de (N3buK4Dn3ZZ4r) Date: Sun, 24 Aug 2008 12:28:21 -0700 (PDT) Subject: [Pythonmac-SIG] Creating Application() Message-ID: <19133860.post@talk.nabble.com> Hi there. I'm not a complete newbie in python, but in building GUIs. I've worked around a bit with Tkinter and I think, I can handle this one, but I also tried to work with the "FrameWork" module, to create Menubars and this kind of stuff. But I did not even get a Application() object createt. Could anyone please post a simple code example, that creates a Application() Object and a Menuitem or something like this? Thank you very much, N3buK4Dn3ZZ4r -- View this message in context: http://www.nabble.com/Creating-Application%28%29-tp19133860p19133860.html Sent from the Python - pythonmac-sig mailing list archive at Nabble.com. From Jack.Jansen at cwi.nl Sun Aug 24 23:28:51 2008 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Sun, 24 Aug 2008 23:28:51 +0200 Subject: [Pythonmac-SIG] Creating Application() In-Reply-To: <19133860.post@talk.nabble.com> References: <19133860.post@talk.nabble.com> Message-ID: <3CD63ABF-4357-4786-8FF9-00A25999F731@cwi.nl> On 24-Aug-2008, at 21:28 , N3buK4Dn3ZZ4r wrote: > > Hi there. > I'm not a complete newbie in python, but in building GUIs. I've worked > around a bit with Tkinter and I think, I can handle this one, but I > also > tried to work with the "FrameWork" module, to create Menubars and > this kind > of stuff. But I did not even get a Application() object createt. Could > anyone please post a simple code example, that creates a Application() > Object and a Menuitem or something like this? Unless you have a very good reason to use FrameWork (and it appears you don't, as you're just starting): stay away from FrameWork. It is almost 15 years old (originally written by Guido himself), uses MacOS9 APIs that are likely to disappear some time soon and hasn't been maintained in 7 years or so (I know, I was the last maintainer). If you want to try something new for GUI development: look at Cocoa/ PyObjC. It is completely unlike anything else and the learning curve can be pretty steep when you come from another GUI toolkit, but that's mainly because you have to un-learn a lot of things. A Cocoa GUI almost writes itself. I always have the feeling that I've somehow cheated when I'm done: the GUI works, but I don't remember actually writing any code:-) -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman -------------- next part -------------- An HTML attachment was scrubbed... URL: From dwf at cs.toronto.edu Mon Aug 25 07:45:26 2008 From: dwf at cs.toronto.edu (David Warde-Farley) Date: Mon, 25 Aug 2008 01:45:26 -0400 Subject: [Pythonmac-SIG] catching the Cmd+Q event In-Reply-To: <16E15E07-0BE0-4E91-A039-6182AD15E81A@fiee.net> References: <3CFD0273-F649-47E2-A9F5-5CD584C24B87@cs.toronto.edu> <16E15E07-0BE0-4E91-A039-6182AD15E81A@fiee.net> Message-ID: <30043800-2E7E-4E13-9FF7-350C256AA7E7@cs.toronto.edu> Hmm, that's an interesting idea. Do you mean to say __del__ of wx.App? David On 24-Aug-08, at 5:08 AM, Henning Hraban Ramm wrote: > Am 2008-08-24 um 10:41 schrieb David Warde-Farley: > >> I was wondering if anyone knew of a way to catch Cmd+Q in a >> threaded wx/Tkinter/etc. event loop. > > I remember catching the quit event of a wxPython loop on Windows > several years ago, because there was a zombie process left if I > didn't close the last window carefully. > As far as I can remember, I overwrote the __del__ method of the > application. > > > 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 From hraban at fiee.net Mon Aug 25 17:26:26 2008 From: hraban at fiee.net (Henning Hraban Ramm) Date: Mon, 25 Aug 2008 17:26:26 +0200 Subject: [Pythonmac-SIG] Creating Application() In-Reply-To: <3CD63ABF-4357-4786-8FF9-00A25999F731@cwi.nl> References: <19133860.post@talk.nabble.com> <3CD63ABF-4357-4786-8FF9-00A25999F731@cwi.nl> Message-ID: <604D2671-52BA-44F0-85F6-C8FB7F021C8F@fiee.net> Am 2008-08-24 um 23:28 schrieb Jack Jansen: >> I'm not a complete newbie in python, but in building GUIs. I've >> worked >> around a bit with Tkinter and I think, I can handle this one, but I >> also >> tried to work with the "FrameWork" module, to create Menubars and >> this kind >> of stuff. But I did not even get a Application() object createt. >> Could >> anyone please post a simple code example, that creates a >> Application() >> Object and a Menuitem or something like this? > > Unless you have a very good reason to use FrameWork (and it appears > you don't, as you're just starting): stay away from FrameWork. It is > almost 15 years old (originally written by Guido himself), uses > MacOS9 APIs that are likely to disappear some time soon and hasn't > been maintained in 7 years or so (I know, I was the last maintainer). > > If you want to try something new for GUI development: look at Cocoa/ > PyObjC. It is completely unlike anything else and the learning curve > can be pretty steep when you come from another GUI toolkit, but > that's mainly because you have to un-learn a lot of things. A Cocoa > GUI almost writes itself. I always have the feeling that I've > somehow cheated when I'm done: the GUI works, but I don't remember > actually writing any code:-) Do you think Cocoa is really usable without understanding a bit of ObjC? I'd suggest trying wxPython, preferably via dabo (see dabodev.com); unfortunately the documentation isn't that good, but the developers are really helpful. I agree that Cocoa is probably better, if you target OSX only. Greetlings from Lake Constance! Hraban --- http://www.fiee.net https://www.cacert.org (I'm an assurer) From djcypod at gmail.com Mon Aug 25 18:41:56 2008 From: djcypod at gmail.com (beau) Date: Mon, 25 Aug 2008 09:41:56 -0700 Subject: [Pythonmac-SIG] Creating Application() In-Reply-To: <604D2671-52BA-44F0-85F6-C8FB7F021C8F@fiee.net> References: <19133860.post@talk.nabble.com> <3CD63ABF-4357-4786-8FF9-00A25999F731@cwi.nl> <604D2671-52BA-44F0-85F6-C8FB7F021C8F@fiee.net> Message-ID: can anyone recommend some tutorials for Cocoa ObjectiveC? basically I'm trying to great a gui program that reads a file and then displays a visualization of it, with a slide. so everytime the ui will be different with Tkinter that was easy just write a function that packs things to the screen. ex: for item in list: Label(scrollfrawm(), text= item).grid(row=rows, column=0, sticky=W) rows += 1 On Mon, Aug 25, 2008 at 8:26 AM, Henning Hraban Ramm wrote: > Am 2008-08-24 um 23:28 schrieb Jack Jansen: > >>> I'm not a complete newbie in python, but in building GUIs. I've worked >>> around a bit with Tkinter and I think, I can handle this one, but I also >>> tried to work with the "FrameWork" module, to create Menubars and this >>> kind >>> of stuff. But I did not even get a Application() object createt. Could >>> anyone please post a simple code example, that creates a Application() >>> Object and a Menuitem or something like this? >> >> Unless you have a very good reason to use FrameWork (and it appears you >> don't, as you're just starting): stay away from FrameWork. It is almost 15 >> years old (originally written by Guido himself), uses MacOS9 APIs that are >> likely to disappear some time soon and hasn't been maintained in 7 years or >> so (I know, I was the last maintainer). >> >> If you want to try something new for GUI development: look at >> Cocoa/PyObjC. It is completely unlike anything else and the learning curve >> can be pretty steep when you come from another GUI toolkit, but that's >> mainly because you have to un-learn a lot of things. A Cocoa GUI almost >> writes itself. I always have the feeling that I've somehow cheated when I'm >> done: the GUI works, but I don't remember actually writing any code:-) > > Do you think Cocoa is really usable without understanding a bit of ObjC? > > I'd suggest trying wxPython, preferably via dabo (see dabodev.com); > unfortunately the documentation isn't that good, but the developers are > really helpful. > > I agree that Cocoa is probably better, if you target OSX only. > > > 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 > From m.vanland at gmail.com Mon Aug 25 23:15:41 2008 From: m.vanland at gmail.com (Michael VanLandingham) Date: Mon, 25 Aug 2008 14:15:41 -0700 Subject: [Pythonmac-SIG] building bundles with setuptools, py2app, 64-bit python 2.6 In-Reply-To: References: Message-ID: Finally getting back to this... So I built and installed setuptools from the 0.6 branch, which got me further, but now I get this macholib error (below) during py2app's linking phase. Any way around this or clues as to what it is? I don't see this error if I use the 32-bit python, just the 64 / 4-way fat. Another thing I'm seeing is that running setup.py py2app on my plugin w/ the 64-bit python and PyObjC is that it pulls in the 'whole world', OpenGL, documentation, everything. Running the same thing with the system Python doesn't do this. Consequently the resulting plugin bundle is too big and it takes much longer to build. Finally, doing 'lipo -info python2.6-64' suggests that the python-64 binary isn't just 64-bit, it's 4-way. Is that intentional? Thanks again, Michael linking /Volumes/max/Sandbox/workshop/PyTestBundle/dist/ PyTester.plugin/Contents/Frameworks/Python64.framework/Versions/ Current -> 2.6 Traceback (most recent call last): File "/Volumes/max/Sandbox/pyobjc_public/pyobjc/py2app/py2app/ build_app.py", line 579, in _run self.run_normal() File "/Volumes/max/Sandbox/pyobjc_public/pyobjc/py2app/py2app/ build_app.py", line 650, in run_normal self.create_binaries(py_files, pkgdirs, extensions, loader_files) File "/Volumes/max/Sandbox/pyobjc_public/pyobjc/py2app/py2app/ build_app.py", line 758, in create_binaries mm.mm.run_file(runtime) File "/Volumes/max/Sandbox/pyobjc_public/pyobjc/macholib/macholib/ MachOGraph.py", line 66, in run_file m = self.createNode(MachO, pathname) File "/Volumes/max/Sandbox/pyobjc_public/pyobjc/macholib/macholib/ MachOStandalone.py", line 23, in createNode res = super(FilteredMachOGraph, self).createNode(cls, name) File "/Volumes/max/Sandbox/pyobjc_public/pyobjc/altgraph/altgraph/ ObjectGraph.py", line 148, in createNode m = cls(name, *args, **kw) File "/Volumes/max/Sandbox/pyobjc_public/pyobjc/macholib/macholib/ MachO.py", line 63, in __init__ self.load(file(filename, 'rb')) File "/Volumes/max/Sandbox/pyobjc_public/pyobjc/macholib/macholib/ MachO.py", line 73, in load self.load_fat(fh) File "/Volumes/max/Sandbox/pyobjc_public/pyobjc/macholib/macholib/ MachO.py", line 81, in load_fat self.fat = fat_header.from_fileobj(fh) File "/Volumes/max/Sandbox/pyobjc_public/pyobjc/macholib/macholib/ ptypes.py", line 44, in from_fileobj return cls.from_str(f.read(cls._size_), **kw) File "/Volumes/max/Sandbox/pyobjc_public/pyobjc/macholib/macholib/ ptypes.py", line 48, in from_str return cls.from_tuple(struct.unpack(endian + cls._format_, s), **kw) error: unpack requires a string argument of length 8 > /Volumes/max/Sandbox/pyobjc_public/pyobjc/macholib/macholib/ ptypes.py(48)from_str() -> return cls.from_tuple(struct.unpack(endian + cls._format_, s), **kw) (Pdb) On Aug 21, 2008, at 4:02 AM, Ronald Oussoren wrote: > > On 20 Aug, 2008, at 5:05, Michael VanLandingham wrote: >> I recently built a Python64.framework & interpreter from the 2.6 >> sources (using Ronald O's recently recommended build settings), and >> then build PyObjC. Because I got an error running PyObjC's build >> script, (setup tries to pull down an URL that's non-existent: http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c8-py2.6.egg) >> , I built and installed setuptools from svn.python.org with/for my >> 4-way fat python build. >> >> I need to create 64-bit compatible versions of some PyObjC bundles >> that we're using. However, when I tried to use it, like this: >> >> $ /usr/local/python64 setup.py py2app >> >> I got the error below. Which points to what looks like a problem >> in setuptools. Can anyone offer any advice here? Maybe I need a >> less cutting edge version of setuptools? >> Is anyone using 64-bit python, PyObjC to build 64-bit or 4-way fat >> apps or plugin bundles, and if so, how? > > There might be issues with py2app and setuptools 0.7 (the trunk of > setuptools), the 0.6 branch of setuptools should work fine. -------------- next part -------------- An HTML attachment was scrubbed... URL: From hengist.podd at virgin.net Mon Aug 25 23:44:14 2008 From: hengist.podd at virgin.net (has) Date: Mon, 25 Aug 2008 22:44:14 +0100 Subject: [Pythonmac-SIG] controlling Mail.app and GnuPG In-Reply-To: References: Message-ID: <6BCAF426-4EE3-47F1-85E1-8B303A8C24AB@virgin.net> Henning Hraban Ramm wrote: > It is known that the public API of Apple's Mail.app is incomplete > and buggy, therefore stuff like the GnuPG plugin stay in eternal > beta (and just don't work on my German system - I guess i might my a > language problem). > Anyway. > > I tried to write a little helper for GPG encrypted mails - before I > dragged the "encrypted.asc" attachment in some folder, called gpg in > the bash, copied the decrypted text back in my reply window and > replaced all the MIME codes with proper umlauts etc. > (I can encrypt the mail via S/MIME, my friend can decrypt that, but > didn't get S/MIME encryption to work in her Linux Thunderbird or > Evolution, so she sends GPG encrypted...) > > So, my script gets the selected message in Mail.app... > > * issue (1) [appscript syntax for Mail.app]: > I can list the attachments with appscript, but I didn't find a way > to save them or to access them as files. Something like this should work (assuming the files don't already exist in the destination folder): message = app('Mail').selection()[0] for attachment in message.mail_attachments(): attachment.save(in_=mactypes.File(u'/path/to/outfolder/' + attachment.name())) > Now I've finally the readable text of the message in proper unicode. > Let's make a reply mail: > > reply = message.reply(opening_window=True) > > I don't understand why usually a message window is invisible, but > anyway, that works so far. > > reply.content.set(decrypted_text) > > Doesn't work: If I try it in PyCrust, the new text appears above the > initial content, can't delete that. > In my script I get only a CommandError: > > CommandError -10000: Apple event handler failed. > Failed command: app(u'/Applications/ > Mail.app').outgoing_messages.ID(409455472).content.set(u'bla') > > Despite that error, when I close Mail.app, a new message containing > my text appears, i.e. instead of setting the content of my > previously created reply mail, it makes a new outgoing message in > the background. > > * issue (4) [appscript syntax for Mail.app]: > How can I set the complete content of a reply message? Dunno offhand; might have time to look into it tomorrow unless anyone else has any ideas. As you say, Mail's scripting interface is less than stellar. BTW, you could also try asking on Apple's AppleScript- users mailing list; I expect there's a few folk there who've had dealings with Mail as well and might be able to shed some light on the problem. HTH has -- Control AppleScriptable applications from Python, Ruby and ObjC: http://appscript.sourceforge.net From pascal.bompard at gmail.com Tue Aug 26 04:17:18 2008 From: pascal.bompard at gmail.com (Pascal Bompard) Date: Tue, 26 Aug 2008 10:17:18 +0800 Subject: [Pythonmac-SIG] Creating Application() In-Reply-To: References: <19133860.post@talk.nabble.com> <3CD63ABF-4357-4786-8FF9-00A25999F731@cwi.nl> <604D2671-52BA-44F0-85F6-C8FB7F021C8F@fiee.net> Message-ID: <9D149AEF-CF80-498D-8252-95063613CE91@gmail.com> This tutorial series is brand new: http://lethain.com/entry/2008/aug/22/an-epic-introduction-to-pyobjc-and-cocoa/ Looks like a good one too, although I can't verify that as I haven't had the time to work through it yet. I have worked through a few tuts at http://cocoadevcentral.com/ and can vouch that they're very good, although they're pure Cocoa/ObjC - not PyObjC. Also, if you'd like a walk through of using Xcode 3 to produce Cocoa apps, I found this to be a nice introduction: http://www.viddler.com/explore/cocoaheads/videos/1/ On 26/08/2008, at 12:41 AM, beau wrote: > can anyone recommend some tutorials for Cocoa ObjectiveC? > > basically I'm trying to great a gui program that reads a file and then > displays a visualization of it, with a slide. > > so everytime the ui will be different > > with Tkinter that was easy just write a function that packs things to > the screen. > > ex: > for item in list: > Label(scrollfrawm(), text= item).grid(row=rows, column=0, sticky=W) > rows += 1 > > > On Mon, Aug 25, 2008 at 8:26 AM, Henning Hraban Ramm > wrote: >> Am 2008-08-24 um 23:28 schrieb Jack Jansen: >> >>>> I'm not a complete newbie in python, but in building GUIs. I've >>>> worked >>>> around a bit with Tkinter and I think, I can handle this one, but >>>> I also >>>> tried to work with the "FrameWork" module, to create Menubars and >>>> this >>>> kind >>>> of stuff. But I did not even get a Application() object createt. >>>> Could >>>> anyone please post a simple code example, that creates a >>>> Application() >>>> Object and a Menuitem or something like this? >>> >>> Unless you have a very good reason to use FrameWork (and it >>> appears you >>> don't, as you're just starting): stay away from FrameWork. It is >>> almost 15 >>> years old (originally written by Guido himself), uses MacOS9 APIs >>> that are >>> likely to disappear some time soon and hasn't been maintained in 7 >>> years or >>> so (I know, I was the last maintainer). >>> >>> If you want to try something new for GUI development: look at >>> Cocoa/PyObjC. It is completely unlike anything else and the >>> learning curve >>> can be pretty steep when you come from another GUI toolkit, but >>> that's >>> mainly because you have to un-learn a lot of things. A Cocoa GUI >>> almost >>> writes itself. I always have the feeling that I've somehow cheated >>> when I'm >>> done: the GUI works, but I don't remember actually writing any >>> code:-) >> >> Do you think Cocoa is really usable without understanding a bit of >> ObjC? >> >> I'd suggest trying wxPython, preferably via dabo (see dabodev.com); >> unfortunately the documentation isn't that good, but the developers >> are >> really helpful. >> >> I agree that Cocoa is probably better, if you target OSX only. >> >> >> 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 >> > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig From kw at codebykevin.com Tue Aug 26 16:02:57 2008 From: kw at codebykevin.com (Kevin Walzer) Date: Tue, 26 Aug 2008 10:02:57 -0400 Subject: [Pythonmac-SIG] Creating Application() In-Reply-To: <9D149AEF-CF80-498D-8252-95063613CE91@gmail.com> References: <19133860.post@talk.nabble.com> <3CD63ABF-4357-4786-8FF9-00A25999F731@cwi.nl> <604D2671-52BA-44F0-85F6-C8FB7F021C8F@fiee.net> <9D149AEF-CF80-498D-8252-95063613CE91@gmail.com> Message-ID: <48B40D11.1010407@codebykevin.com> > On 26/08/2008, at 12:41 AM, beau wrote: > >> can anyone recommend some tutorials for Cocoa ObjectiveC? >> >> basically I'm trying to great a gui program that reads a file and then >> displays a visualization of it, with a slide. >> >> so everytime the ui will be different >> >> with Tkinter that was easy just write a function that packs things to >> the screen. >> >> ex: >> for item in list: >> Label(scrollfrawm(), text= item).grid(row=rows, column=0, sticky=W) >> rows += 1 >> If you've used Tkinter and are comfortable with it, why not just use that for your GUI? It runs fine on the Mac, and is much simpler, especially if you don't need the bells and whistles of Cocoa. -- Kevin Walzer Code by Kevin http://www.codebykevin.com From kaerbuhez at gmail.com Wed Aug 27 13:39:32 2008 From: kaerbuhez at gmail.com (Kaer Buhez) Date: Wed, 27 Aug 2008 13:39:32 +0200 Subject: [Pythonmac-SIG] py2app and bdist_mpkg on Linux? Message-ID: Arne Babenhauserheide (http://mail.python.org/pipermail/pythonmac-sig/2008-May/020023.html) wrote: >The use of py2app on GNU/Linux is, that I want to distribute apps to non-linux >users, but I don't have MacOSX running anywhere near. > >I develop on my Gentoo Box, and I want to be able to create programs for >friends of mine who use MacOSX. > >Python is cross platform, but to really use that advantage, I need to be able >to distribute Python programs for individual platforms easily. > >And I want to enable other Linux users to do the same. Kevin Walzer (http://mail.python.org/pipermail/pythonmac-sig/2008-May/020024.html) wrote: >If you want to distribute standalone apps with the Python interpreter >embedded, that can't be done in a cross-platform manner. A Python binary >built on Linux won't run on OS X. Ronald Oussoren (http://mail.python.org/pipermail/pythonmac-sig/2008-May/020046.html) wrote: >It should in theory be possible to enhance py2app to support this. The >Carbon.File dependency is only needed for alias builds, and those are >only useful during development anyway. > >I'd be surprised if this works out of the box though, first of all >distutils isn't very well suited to cross-compilation anyway and >py2app probably has hardcoded locations that won't exist on you're >Gentoo box. > >And as a final observation: distributing builds without testing is >wishful thinking. It would be much more worthwhile to ask one of >you're friends if you can use their system to do the initial debugging >on MacOSX and afterwards ask them to build the MacOSX binaries for you. I develop a standalone cross-platform python/wxpython app on linux and I have exactly the same concern (on ubuntu). I would make sure that there is no simple solution to use py2app on linux to build the comprehensive bundle (with a python interpreter and wxpython in it) that I can send to mac os x users. I planned to use one (not two) mac to test the bundle anyway and I could use it to run py2app. My concern is that I need to test the bundle on this mac afterwards and I am afraid that my (wx)python installs will false the test. Then my question: what is the best way to install python and test afterwards ? different users, uninstall everything ... how ? Thx in advance for your ideas, suggestions ... KB From djcypod at gmail.com Wed Aug 27 21:11:44 2008 From: djcypod at gmail.com (beau) Date: Wed, 27 Aug 2008 12:11:44 -0700 Subject: [Pythonmac-SIG] py2app import framework Message-ID: I am trying to do a framework build to import tk and python2.5 for my application bundle with py2app This is the page I've been looking at: http://livingcode.org/tag/distribution """ This is a setup.py script generated by py2applet Usage: python setup.py py2app """ import objc, AppKit, Foundation, os from setuptools import setup objc.loadBundle('Tcl.framework', globals(), bundle_path='/Library/Frameworks/Tcl.framework') APP = ['appName.py'] DATA_FILES = [] OPTIONS = {'argv_emulation': True} setup( app=APP, data_files=DATA_FILES, options={'py2app': OPTIONS}, setup_requires=['Tcl.framework'], ) do I have to add anything to the appName.py to inorder to build these and execute them on other machines that maynot have tk or have an earlier version of python installed? also are there any command line arguments when running the /usr/bin/pyhton setup.py py2app --framework=Tcl.framework --framework=Python.framework? From Chris.Barker at noaa.gov Wed Aug 27 21:53:29 2008 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Wed, 27 Aug 2008 12:53:29 -0700 Subject: [Pythonmac-SIG] py2app import framework In-Reply-To: References: Message-ID: <48B5B0B9.8000206@noaa.gov> beau wrote: > I am trying to do a framework build to import tk and python2.5 for my > application bundle with py2app > """ > This is a setup.py script generated by py2applet > > Usage: > python setup.py py2app > """ > > import objc, AppKit, Foundation, os > > from setuptools import setup > > objc.loadBundle('Tcl.framework', globals(), > bundle_path='/Library/Frameworks/Tcl.framework') > > APP = ['appName.py'] > DATA_FILES = [] > OPTIONS = {'argv_emulation': True} > > setup( > app=APP, > data_files=DATA_FILES, > options={'py2app': OPTIONS}, > setup_requires=['Tcl.framework'], > ) Is that the exact script you got from py2applet? All that objc.loadbundle etc should not be required. Did you try the very simplest setup.py first? A tk app should just built automagically. > do I have to add anything to the appName.py to inorder to build these > and execute them on other machines that maynot have tk or have an > earlier version of python installed? what python are you using? if you are using the Framework build from python.org, then it should all "just work". If you are using the Apple supplied python, then py2app will not include python itself. -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 selassid at carleton.edu Wed Aug 27 20:43:37 2008 From: selassid at carleton.edu (David Selassie) Date: Wed, 27 Aug 2008 11:43:37 -0700 Subject: [Pythonmac-SIG] py2app PyOpenGL "Unable to find an implementation" Error Message-ID: I'm trying to package up a program I wrote that uses PyOpenGL-3.0.0b4-py2.5.egg, numpy-1.1.1-py2.5-macosx-10.3-ppc.egg installed with easy_install and PIL. I know there's been a bit of trouble getting PyOpenGL scripts to play nicely in py2app, but I have not been able to find any help about anyone that has run into the error "RuntimeError: Unable to find an implementation for the 'darwin' ('posix') platform". Generating the app file runs without complaint but this error occurs when trying to run the program. Does anyone have any suggestions as to the cause or what to do? The console log is as follows: ----------------------------------------------------------------------------- 8/27/08 11:29:25 AM PyTensor[4893] PyTensor Error 8/27/08 11:29:25 AM PyTensor[4893] PyTensor Error An unexpected error has occurred during execution of the main script RuntimeError: Unable to find an implementation for the 'darwin' ('posix') platform 8/27/08 11:29:25 AM [0x0-0x6e06e].org.pythonmac.unspecified.PyTensor[4893] Traceback (most recent call last): 8/27/08 11:29:25 AM [0x0-0x6e06e].org.pythonmac.unspecified.PyTensor[4893] File "/Users/selassid/Projects/PyTensor/dist/PyTensor.app/Contents/Resources/__boot__.py", line 158, in 8/27/08 11:29:25 AM [0x0-0x6e06e].org.pythonmac.unspecified.PyTensor[4893] _run('PyTensor.py') 8/27/08 11:29:25 AM [0x0-0x6e06e].org.pythonmac.unspecified.PyTensor[4893] File "/Users/selassid/Projects/PyTensor/dist/PyTensor.app/Contents/Resources/__boot__.py", line 134, in _run 8/27/08 11:29:25 AM [0x0-0x6e06e].org.pythonmac.unspecified.PyTensor[4893] execfile(path, globals(), globals()) 8/27/08 11:29:25 AM [0x0-0x6e06e].org.pythonmac.unspecified.PyTensor[4893] File "/Users/selassid/Projects/PyTensor/dist/PyTensor.app/Contents/Resources/PyTensor.py", line 10, in 8/27/08 11:29:25 AM [0x0-0x6e06e].org.pythonmac.unspecified.PyTensor[4893] from OpenGL.GL import * 8/27/08 11:29:25 AM [0x0-0x6e06e].org.pythonmac.unspecified.PyTensor[4893] File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/PyOpenGL-3.0.0b4-py2.5.egg/OpenGL/GL/__init__.py", line 2, in 8/27/08 11:29:25 AM [0x0-0x6e06e].org.pythonmac.unspecified.PyTensor[4893] from OpenGL.raw.GL import * 8/27/08 11:29:25 AM [0x0-0x6e06e].org.pythonmac.unspecified.PyTensor[4893] File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/PyOpenGL-3.0.0b4-py2.5.egg/OpenGL/raw/GL/__init__.py", line 6, in 8/27/08 11:29:25 AM [0x0-0x6e06e].org.pythonmac.unspecified.PyTensor[4893] from OpenGL.raw.GL.constants import * 8/27/08 11:29:25 AM [0x0-0x6e06e].org.pythonmac.unspecified.PyTensor[4893] File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/PyOpenGL-3.0.0b4-py2.5.egg/OpenGL/raw/GL/constants.py", line 7, in 8/27/08 11:29:25 AM [0x0-0x6e06e].org.pythonmac.unspecified.PyTensor[4893] from OpenGL import platform, arrays 8/27/08 11:29:25 AM [0x0-0x6e06e].org.pythonmac.unspecified.PyTensor[4893] File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/PyOpenGL-3.0.0b4-py2.5.egg/OpenGL/platform/__init__.py", line 57, in 8/27/08 11:29:25 AM [0x0-0x6e06e].org.pythonmac.unspecified.PyTensor[4893] _load() 8/27/08 11:29:25 AM [0x0-0x6e06e].org.pythonmac.unspecified.PyTensor[4893] File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/PyOpenGL-3.0.0b4-py2.5.egg/OpenGL/platform/__init__.py", line 53, in _load 8/27/08 11:29:25 AM [0x0-0x6e06e].org.pythonmac.unspecified.PyTensor[4893] sys.platform, os.name, 8/27/08 11:29:25 AM [0x0-0x6e06e].org.pythonmac.unspecified.PyTensor[4893] RuntimeError: Unable to find an implementation for the 'darwin' ('posix') platform 8/27/08 11:29:27 AM com.apple.launchd[149] ([0x0-0x6e06e].org.pythonmac.unspecified.PyTensor[4893]) Exited with exit code: 255 ----------------------------------------------------------------------------- Thanks for your help. - David Selassie From Chris.Barker at noaa.gov Thu Aug 28 17:47:07 2008 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Thu, 28 Aug 2008 08:47:07 -0700 Subject: [Pythonmac-SIG] py2app import framework In-Reply-To: References: <48B5B0B9.8000206@noaa.gov> Message-ID: <48B6C87B.1070605@noaa.gov> beau wrote: >> Is that the exact script you got from py2applet? All that objc.loadbundle >> etc should not be required. > > > No this is the modification of script based on the webpage that I > found just switching Tcl.framework for Renaissance.framework That is probably not required -- Tcl/Tk comes standard with python -- it should not need any special handling. > it works on my machine where I built TK and Python2.5 but not on other > machines that don't have those libraries. So I'm trying to build a > bundle that is totally self contained. again: >> what python are you using? This can make all the difference. not just the version number, but what build, how/where was it installed? I think the build from python,org is your best bet if you want to distribute with py2app. -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 Chris.Barker at noaa.gov Thu Aug 28 19:39:39 2008 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Thu, 28 Aug 2008 10:39:39 -0700 Subject: [Pythonmac-SIG] py2app import framework In-Reply-To: References: <48B5B0B9.8000206@noaa.gov> <48B6C87B.1070605@noaa.gov> Message-ID: <48B6E2DB.9080902@noaa.gov> Please make sure your messages go to the pythonmac list also -- it's not the default if you hit "reply" beau wrote: >>>> what python are you using? >> This can make all the difference. not just the version number, but what >> build, how/where was it installed?> > > I built it from source code downloaded at python.org why not just use the standard binary? > Python 2.5.1 (r251:54863, Apr 15 2008, 22:57:26) > > lrwxr-xr-x 1 root group 72 Aug 13 19:00 /usr/bin/python -> > ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/python That's odd -- I didn't think the source distro installed into "System". Are you sure you're not using Apple-supplied one? Are you on 10.5? anyway, I'm sorry I can't help with a self-built one -- i have no idea what extra issues there may be. -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 djcypod at gmail.com Thu Aug 28 23:04:36 2008 From: djcypod at gmail.com (beau) Date: Thu, 28 Aug 2008 14:04:36 -0700 Subject: [Pythonmac-SIG] py2app import framework In-Reply-To: <48B6E2DB.9080902@noaa.gov> References: <48B5B0B9.8000206@noaa.gov> <48B6C87B.1070605@noaa.gov> <48B6E2DB.9080902@noaa.gov> Message-ID: On Thu, Aug 28, 2008 at 10:39 AM, Christopher Barker wrote: > Please make sure your messages go to the pythonmac list also -- it's not the > default if you hit "reply" > > beau wrote: >>>>> >>>>> what python are you using? >>> >>> This can make all the difference. not just the version number, but what >>> build, how/where was it installed?> >> >> I built it from source code downloaded at python.org > > why not just use the standard binary? > >> Python 2.5.1 (r251:54863, Apr 15 2008, 22:57:26) >> >> lrwxr-xr-x 1 root group 72 Aug 13 19:00 /usr/bin/python -> >> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/python > > That's odd -- I didn't think the source distro installed into "System". Are > you sure you're not using Apple-supplied one? Are you on 10.5? > > anyway, I'm sorry I can't help with a self-built one -- i have no idea what > extra issues there may be. I wanted to build it as a framework, I'll try the binary since you said that it worked for you > -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 hraban at fiee.net Fri Aug 29 18:15:51 2008 From: hraban at fiee.net (Henning Hraban Ramm) Date: Fri, 29 Aug 2008 18:15:51 +0200 Subject: [Pythonmac-SIG] controlling Mail.app and GnuPG In-Reply-To: <6BCAF426-4EE3-47F1-85E1-8B303A8C24AB@virgin.net> References: <6BCAF426-4EE3-47F1-85E1-8B303A8C24AB@virgin.net> Message-ID: <09856A6C-614E-415A-942E-F7FF35C7C567@fiee.net> Am 2008-08-25 um 23:44 schrieb has: >> * issue (1) [appscript syntax for Mail.app]: >> I can list the attachments with appscript, but I didn't find a way >> to save them or to access them as files. > > Something like this should work (assuming the files don't already > exist in the destination folder): > > message = app('Mail').selection()[0] > for attachment in message.mail_attachments(): > attachment.save(in_=mactypes.File(u'/path/to/outfolder/' + > attachment.name())) Thank you, that works. Now I can drop my MIME attachment decoding. >> Now I've finally the readable text of the message in proper unicode. >> Let's make a reply mail: >> >> reply = message.reply(opening_window=True) >> >> I don't understand why usually a message window is invisible, but >> anyway, that works so far. >> >> reply.content.set(decrypted_text) >> >> Doesn't work: If I try it in PyCrust, the new text appears above >> the initial content, can't delete that. >> In my script I get only a CommandError: >> >> CommandError -10000: Apple event handler failed. >> Failed command: app(u'/Applications/ >> Mail.app').outgoing_messages.ID(409455472).content.set(u'bla') >> >> Despite that error, when I close Mail.app, a new message containing >> my text appears, i.e. instead of setting the content of my >> previously created reply mail, it makes a new outgoing message in >> the background. >> >> * issue (4) [appscript syntax for Mail.app]: >> How can I set the complete content of a reply message? > > Dunno offhand; might have time to look into it tomorrow unless > anyone else has any ideas. As you say, Mail's scripting interface is > less than stellar. BTW, you could also try asking on Apple's > AppleScript-users mailing list; I expect there's a few folk there > who've had dealings with Mail as well and might be able to shed some > light on the problem. I found a blog entry that collects some of Mail.app's bugs, including this: http://willwont.blogspot.com/2008/04/applescripting-mailapp.html I also found a thread on an Apple list, where several guys tried to get replies working (and didn't) - strangely at one of them's machine it worked (but even there only after each other restart of Mail.app): http://lists.apple.com/archives/applescript-users/2007/Jan/threads.html#00085 Remember I got it partly working from PyCrust, but not from my own script - there's a trick involved anywhere... Here's another attempt: reply = message.reply(opening_window=True) reply.close(saving=k.no) # close useless reply for m in mailapp.outgoing_messages(): m.visible.set(True) # make hidden messages visible I tried "everything", but didn't manage to set any outgoing_message's content or add a recipient. I thought the following should work: reply.to_recipients.end.make( new=k.recipient, with_properties={ 'address': message.sender.extract_address_from(), 'name': message.sender.extract_name_from() }) reply.content.set(decrypted) Now I just copy my content to the clipboard ( osax.ScriptingAddition.set_clipboard_to() ), so I can paste it as reply. Greetlings from Lake Constance! Hraban --- http://www.fiee.net https://www.cacert.org (I'm an assurer) -------------- next part -------------- An HTML attachment was scrubbed... URL: From joelosco at frontiernet.net Sat Aug 30 19:33:02 2008 From: joelosco at frontiernet.net (Joseph W. Losco) Date: Sat, 30 Aug 2008 13:33:02 -0400 Subject: [Pythonmac-SIG] Py2App and Appscript / wxPython Message-ID: <4A5DDCCC-AA71-4EBA-A5F6-F8505736037C@frontiernet.net> Hey all, I have an app that I've been trying to compile / bundle with py2app for a little while now. I have been having some trouble and I did a little research online and learned that py2app can't bundle egg files, except I thought I saw somewhere that the SVN version can.. So I've tried with easy_install py2app==dev with its dependancy modulegraph==dev. I also tried downloading the uncompiled source of appscript (which I'm not sure if i did properly, but i did a python setup.py develop so that it would not compile to an egg. The error I'm getting is listed below as well as my setup.py (with minor error differences that I can tell from the versions of py2app and appscript) Any help would be greatly appreciated. Joe Losco Error after running python setup.py py2app running py2app Traceback (most recent call last): File "/Users/josephlosco/Library/Python/2.5/site-packages/ py2app-0.4.2-py2.5.egg/py2app/build_app.py", line 579, in _run self.run_normal() File "/Users/josephlosco/Library/Python/2.5/site-packages/ py2app-0.4.2-py2.5.egg/py2app/build_app.py", line 631, in run_normal mf = self.get_modulefinder() File "/Users/josephlosco/Library/Python/2.5/site-packages/ py2app-0.4.2-py2.5.egg/py2app/build_app.py", line 539, in get_modulefinder debug=debug, File "build/bdist.macosx-10.3-i386/egg/modulegraph/ find_modules.py", line 255, in find_modules find_needed_modules(mf, scripts, includes, packages) File "build/bdist.macosx-10.3-i386/egg/modulegraph/ find_modules.py", line 190, in find_needed_modules path = m.packagepath[0] TypeError: 'NoneType' object is unsubscriptable > /Users/josephlosco/Code/hg/CalendarSyncGUI/build/bdist.macosx-10.3- i386/egg/modulegraph/find_modules.py(190)find_needed_modules() My setup.py file is as follows. #!/usr/bin/env python """ setup.py - script for building CalendarSync Usage: % python setup.py py2app """ from distutils.core import setup import py2app from plistlib import Plist import os name = 'CalendarSync' version = '1.0.0' # Build the .app file setup( app=[ name + '.py' ], options=dict( py2app=dict( iconfile='CalendarSync.icns', packages=['wx','appscript'], site_packages=True, resources=['resources/COPYING','CalendarSync.icns'], plist=dict( CFBundleName = "CalendarSync", CFBundleShortVersionString = "1.0.0", # must be in X.X.X format CFBundleGetInfoString = "CalendarSync 1.0.0", CFBundleExecutable = "CalendarSync", ), ), ), ) From coolcucumber at gmail.com Sun Aug 31 03:43:01 2008 From: coolcucumber at gmail.com (John Porter Simons) Date: Sat, 30 Aug 2008 18:43:01 -0700 Subject: [Pythonmac-SIG] Making setuptools compile for x86_64 Message-ID: <678ff0e00808301843r32228730ia1ef4c4c7ce04284@mail.gmail.com> I'm new to this list, sorry if this was already asked. I installed (py-)appscript using "setup.py install" and it works fine from an interactive session, but when I try to use it from python loaded into Apache through mod_python, I get this error: Could not import darkporter.jukebox.views. Error was: dlopen(/Library/WebServer/.python-eggs/appscript-0.19.0-py2.5-macosx-10.5-i386.egg-tmp/aem/ae.so, 2): no suitable image found. Did find: /Library/WebServer/.python-eggs/appscript-0.19.0-py2.5-macosx-10.5-i386.egg-tmp/aem/ae.so: no matching architecture in universal wrapper Which I think is because Apache runs in 64-bit so any scripts loaded in also will? If I do "file" on that .so I get: /Library/WebServer/.python-eggs/appscript-0.19.0-py2.5-macosx-10.5-i386.egg-tmp/aem/ae.so: Mach-O universal binary with 2 architectures /Library/WebServer/.python-eggs/appscript-0.19.0-py2.5-macosx-10.5-i386.egg-tmp/aem/ae.so (for architecture i386): Mach-O bundle i386 /Library/WebServer/.python-eggs/appscript-0.19.0-py2.5-macosx-10.5-i386.egg-tmp/aem/ae.so (for architecture ppc7400): Mach-O bundle ppc Any way to inform setuptools that I also need "x86_64" architecture? I also ran into this problem while installing mod_python, dinked around with the makefile flags but gave up until I discovered that the latest subversion trunk has the correct flags for 64-bit. If I really have to I could recompile Apache in 32-bit, but I'm hoping that won't be necessary. -------------- next part -------------- An HTML attachment was scrubbed... URL: From coolcucumber at gmail.com Sun Aug 31 05:02:08 2008 From: coolcucumber at gmail.com (John Porter Simons) Date: Sat, 30 Aug 2008 20:02:08 -0700 Subject: [Pythonmac-SIG] Rocketship in the Dock Message-ID: <678ff0e00808302002ra6c4c93xe6b2bf3b1355f628@mail.gmail.com> There was a thread back in April: On 29 Mar 2008, at 09:11, Alex MacCaw wrote: > > >* Thanks - that works. > *>* I'm wondering how to get rid of the python rocket ship that appears > *>* in the dock when I start sending applescript events. I've tried > *>* deleting the object reference to app('Finder') but to no avail. > * > > The command line python interpreter automatically upgrades to a full > GUI process whenever OS APIs linked to the Window Manager are called. > In appscript's case, it uses the Carbon Process Manager to launch > applications and obtain their process IDs. > > This behaviour is useful when running scripts that need to display > dialogs, etc. to users, but it's a nuisance the rest of the time and > is something I'd like to get rid of if possible. I'm stuffed for spare > time at the moment, but if anyone else fancies rewriting the relevant > code then do let me know. > > Cheers, > > has > -- > Control AppleScriptable applications from Python, Ruby and ObjC: > http://appscript.sourceforge.net > > I can run appscript from an interactive session and just ignore the rocketship in the dock, but when I run the same script from a Apache/mod_python, it hangs. Probably because Apache doesn't run as a normal user so it can't get a GUI context. This is a bummer, I was able to use rb-appscript from a web script, I wish I could use py-appscript... Someone on this thread mentioned forking appscript to take out the GUI stuff, any chance they would share those changes with me? -------------- next part -------------- An HTML attachment was scrubbed... URL: From airdrummer at wheel.org Sun Aug 31 14:40:51 2008 From: airdrummer at wheel.org (tom wible) Date: Sun, 31 Aug 2008 08:40:51 -0400 Subject: [Pythonmac-SIG] Rocketship in the Dock In-Reply-To: <678ff0e00808302002ra6c4c93xe6b2bf3b1355f628@mail.gmail.com> References: <678ff0e00808302002ra6c4c93xe6b2bf3b1355f628@mail.gmail.com> Message-ID: <48BA9153.5080402@wheel.org> > Apache/mod_python, it hangs. Probably because Apache doesn't run as a > normal user so it can't get a GUI context. This is a bummer, I was able i solved that problem by modding the sudoers file: Cmnd_Alias DVR_cmds=/usr/bin/osascript, /DVR/webAccess/scripts/*.sh www ALL=(DVR_ra) NOPASSWD: DVR_cmds