From cygnusxlist at mac.com Sat Sep 1 04:42:57 2007 From: cygnusxlist at mac.com (cygnusxlist at mac.com) Date: Fri, 31 Aug 2007 22:42:57 -0400 Subject: [Pythonmac-SIG] Strange failure on 'python setup.py build' after 10.4.10 update In-Reply-To: <6BCF182C-C398-49DB-8420-3371CDCCC9AA@mac.com> References: <6BCF182C-C398-49DB-8420-3371CDCCC9AA@mac.com> Message-ID: On Aug 31, 2007, at 8:17 AM, Edward Hartley wrote: >> >> From: cygnusxlist at mac.com >> Date: 30 August 2007 23:26:46 BDT >> To: pythonmac-sig at python.org >> Subject: [Pythonmac-SIG] Strange failure on 'python setup.py >> build' after 10.4.10 update >> >> >> My G5 at work has started spitting out this message when I try to >> build a python package from source. The previous week I completed >> many builds with no problem. I did similar builds on my home >> system with no problem. >> >> The major change at work was I finally installed the 10.4.10 >> update (and suddenly had to change my $PATH to get python 2.4 >> back!) and my home system is still at 10.4.9. >> > I would check that the default python is in fact 2.4 or whatever > version you think it should be and not an earlier version. > You may have had an Apple build of python included in this update. > This would overwrite any symbolic links to the 2.4 install you made > after the original OS install. > Which would explain why you had to change the $PATH > Certainly doing a full install of XCode will cause the default > python to revert to 2.3 Deleting MACOSX_DEPLOYMENT_TARGET enabled me to run the builds. I notice my laptop does not have that defined at all. The problem machine is a clean install so there were no older pythons installed. I had rarely set the PATH after installing the main MacPython package it would always use the new version. Of course, if that was working due to a link, it would certainly explain the behavior I encountered. Thanks, Tom From kesc at pacbell.net Tue Sep 4 20:29:34 2007 From: kesc at pacbell.net (Karl Sweitzer) Date: Tue, 4 Sep 2007 11:29:34 -0700 Subject: [Pythonmac-SIG] Python/appscript ready for primetime? Message-ID: Is Python's appscript suitable and sufficiently mature for deployment in a commercial application? With the demise of VBA in Microsoft Office, we are faced with transitioning scripts that manipulate equations in Office and manage the interoperation of our application with Office. AppleScript is an obvious candidate, but coyote ugly in the eyes of many developers, including us. We are looking for viable alternatives. Python, augmented by appscript to access the Word Object Model, is the best candidate we've identified thus far. However, we have negligible experience with Python and zero experience with appscript. Further, we note that appscript has not reached version 1.0. Has anybody out there used Python and appscript for a commercial product? Does it deserve active consideration? Are there other candidates we should be considering? If you have an opinion--or better yet, experience in this area--we'd like to hear from you. Thanks. -- Karl Sweitzer From glassfordm at gmail.com Wed Sep 5 15:24:18 2007 From: glassfordm at gmail.com (Michael Glassford) Date: Wed, 05 Sep 2007 09:24:18 -0400 Subject: [Pythonmac-SIG] Python/appscript ready for primetime? In-Reply-To: References: Message-ID: <46DEAE02.8060908@gmail.com> Karl Sweitzer wrote: > Is Python's appscript suitable and sufficiently mature for deployment > in a commercial application? > > With the demise of VBA in Microsoft Office, we are faced with > transitioning scripts that manipulate equations in Office and manage > the interoperation of our application with Office. AppleScript is an > obvious candidate, but coyote ugly in the eyes of many developers, > including us. We are looking for viable alternatives. > > Python, augmented by appscript to access the Word Object Model, is > the best candidate we've identified thus far. However, we have > negligible experience with Python and zero experience with appscript. > Further, we note that appscript has not reached version 1.0. It has been around for quite some time, however. > Has anybody out there used Python and appscript for a commercial > product? The Mac version of Goombah (www.goombah.com) uses it. > Does it deserve active consideration? Yes, you should consider it, although only you can determine if it will ultimately work for you. The greatest difficulty we had is that, at times translating AppleScript commands to appscript commands is tricky and there are not a lot of examples available, but we always got it working in the end. > Are there other > candidates we should be considering? Not in Python, that I'm aware of. I believe there are somewhat similar libraries for Ruby and Perl, though I have no experience with either. > If you have an opinion--or better yet, experience in this area--we'd > like to hear from you. > > Thanks. You're welcome. Mike From glassfordm at gmail.com Wed Sep 5 15:24:18 2007 From: glassfordm at gmail.com (Michael Glassford) Date: Wed, 05 Sep 2007 09:24:18 -0400 Subject: [Pythonmac-SIG] Python/appscript ready for primetime? In-Reply-To: References: Message-ID: <46DEAE02.8060908@gmail.com> Karl Sweitzer wrote: > Is Python's appscript suitable and sufficiently mature for deployment > in a commercial application? > > With the demise of VBA in Microsoft Office, we are faced with > transitioning scripts that manipulate equations in Office and manage > the interoperation of our application with Office. AppleScript is an > obvious candidate, but coyote ugly in the eyes of many developers, > including us. We are looking for viable alternatives. > > Python, augmented by appscript to access the Word Object Model, is > the best candidate we've identified thus far. However, we have > negligible experience with Python and zero experience with appscript. > Further, we note that appscript has not reached version 1.0. It has been around for quite some time, however. > Has anybody out there used Python and appscript for a commercial > product? The Mac version of Goombah (www.goombah.com) uses it. > Does it deserve active consideration? Yes, you should consider it, although only you can determine if it will ultimately work for you. The greatest difficulty we had is that, at times translating AppleScript commands to appscript commands is tricky and there are not a lot of examples available, but we always got it working in the end. > Are there other > candidates we should be considering? Not in Python, that I'm aware of. I believe there are somewhat similar libraries for Ruby and Perl, though I have no experience with either. > If you have an opinion--or better yet, experience in this area--we'd > like to hear from you. > > Thanks. You're welcome. Mike From daniel at keystonewood.com Wed Sep 5 14:56:12 2007 From: daniel at keystonewood.com (Daniel Miller) Date: Wed, 05 Sep 2007 08:56:12 -0400 Subject: [Pythonmac-SIG] Python/appscript ready for primetime? In-Reply-To: References: Message-ID: <837B695C-0964-40E1-9CCF-411A84856BD4@keystonewood.com> Karl, Karl Sweitzer wrote: > Is Python's appscript suitable and sufficiently mature for deployment > in a commercial application? I've used appscript for simple tasks (e.g. attaching a PDF to an email) in an in-house application where I work. It works great for what I need to do. My only complaint is that the AppleScript API's are not always documented very well--I'm not sure how Word's AppleScript is documented. That and AppleScript has the strangest grammar I have ever encountered in a programming language. > With the demise of VBA in Microsoft Office, we are faced with > transitioning scripts that manipulate equations in Office and manage > the interoperation of our application with Office. AppleScript is an > obvious candidate, but coyote ugly in the eyes of many developers, > including us. We are looking for viable alternatives. Depending on what you are doing, it may work out well for you to write a wrapper (implemented in Python and appscript) around the parts of the Word Object Model that you will be using. This would provide you with a nicer-to-use API than what appscript will give you, and then appscript becomes an implementation detail. Of course this may not be an option if you are using too much of the Word Object Model. > Python, augmented by appscript to access the Word Object Model, is > the best candidate we've identified thus far. However, we have > negligible experience with Python and zero experience with appscript. > Further, we note that appscript has not reached version 1.0. I think you will find Python to be a very nice alternative to VB. Make sure you really dig into learning Python. Compared to VB you'll find it much simpler to implement many things. But as the saying goes "you can write Fortran in any language". Be sure to learn the Python conventions and not just translate your VB conventions directly to Python. > Has anybody out there used Python and appscript for a commercial > product? Does it deserve active consideration? Are there other > candidates we should be considering? I would say it definitely deserves some consideration, and I personally don't know of any other candidates. ~ Daniel From karstenw at eichhorn-frankfurt.de Wed Sep 5 18:00:46 2007 From: karstenw at eichhorn-frankfurt.de (Karsten Wolf) Date: Wed, 5 Sep 2007 18:00:46 +0200 Subject: [Pythonmac-SIG] Python/appscript ready for primetime? In-Reply-To: References: Message-ID: Hi, Am 04.09.2007 um 20:29 schrieb Karl Sweitzer: > Is Python's appscript suitable and sufficiently mature for deployment > in a commercial application? You'll have to find out about the commercial part yourself, but... I started Python (with appscript, py2app, pyobjc (which you'll all need if want to go commercial)) about 5 month ago and it's simply the best tool I have. It takes a while (like any new language you learn) and AppleEvent Object hierarchies take their own time until they do what you want... plus you not only learn a new language but also some new FrameWorks. > With the demise of VBA in Microsoft Office, we are faced with > transitioning scripts that manipulate equations in Office and manage > the interoperation of our application with Office. AppleScript is an > obvious candidate, but coyote ugly in the eyes of many developers, > including us. We are looking for viable alternatives. I havent looked at recent Office versions but the older ones were (IIRC Word 8 or 9) had an impressive AppleEvent dictionary. > Python, augmented by appscript to access the Word Object Model, is > the best candidate we've identified thus far. However, we have > negligible experience with Python and zero experience with appscript. > Further, we note that appscript has not reached version 1.0. Most open source projects don't have a marketing department that pushes version numbers unnecessary. They tick by a different clock... and are usable at v0.1 ;-) appscript is very mature. > Has anybody out there used Python and appscript for a commercial > product? Not me. > Does it deserve active consideration? Yes! > Are there other > candidates we should be considering? The only candidates I would consider also use appscript (rb-appscript & objc-appscript; together with py-appscript in the sourceforge repository). If you're into Lisp: there seems to be some decent AppleEvent support in one of the commercial Lisps. I haven't used it and am not sure which one it was (MCL or LispWorks). If you find another one, please let me know. I switched over from Frontier and have nearly identical opinions about AppleScript... > If you have an opinion--or better yet, experience in this area--we'd > like to hear from you. The ability to develop in an interactive environment (have a look at your objects at the command line) together with very rich libraries and frameworks and the ability to tap into the world of cocoa make py- appscript the __only__ candidate I would consider for your needs Take a look at the appscript, pyobjc and py2app examples. http://sourceforge.net/projects/pyobjc/ http://undefined.org/python/py2app.html -karsten From hengist.podd at virgin.net Wed Sep 5 23:24:55 2007 From: hengist.podd at virgin.net (has) Date: Wed, 5 Sep 2007 22:24:55 +0100 Subject: [Pythonmac-SIG] Python/appscript ready for primetime? In-Reply-To: References: Message-ID: Karl Sweitzer wrote: > Is Python's appscript suitable and sufficiently mature for > deployment in a commercial application? For Apple event IPC, yes. Py-appscript has been around since 2003 and provides the same level of functionality as AppleScript and virtually [1] the same level of application compatibility. If you also need OSA attachability support (which allows you to attach scripts to applications that support it, e.g. Mail rules, folder actions), AppleScript remains the most dependable option here. There is a PyOSA component on the appscript site that's usable with care, but it's not yet mature enough for deploying in the wild. > With the demise of VBA in Microsoft Office, we are faced with > transitioning scripts that manipulate equations in Office and > manage the interoperation of our application with Office. > AppleScript is an obvious candidate, but coyote ugly in the eyes of > many developers, including us. We are looking for viable alternatives. AppleScript is the benchmark by which other Apple event bridges are best measured (even if the language sucks in other respects), since that's what application developers generally develop and test against. Of the third-party alternatives, appscript is by far the best candidate. The Python and Ruby versions are quite mature; the ObjC version still needs a bit of work (I just need to make some time for it) though is already pretty usable. > Python, augmented by appscript to access the Word Object Model, is > the best candidate we've identified thus far. However, we have > negligible experience with Python and zero experience with appscript. For general advice on Python, best place to ask is comp.lang.python. For Mac-specific advice, including questions on appscript, ask here. For Mac Office advice, probably best to start with the microsoft.public.mac.office.* newsgroups. Best person to speak to about Office scripting is Paul Berkowitz, author of MacTech's VBA-to- AppleScript transition guide which you'll no doubt want to read if you've not already done so. Another person you might want to speak to is Matt Neuburg, author of "AppleScript: The Definitive Guide" (which I'd recommend buying if you need to learn AppleScript). And I'll be happy to provide advice on AppleScript and appscript, of course. > Further, we note that appscript has not reached version 1.0. Sub-1.0 version numbers are pretty common in OSS, and don't tell you much about a project's functionality/reliability/stability/maturity. The core appscript modules (CarbonX.AE, aem, appscript) have been pretty stable over the last couple years; one or two significant API shake-ups, but mainly just periodical bug fixes, feature enhancements and/or compatibility improvements. The Ruby version of appscript recently went beta, and I'm hoping to do the same with the Python version sometime before the year's end. BTW, I am planning some changes for the next release of py-appscript as part of the pre-beta tidy-up - ask if you want details - but nothing that'll stop you using it right now. There's also work to do on 64-bit compatibility (this is true of all Mac-specific Python extensions that need it, btw, including those in the standard library), which will happen sometime after Leopard's release once I can afford a new laptop. > Has anybody out there used Python and appscript for a commercial > product? I believe Omni are using Rails and rb-appscript to provide a web interface to their upcoming OmniFocus product, and there may be others I don't know about. > Are there other candidates we should be considering? Python/Ruby/ObjC appscript would be your best choice; as well as being the best third-party Apple event bridge, it also provides several very useful developer tools: - built-in help systems for exploring dictionaries and object models in interactive Python and Ruby interpreters (the osadict command-line tool bundled with py-appscript also provides access to most of this system, which is handy if you're using objc-appscript) - ASDictionary for exporting application dictionaries to HTML in AppleScript and Python/Ruby/ObjC appscript formats - ASTranslate for converting application commands from AppleScript to Python or Ruby appscript syntax. If you want a list of all the other available bridges then just let us know, although there aren't any I would recommend. HTH has [1] There may still be the odd as-yet undiscovered compatibility issue since there are a lot of quirky applications out there. I think I've dealt with 3 or 4 this year, though new reports are increasingly rare as appscript is pretty good these days at mimicking AppleScript's own undocumented quirks and general sloppiness. However, if you should discover any compatibility problems that don't exist in AppleScript then file a bug report and I'll fix them and/or provide a suitable workaround ASAP. -- http://appscript.sourceforge.net http://rb-appscript.rubyforge.org From njriley at uiuc.edu Sat Sep 8 20:53:47 2007 From: njriley at uiuc.edu (Nicholas Riley) Date: Sat, 8 Sep 2007 13:53:47 -0500 Subject: [Pythonmac-SIG] py-appscript changes to filtering? Message-ID: <20070908185347.GA35403@uiuc.edu> Hi, I ran into a bug with py-appscript 0.17.2 (handling apps that had quit while you still had a reference to them) and updated to the current trunk. This fixed this problem but broke some of my other code. This code: systemEvents = app(id='com.apple.systemEvents') frontName = systemEvents.processes[its.frontmost][1].name() which worked fine with 0.17.2 doesn't work any more. I get: File "/Library/Python/2.3/site-packages/appscript-0.18.0-py2.3-macosx-10.4-ppc.egg/appscript/reference.py", line 457, in __getitem__ return Reference(self.AS_appdata, self.AS_aemreference.byfilter( File "/Library/Python/2.3/site-packages/appscript-0.18.0-py2.3-macosx-10.4-ppc.egg/aem/types/objectspecifiers/specifier.py", line 385, in byfilter return ElementsByFilter(self.AEM_want, self, expression) File "/Library/Python/2.3/site-packages/appscript-0.18.0-py2.3-macosx-10.4-ppc.egg/aem/types/objectspecifiers/specifier.py", line 425, in __init__ raise TypeError, 'Not a test specifier: %r' % key TypeError: Not a test specifier: its.property('pisf') It works if I use [its.frontmost == True], but that's kind of ugly. Is this intentional? Thanks, -- Nicholas Riley | From vivacarlie at gmail.com Sat Sep 8 21:51:36 2007 From: vivacarlie at gmail.com (Nehemiah Dacres) Date: Sat, 8 Sep 2007 14:51:36 -0500 Subject: [Pythonmac-SIG] python mailer Message-ID: <65fadfc30709081251l5989d892qd888d7078c3edbb6@mail.gmail.com> I've read info about python mailer programs like a python mailer daemon for sending mail and a python mail app for downloading it. can anyone give me any personal openion on these. I want to make a terminal analog to Thunderbird/Mail.app/Outlook so i dont have to run them as the memory hoggs they are. If it doesn't exist i will probiblly write one. -- "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: http://mail.python.org/pipermail/pythonmac-sig/attachments/20070908/403aae7a/attachment.htm From hengist.podd at virgin.net Mon Sep 10 15:30:53 2007 From: hengist.podd at virgin.net (has) Date: Mon, 10 Sep 2007 14:30:53 +0100 Subject: [Pythonmac-SIG] py-appscript changes to filtering? In-Reply-To: References: Message-ID: <27822EDB-98AA-4908-B5C8-FBD98A3C0D59@virgin.net> Nicholas Riley wrote: > I ran into a bug with py-appscript 0.17.2 (handling apps that had quit > while you still had a reference to them) and updated to the current > trunk. This fixed this problem but broke some of my other code. This > code: > > systemEvents = app(id='com.apple.systemEvents') > frontName = systemEvents.processes[its.frontmost][1].name() > > which worked fine with 0.17.2 doesn't work any more. [...] > > It works if I use [its.frontmost == True], but that's kind of ugly. > Is this intentional? It's deliberate. From aem's History.txt: - byfilter method no longer accepts non-test specifiers as test clauses. Previously, a reference such as 'its.visible' would automatically be expanded to the comparison test 'its.visible.eq (true)' as a convenience. However, this shortcut didn't apply when these non-test references appeared as arguments to the AND and OR logical test methods, which meant that this shortcut behaviour was inconsistent and potentially confusing; therefore it has been removed. Users should update existing code as necessary. While the automatic expansion was nice, leaving it as-was would go against appscript's policy of providing added user convenience only as long as it doesn't impact consistency/reliability, and adding it to AND and OR methods would have been tricky due to the way that appscript and aem interact. So it got yanked. Bit of a pity, but can't be helped. BTW, note that there's a few minor but non-backwards-compatibile API changes happening for 0.18.0. (I know I declared the API finalised in 0.17.0, but that was mostly in case Apple decided to use appscript in Leopard and once they didn't I decided to clean up some remaining warts. Apologies in advance for any inconvenience this may cause, etc.) See the aem and appscript History.txt files for details. HTH has -- http://appscript.sourceforge.net http://rb-appscript.rubyforge.org From ohseungchan1 at gmail.com Fri Sep 14 10:45:24 2007 From: ohseungchan1 at gmail.com (Seungchan Oh) Date: Fri, 14 Sep 2007 01:45:24 -0700 Subject: [Pythonmac-SIG] Which python version is supported by PyObjC? Message-ID: <4e50f0cd0709140145kffd9f17l43a858a98f31858f@mail.gmail.com> Hello, As the title say, which Python version is supported by latest PyObjC? TIA SC -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20070914/61842087/attachment.htm From ronaldoussoren at mac.com Fri Sep 14 11:49:27 2007 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Fri, 14 Sep 2007 02:49:27 -0700 Subject: [Pythonmac-SIG] Which python version is supported by PyObjC? In-Reply-To: <4e50f0cd0709140145kffd9f17l43a858a98f31858f@mail.gmail.com> References: <4e50f0cd0709140145kffd9f17l43a858a98f31858f@mail.gmail.com> Message-ID: On Friday, September 14, 2007, at 10:47AM, "Seungchan Oh" wrote: >Hello, >As the title say, which Python version is supported by latest PyObjC? Python 2.4 and 2.5 are fully tested. Python 2.3.5 (that is, the version that Apple ships) should also work but is less well tested. The binary installer situation is not very good at the moment and I don't have time to build new ones right now (building is easy, but the installer needs to be tested to). W.r.t. installers: my plan for PyObjC 2.0 is to do away with binary installers, but rely on setuptools (that is 'easy_install pyobjc==2.0' to install PyObjC) for installation and have separate downloads for the other goodies (documentation, examples, ...). Building from source shouldn't to hard: just download the sources (either from the website or a checkout from the repository) and use 'python setup.py install ' to install, or use 'python setup.py bdist_mpkg --open' to install all extra's as well. Ronald From janssen at parc.com Fri Sep 14 17:46:10 2007 From: janssen at parc.com (Bill Janssen) Date: Fri, 14 Sep 2007 08:46:10 PDT Subject: [Pythonmac-SIG] Which python version is supported by PyObjC? In-Reply-To: References: <4e50f0cd0709140145kffd9f17l43a858a98f31858f@mail.gmail.com> Message-ID: <07Sep14.084614pdt."57996"@synergy1.parc.xerox.com> > Building from source shouldn't to hard: just download the sources > (either from the website or a checkout from the repository) and use > 'python setup.py install ' to install, or use 'python setup.py > bdist_mpkg --open' to install all extra's as well. Is there any support (a bdist) for the iPhone yet? I'd like to use this with the Python 2.5.1 (http://iphone.natetrue.com/) for the iPhone to tinker with UIKit. Bill From pxl at sonic.net Sat Sep 15 21:35:59 2007 From: pxl at sonic.net (Paul Archibald) Date: Sat, 15 Sep 2007 12:35:59 -0700 Subject: [Pythonmac-SIG] warning: newbie ahead Message-ID: Greeting Comrades, I am a (Mac) C++/Java programmer looking to expand myself into Python. I have been working through some tutorials, which has made me want more, but I am having trouble understanding how to organize and manage the project files that I write or otherwise obtain. What I am looking for is how to manage my PDE (Python Development Environment) and project file so that I can write real programs, saving, loading and executing, importing modules and calling functions from various modules that I have written or otherwise obtained. I have grabbed some code from various places on the web, but I don't know where to put the files so that I an use them, except for opening them in the editor and executing them, which is nice but does not let me build real programs. So, if you are building a program, where do you keep your sourcecode for that progam, and how does Python know how to find it, and how do you "link" modules together to make bigger programs? There is a little info on configuration in the Mac Modules tutorial, but it I still have some problems with .py scripts that seem to execute okay but from which I cannot import any methods. I am using IDLE w/Python 2.5, which does not have the "set scripts folder" command like MacPython 2.4. Sorry this is a newbie question, but heck, I'm newbie! And I work alone, so I have nobody to ask or even look over the shoulder of to see how its all set up. Thanks, Paul From kw at codebykevin.com Sun Sep 16 00:03:47 2007 From: kw at codebykevin.com (Kevin Walzer) Date: Sat, 15 Sep 2007 18:03:47 -0400 Subject: [Pythonmac-SIG] warning: newbie ahead In-Reply-To: References: Message-ID: <46EC56C3.2050003@codebykevin.com> Paul Archibald wrote: > What I am looking for is how to manage my PDE (Python Development > Environment) and project file so that I can write real programs, > saving, loading and executing, importing modules and calling > functions from various modules that I have written or otherwise > obtained. I have grabbed some code from various places on the web, > but I don't know where to put the files so that I an use them, except > for opening them in the editor and executing them, which is nice but > does not let me build real programs. I'd take a closer look at the Python tutorial that comes with Idle (under the "help" menu--select "Python docs"). Section 6, "Modules," has some discussion on how modules are organized. The simplest way to import a module is to put your code in a file called "foo.py", launch Python from the same working directory where "foo.py" is stored, and then type in "import foo". All the bits in that module will be available to you. There are also standard directories, such as site-packages, where extension modules can be stored (this directory is /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/ on my system). There's plenty of additional documentaiton on the net, and in basic Python books, about how Python libraries are organized. Python doesn't really have the concept of a "project file"--I assume this is something generated by an IDE to keep track of where everything is stored? I know Xcode uses this approach. There may be Python IDE's that do this also; Idle does not, however, and this is what I use for most of my editing. > > So, if you are building a program, where do you keep your sourcecode > for that progam, and how does Python know how to find it, and how do > you "link" modules together to make bigger programs? I keep my code in two places: the current working directory of my application, or in site-packages (if I'm using a generic package). > > There is a little info on configuration in the Mac Modules tutorial, > but it I still have some problems with .py scripts that seem to > execute okay but from which I cannot import any methods. > > I am using IDLE w/Python 2.5, which does not have the "set scripts > folder" command like MacPython 2.4. The command you are referring to was part of the old MacPython IDE, which is now obsolete. It was replaced as the standard editor in MacPython 2.5 by Idle. > > Sorry this is a newbie question, but heck, I'm newbie! And I work > alone, so I have nobody to ask or even look over the shoulder of to > see how its all set up. I hope these answers are helpful. A complete introduction to Python is beyond what I can provide, but there are lots of resources out there, and Python should be a snap to pick up if you're experienced with C++ and Java. --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com From hraban at fiee.net Sun Sep 16 00:12:54 2007 From: hraban at fiee.net (Henning Hraban Ramm) Date: Sun, 16 Sep 2007 00:12:54 +0200 Subject: [Pythonmac-SIG] warning: newbie ahead In-Reply-To: References: Message-ID: <0B1DD002-4AB1-44FD-A9F8-CF5890B42AF9@fiee.net> Am 2007-09-15 um 21:35 schrieb Paul Archibald: > I am a (Mac) C++/Java programmer looking to expand myself into > Python. I have been working through some tutorials, which has made me > want more, but I am having trouble understanding how to organize and > manage the project files that I write or otherwise obtain. > > What I am looking for is how to manage my PDE (Python Development > Environment) and project file so that I can write real programs, > saving, loading and executing, importing modules and calling > functions from various modules that I have written or otherwise > obtained. I have grabbed some code from various places on the web, > but I don't know where to put the files so that I an use them, except > for opening them in the editor and executing them, which is nice but > does not let me build real programs. > > So, if you are building a program, where do you keep your sourcecode > for that progam, and how does Python know how to find it, and how do > you "link" modules together to make bigger programs? > > There is a little info on configuration in the Mac Modules tutorial, > but it I still have some problems with .py scripts that seem to > execute okay but from which I cannot import any methods. > > I am using IDLE w/Python 2.5, which does not have the "set scripts > folder" command like MacPython 2.4. As a Java guy you're surely comfortable with Eclipse, and PyDev for Eclipse makes a good Python IDE. A pure Python IDE would be SPE (see http://pythonide.blogspot.com/). Please dump IDLE. A Python projects demans no special folder structure, but if you plan to deploy your projects to anyone/where else, I'd propose that you only keep a small loader script in your main folder and everything else in subfolders - that looks cleanest and runs fastest, because the called script is never precompiled (the other files become .pyc or .pyo) and thus loads slowest. Of course you can simply import classes and functions from any Python file in the same folder. A Python "package" is just a folder with an __init__.py and as much class/module files as you like. While the folder is on your Python path, you can just import it like "import mystuff" or "from mystuff import myclass, myotherclass". If you need the same classes for several projects, you could install your libs in site-packages (e.g. /Library/Frameworks/Python.framework/ Versions/Current/lib/python2.5/site-packages). I guess you know the official tutorial? http://docs.python.org/tut/tut.html Greetlings from Lake Constance! Hraban --- http://www.fiee.net https://www.cacert.org (I'm an assurer) From hraban at fiee.net Sun Sep 16 19:25:47 2007 From: hraban at fiee.net (Henning Hraban Ramm) Date: Sun, 16 Sep 2007 19:25:47 +0200 Subject: [Pythonmac-SIG] design questions: new hierarchy/tree class? Message-ID: <954f61110709161025m3c308f4fx38fe238c37466762@mail.gmail.com> Dear gang, I don't want to re-invent the wheel, but I couldn't find what I intend to write... Everyone needs classes for hierarchical data - e.g. for directory trees but also for GUI menu hierarchies or GUI TreeControls - and sometimes you've to generate some GUI tree from a dir tree, which itself can be local or remote (e.g. FTP). Further I need to derive trees from data in some SQL database. Thus I look for a general solution for hierarchical objects. Please discuss and hint if there are ready solutions that I could adapt. [Use case #1: CD cover generator for backups] The cover of a backup CD (for internal archive or for a customer) should depict a tree of some of the contents - read in the file system of a CD/DVD - display it in a wx tree view (the user decides which directories to expand) - generate graphical output format (e.g. TeX, EPS, SVG) [Use case #2: menu for a website] The menu should be changable online for the site admin. - read data from MySQL via a django model - present it as HTML [Use case #3: virtual directory on a website] Users should get a look at some FTP directories that they can't access directly, the view depends from their permissions. - read a FTP tree - cache it in a database - present it filtered as HTML [TREE ITEM CLASS] My approach would be to put most logic in the tree item like this: class TreeItem(object): parent = None # reference or None for root children = [] # list defines order id = None # simply integer ids? Is it enough to define the neighbours of objects through their order in their parent's children? I'd prefer if the item only knows its parent and its children, but doesn't store its absolute path (position in the hierarchy) to simplify reordering - if you move a directory, you would only change the parent reference and the parents' childrens list, not every single entry. I don't care about arbitrary objects in the tree; I'd simply derive several specialized types for my use cases from a base class. Or do you think that a mixin or decorator approach would be better? (Never did that yet.) [TREE CLASS] For initialization I'd like to hand some URI to the tree like those: MUST: file:///Users/user/Documents/workspace --> directory tree ftp://user:password at ftp.domain.tld/mypath --> ftpTree directory tree mysql://user:password at localhost/database/table?id=123 --> tree from linked database rows sqlite:///path/to/database/file.ext/table?name=this --> like mysql MORE IDEAS: wxglade://myapp.xml/anything --> get GUI objects hierarchy wxmenu://application/ --> grab menu tree from app somehow? http://www.domain.tld/index.html --> tree of linked html documents (?) (In the case of HTML documents we'd need to specify if we want the inner structure or a sitemap, but that's not my first concern ;-) The tree object would decide which Item type to choose depending on the service declaration - so one could simply plug in another service handler for a new item type. For those URIs I need a general URI parser; urlparse can't do that; see also http://mail.python.org/pipermail/python-dev/2005-November/058359.html (Mike Brown said he implemented that in 4Suite's Ft.Lib.Uri; didn't look at that yet.) It should be easy to convert such a tree to XML (pickle everything that doesn't fit else...) and then you could use XQuery on it - so I need not to implement an own query syntax. Conversion to nested dicts and JSON should be as easy. I'd be glad about some useful hints! Greetlings, Hraban From deveritt at innotts.co.uk Mon Sep 17 12:30:11 2007 From: deveritt at innotts.co.uk (Dave Everitt) Date: Mon, 17 Sep 2007 11:30:11 +0100 Subject: [Pythonmac-SIG] Macports and Django install problems Message-ID: <77FBD535-B3D8-4A23-8D0D-86A39804C152@innotts.co.uk> After reading about other OS X user's Django install problems, I'm attempting to write up the simplest, clearest possible, completely unambiguous, instructions for other OS X users here: http:ecoconsulting.co.uk/python/django-install.txt but obviously I need to get it right first, and... ...I've hit problems with Macports, detailed below. But I can't find anywhere how to install Django from within Python (like Perl's CPAN), and Macports is actually suggested on the Django site. ----------------- The steps I took: 1. Install Python 2.5 from the OS X binary at: http://www.python.org/ftp/python/2.5.1/python-2.5.1-macosx.dmg End up with the following - good so far: python -V:Python 2.5.1 which python:/Library/Frameworks/Python.framework/Versions/Current/ bin/python The OS X package appears to have replaced Apple's Python 2.3 with 2.5.1 successfully. 2. Use Macports to install Django 0.96: sudo port install py25-django-devel Add the Macports path to my .bash_login (and remove .profile): export PATH=/opt/local/bin:/opt/local/sbin:$PATH End up with the following: django-admin.py gives: (the expected screen of stuff) but >>> import django gives: ImportError: No module named django. ------------ The problem: While installing Django, the Macports dependency thing also installs Python 2.5 under /opt/local/lib/python2.5/ I know OS X needs Python elswhere (and I now appear to have 2 Pythons) but the running one doesn't have Django in its 'site- packages' dir. Looks like I might have to forget Macports and install Django manually under the OS X Python (or copy it across), but will this risk being mangled by OS X updates? And is there an easy Python 'install django' command? --------------- About Macports: Macports is a good idea (easy installs and updates, preserves Apple stuff, keeps new stuff separate from getting mashed by Apple updates) but the Python it installs isn't in the place OS X expects it to be, so can't be used easily. The Django site itself suggests Macports, but fails to say that the install won't be where the OS X Python expects it to be. Dave Everitt From adagio at cs.tu-berlin.de Mon Sep 17 17:59:11 2007 From: adagio at cs.tu-berlin.de (Wolfram Eifler) Date: Mon, 17 Sep 2007 17:59:11 +0200 Subject: [Pythonmac-SIG] Workaround: XCode fails to see py2app Message-ID: The Problem: ------------ Building an python-project from xcode results in: ImportError: No module named py2app ImportError: No module named py2app maybe it arises only if more than one python-version are (or have been) installed on the mac where the building takes place. maybe only in combination with installs of PyObjC with the dmg-installers. I had not the possibility to verify these to assumptions. there has been the proposal to change the first line of setup.py from #!/usr/bin/env python to #! somwhere on the internet. That works but is ---- *BAD* !!!! Programming Style ----. I stumbled about the fact that the build worked when using the teminal - even if i used exactly the same Command and options, which xcode does. The Difference turned out to be the search-path of the user. My shell-environment has the location of python in it. So instead of crunching the code of every setup.py i wrote a shell- snippet named xcode-pyhelper.sh as follows: -------------script begins ---------- #!/bin/sh PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}" /usr/bin/env python $* -------------script ends ---------- i put it in my home-directory /Users/my_username/bin/xcode-pyhelper.sh and changed the project-build-preferences in xcode (while project is open) via project -> Edit active Target (window pops up, containing the string /usr/bin/env in the field Build-Tool) changed the Build-Tool to my brandnew threeline-script /Users/my_username/bin/xcode-pyhelper.sh Build works. This method is ugly too, but at least i do not need to coding-style that securely would fail on all non-mac Platforms (Or does anybody else install python in *that* location... ?). :) adagio From bray at sent.com Wed Sep 19 00:18:18 2007 From: bray at sent.com (Brian Ray) Date: Tue, 18 Sep 2007 17:18:18 -0500 Subject: [Pythonmac-SIG] Macports and Django install problems In-Reply-To: <77FBD535-B3D8-4A23-8D0D-86A39804C152@innotts.co.uk> References: <77FBD535-B3D8-4A23-8D0D-86A39804C152@innotts.co.uk> Message-ID: <1C00F41D-E940-4A48-84DD-B0D8B646DB5D@sent.com> I am glad your doing this, but... I wish Leopard would ship with Django or there was a tool to install. I know Ruby on Rails is there. Already for, Ruby on Rails, there is a program called Locomotive . Have not tried this, but, (you see where I am getting) we need an installer/ monitor for Django on OSX. Documentation is great. I also encourage/applaud this, regardless. However we need a installer/montitor app for Django development on on OSX. Does anyone know if one already exists or has been started? I would consider helping. Brian Ray bray at sent.com http://kazavoo.com/blog From Chris.Barker at noaa.gov Wed Sep 19 00:48:06 2007 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Tue, 18 Sep 2007 15:48:06 -0700 Subject: [Pythonmac-SIG] Workaround: XCode fails to see py2app In-Reply-To: References: Message-ID: <46F055A6.7060302@noaa.gov> Wolfram Eifler wrote: > there has been the proposal to change the first line of setup.py from > #!/usr/bin/env python > to > #! > somwhere on the internet. That works but is ---- *BAD* !!!! > Programming Style ----. Agreed, but: #!/usr/bin/env python2.5 Isn't so bad -- indeed, I like it, as it makes it quite clear what version of python your code has been tested on. Of course, python2.5 will have to be on your PATH for this to work. -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 nad at acm.org Wed Sep 19 00:52:45 2007 From: nad at acm.org (Ned Deily) Date: Tue, 18 Sep 2007 15:52:45 -0700 Subject: [Pythonmac-SIG] Macports and Django install problems References: <77FBD535-B3D8-4A23-8D0D-86A39804C152@innotts.co.uk> Message-ID: In article <77FBD535-B3D8-4A23-8D0D-86A39804C152 at innotts.co.uk>, Dave Everitt wrote: > After reading about other OS X user's Django install problems, I'm > attempting to write up the simplest, clearest possible, completely > unambiguous, instructions for other OS X users here: > http:ecoconsulting.co.uk/python/django-install.txt > but obviously I need to get it right first, and... > > ...I've hit problems with Macports, detailed below. But I can't find > anywhere how to install Django from within Python (like Perl's CPAN), > and Macports is actually suggested on the Django site. > > > ----------------- > The steps I took: > > 1. > Install Python 2.5 from the OS X binary at: > http://www.python.org/ftp/python/2.5.1/python-2.5.1-macosx.dmg > > End up with the following - good so far: > python -V:Python 2.5.1 > which python:/Library/Frameworks/Python.framework/Versions/Current/ > bin/python > > The OS X package appears to have replaced Apple's Python 2.3 with > 2.5.1 successfully. Just to be clear, installing 2.5.1 this way does not replace Apple's 2.3, it adds another version, albeit in a different location. > 2. > Use Macports to install Django 0.96: > sudo port install py25-django-devel > > Add the Macports path to my .bash_login (and remove .profile): > export PATH=/opt/local/bin:/opt/local/sbin:$PATH > > End up with the following: > django-admin.py gives: (the expected screen of stuff) > but > >>> import django gives: ImportError: No module named django. > > > ------------ > The problem: > > While installing Django, the Macports dependency thing also installs > Python 2.5 under /opt/local/lib/python2.5/ > > I know OS X needs Python elswhere (and I now appear to have 2 > Pythons) but the running one doesn't have Django in its 'site- > packages' dir. > > Looks like I might have to forget Macports and install Django > manually under the OS X Python (or copy it across), but will this > risk being mangled by OS X updates? And is there an easy Python > 'install django' command? Actually you now have at least 3 versions of Python installed: 1. the Apple 2.3 version at /System/Library/Frameworks/Python.framework 2. the "official" python.org 2.5.1 version at /Library/Frameworks/Python.framework 3. the MacPorts 2.5.1 version built by the port command at /opt/local/lib/python2.5 All 3 can happily co-exist with each other, btw. In all depends on which version of the python interpreter you start. For example: /usr/bin/python2.3 /usr/local/bin/python2.5 /opt/local/bin/python2.5 Of course, you need only one of the two 2.5.1's, not both. (Do not try de-installing the Apple 2.3 one. That is the only one that might be touched by OS X updates.) I'm feeling a bit lazy to try it all again from scratch but I'd suggest forgetting about MacPorts for this. For most users, it should be much simpler to stick to the "official" 2.5.1 version, then getting setuptools installed, and then using easy_install to install Django and additional site packages needed. I believe you *should* be able to download and install Django directly with easy_install with a properly configured setuptools started from the correct python. Good luck and thanks for helping to document this better. -- Ned Deily, nad at acm.org From bwaters at nrao.edu Wed Sep 19 06:31:11 2007 From: bwaters at nrao.edu (Boyd Waters) Date: Tue, 18 Sep 2007 22:31:11 -0600 Subject: [Pythonmac-SIG] relocatable Python framework? Message-ID: <764456A5-5C7B-4EAB-BDFB-5FBBBFDD0BF1@nrao.edu> Hello all! I maintain a scientific data-analysis application that my team has ported to the Macintosh. It's a bunch of C++ strung together with Python, and so far that's worked really well. I want to package this collection of C++ and Python into a Macintosh application. And I want the Python framework to go inside the application. We'd start via a shell script that calls the Python inside our application package. I've got all the other frameworks and libs set up as relocatable objects. But Python is not playing along. Maybe the user will drag our app bundle to /Applications, but maybe not. I can't know where everything is until run-time. How to I ship the Python framework as a relocatable package inside our application? Thanks! - boyd Boyd Waters programmer national radio astronomy observatory http://www.aoc.nrao.edu/~bwaters From emanuelesantos at gmail.com Wed Sep 19 07:14:39 2007 From: emanuelesantos at gmail.com (Emanuele Santos) Date: Tue, 18 Sep 2007 23:14:39 -0600 Subject: [Pythonmac-SIG] py2app and qt jpeg plugin Message-ID: Hi, I am having problems to show jpeg images on my bundled application using pyqt4. I know that the problem is with the qt plugins. How does py2app handle them? Because if try to run from my source tree it works fine. Thanks, -- Emanuele. From ronaldoussoren at mac.com Wed Sep 19 07:11:55 2007 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Wed, 19 Sep 2007 07:11:55 +0200 Subject: [Pythonmac-SIG] relocatable Python framework? In-Reply-To: <764456A5-5C7B-4EAB-BDFB-5FBBBFDD0BF1@nrao.edu> References: <764456A5-5C7B-4EAB-BDFB-5FBBBFDD0BF1@nrao.edu> Message-ID: On 19 Sep, 2007, at 6:31, Boyd Waters wrote: > Hello all! > > I maintain a scientific data-analysis application that my team has > ported to the Macintosh. It's a bunch of C++ strung together with > Python, and so far that's worked really well. > > I want to package this collection of C++ and Python into a Macintosh > application. And I want the Python framework to go inside the > application. We'd start via a shell script that calls the Python > inside our application package. > > I've got all the other frameworks and libs set up as relocatable > objects. But Python is not playing along. > > Maybe the user will drag our app bundle to /Applications, but maybe > not. I can't know where everything is until run-time. > > How to I ship the Python framework as a relocatable package inside > our application? You'll have to rewrite the loader commands of at least the command- line interpreter. I guess the easiest way to do that is to use a .app bundle and macho_standalone (part of macholib): Create a (dummy) .app bundle by hand and use sys.executable (not the python command) as the executable of that application bundle. Then use macho_standalone to copy all libraries and frameworks used by the application into the application bundle, this will rewrite the loader command's as well. It might be possible to use py2app to do all the work, that depends on how you application is set up. Ronald > > > Thanks! > > > - boyd > > Boyd Waters > programmer > national radio astronomy observatory > http://www.aoc.nrao.edu/~bwaters > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig From deveritt at innotts.co.uk Wed Sep 19 13:53:34 2007 From: deveritt at innotts.co.uk (Dave Everitt) Date: Wed, 19 Sep 2007 12:53:34 +0100 Subject: [Pythonmac-SIG] Minimal Python 2.5 and Django install Message-ID: After earlier failed attempts to get Django up and running (see: 'Macports and Django install problems') I started again and wrote an 'absurdly simple' OS X 10.4 Django install guide here: http://ecoconsulting.co.uk/training/python/python-django-OSX.shtml It avoids Macports or Subversion and is intended for anyone (like me) who just wants to try out Django and complete the tutorials without doing any serious development yet. One day, an OS X installer will make this guide redundant and lower the entry barrier :-) Dave Everitt From bwaters at nrao.edu Wed Sep 19 16:34:39 2007 From: bwaters at nrao.edu (Boyd Waters) Date: Wed, 19 Sep 2007 08:34:39 -0600 Subject: [Pythonmac-SIG] relocatable Python framework? In-Reply-To: References: <764456A5-5C7B-4EAB-BDFB-5FBBBFDD0BF1@nrao.edu> Message-ID: <6247DB24-C35B-47CF-A6E7-A9DC457E6225@nrao.edu> On Sep 18, 2007, at 11:11 PM, Ronald Oussoren wrote: > > On 19 Sep, 2007, at 6:31, Boyd Waters wrote: > >> Maybe the user will drag our app bundle to /Applications, but maybe >> not. I can't know where everything is until run-time. >> >> How to I ship the Python framework as a relocatable package inside >> our application? > > You'll have to rewrite the loader commands of at least the command- > line interpreter. I guess the easiest way to do that is to use > a .app bundle and macho_standalone (part of macholib): Create a > (dummy) .app bundle by hand and use sys.executable (not the python > command) as the executable of that application bundle. Then use > macho_standalone to copy all libraries and frameworks used by the > application into the application bundle, this will rewrite the > loader commands as well. Thanks very much, Ronald! Not sure I understood all that, but I know where to dig now... I see this in the comments in Modules/main.c: > See Lib/plat-mac/bundlebuiler.py for details about the bootstrap > script. I had thought this was a trivial matter, but now I see that it is a bit involved. Our application already sets up the Python interpreter from a C++ wrapper, so I suppose we already have a place to add hooks. Hmm. If I come up with anything simple and clever, I'll post back to the list. (If I come up with something embarrassing and stupid, maybe I'll keep it to myself...) - boyd Boyd Waters programmer mac guy National Radio Astronomy Observatory http://www.aoc.nrao.edu/~bwaters From jjb5 at cornell.edu Wed Sep 19 16:25:53 2007 From: jjb5 at cornell.edu (Joel Bender) Date: Wed, 19 Sep 2007 10:25:53 -0400 Subject: [Pythonmac-SIG] Minimal Python 2.5 and Django install In-Reply-To: References: Message-ID: <46F13171.9090101@cornell.edu> > I started again and wrote an 'absurdly simple' OS X 10.4 > Django install guide... First, thank you! Here's an update: If typing python -V in Terminal still gives version 2.3... Check your path, it should include /usr/local/bin: $ echo $PATH If it doesn't, check to see if you have a .bash_login file. If you don't, create one with this command: $ echo 'export PATH="/usr/local/bin:/usr/local/sbin:$PATH"' > .bash_login Close the terminal window, open a new one, and check again. Others with more experience may offer a better answer. Joel From Chris.Barker at noaa.gov Wed Sep 19 18:27:07 2007 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Wed, 19 Sep 2007 09:27:07 -0700 Subject: [Pythonmac-SIG] relocatable Python framework? In-Reply-To: <6247DB24-C35B-47CF-A6E7-A9DC457E6225@nrao.edu> References: <764456A5-5C7B-4EAB-BDFB-5FBBBFDD0BF1@nrao.edu> <6247DB24-C35B-47CF-A6E7-A9DC457E6225@nrao.edu> Message-ID: <46F14DDB.2030302@noaa.gov> Boyd Waters wrote: >>> Maybe the user will drag our app bundle to /Applications, but maybe >>> not. I can't know where everything is until run-time. Is your goal something that looks and acts like a regular single stand-alone application? If so, then why not just use 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 Wed Sep 19 18:39:42 2007 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Wed, 19 Sep 2007 09:39:42 -0700 Subject: [Pythonmac-SIG] Minimal Python 2.5 and Django install In-Reply-To: <46F13171.9090101@cornell.edu> References: <46F13171.9090101@cornell.edu> Message-ID: <46F150CE.1030708@noaa.gov> Joel Bender wrote: >> I started again and wrote an 'absurdly simple' OS X 10.4 >> Django install guide... Nice. A few comments: If you double-click on the tarball in the finder, it will "automagically" be unpacked for you. > First, thank you! Here's an update: > > If typing python -V in Terminal still gives version 2.3... > > Check your path, it should include /usr/local/bin: > > $ echo $PATH > > If it doesn't, check to see if you have a .bash_login file. ARRGG! why the heck does bash have SO MANY options for config files! anyway, the most common choice for OS-X is to put this stuff in .profile. I think that's where the Python installer puts it. Also: > $ echo 'export PATH="/usr/local/bin:/usr/local/sbin:$PATH"' > That's not quite it -- yes, it's good to have /usr/local/bin on your PATH, but for python, you need: PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}" That will put the "current" python and various python scripts on your PATH If you already have a .profile file, open it in an editor, and add that line to it. Finally, Maybe this should be on the MacPython wiki? http://wiki.python.org/moin/MacPython -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 jjb5 at cornell.edu Wed Sep 19 19:13:21 2007 From: jjb5 at cornell.edu (Joel Bender) Date: Wed, 19 Sep 2007 13:13:21 -0400 Subject: [Pythonmac-SIG] Minimal Python 2.5 and Django install In-Reply-To: <46F150CE.1030708@noaa.gov> References: <46F13171.9090101@cornell.edu> <46F150CE.1030708@noaa.gov> Message-ID: <46F158B1.8030302@cornell.edu> > That's not quite it -- yes, it's good to have /usr/local/bin on your > PATH, but for python, you need: > > PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}" > > That will put the "current" python and various python scripts on your PATH Ah! Interesting. > If you already have a .profile file, open it in an editor, and add that > line to it. I didn't have one, so I tried to create it using TextWrangler. When I went to save it, it complained "The name ".profile" is already used by a folder." ::makes guttural noises Curiously there is an empty file called 'NotExistingPrefereceForOxygenResults.layout' in the directory. Not being one to let an empty file stand in my way, I deleted it, and the directory, and then made .profile with your PATH="..." expression using '$ cat > .profile'. The new path doesn't show up anywhere that I can see, even after logging out and logging back in. Joel From bwaters at nrao.edu Wed Sep 19 19:19:33 2007 From: bwaters at nrao.edu (Boyd Waters) Date: Wed, 19 Sep 2007 11:19:33 -0600 Subject: [Pythonmac-SIG] relocatable Python framework? In-Reply-To: <46F14DDB.2030302@noaa.gov> References: <764456A5-5C7B-4EAB-BDFB-5FBBBFDD0BF1@nrao.edu> <6247DB24-C35B-47CF-A6E7-A9DC457E6225@nrao.edu> <46F14DDB.2030302@noaa.gov> Message-ID: <399CBF54-106F-4671-B156-D7E46C81B879@nrao.edu> On Sep 19, 2007, at 10:27 AM, Christopher Barker wrote: > Is your goal something that looks and acts like a regular single > stand-alone application? If so, then why not just use py2app? Good question! I will try to inhale py2app documentation, maybe it will help. My short answer to "why not py2app" is that this is not just a Python application. It's a large C++ system. There are Qt applications in there as well. The primary user interface at the moment is an extension to the IPython shell, launched by a C++ executable that sets up our Python library path and wraps Python_Main. I run against a Python 2.5.1 framework build that I have installed in /opt/casa/lib, along with another 100 megabytes of open-source fun, built with MacPorts, that uses /opt/casa as ${prefix}. (Our application is called CASA.) Altogether it is 250 megabytes on disk... The previous three releases of this system have been a completely self-contained directory tree that is installed in /opt/casa/ -- actually in /opt/casa/$version -- and that works great. But I would like to take that self-contained thing to the next level, and allow the user to install the directory tree in an arbitrary location. A draggable application. My current whack at a Mac application bundle is an AppleScript "bundle" that simply calls Terminal and tells is to execute the wrapper shell script that starts up our Python_Main wrapper. So far we've been able to get away with a single code base, Qt for the GUI, no Mac-specific stuff in our system. I can write simple Objective-C applications but I'm the only member of the team who might do so, and we want to avoid doing so if we can in order to minimize the maintenance cost of the platform. The developers here like the Mac as a platform but it's a Linux code base, Linux is our primary deployment target. I was hoping that I could simply set PYTHONEXECUTABLE or PYTHONHOME in my launcher shell script to set the path to Python at run-time. Keep those cards and letters coming! Thanks! - boyd Boyd Waters National Radio Astronomy Observatory http://www.aoc.nrao.edu/~bwaters From vivacarlie at gmail.com Wed Sep 19 19:32:13 2007 From: vivacarlie at gmail.com (Nehemiah Dacres) Date: Wed, 19 Sep 2007 12:32:13 -0500 Subject: [Pythonmac-SIG] relocatable Python framework? In-Reply-To: <399CBF54-106F-4671-B156-D7E46C81B879@nrao.edu> References: <764456A5-5C7B-4EAB-BDFB-5FBBBFDD0BF1@nrao.edu> <6247DB24-C35B-47CF-A6E7-A9DC457E6225@nrao.edu> <46F14DDB.2030302@noaa.gov> <399CBF54-106F-4671-B156-D7E46C81B879@nrao.edu> Message-ID: <65fadfc30709191032x76c924f9m71257e195402833b@mail.gmail.com> which QT? tolltech's qt3 or qt4 (or quicktime? ... jk) QT is trying to be as platform independent as possible. how about puting python.frameworks in $appdir/resources/frameworks/python2.5.framework and building against that framework before you package it. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20070919/cba6f07e/attachment.htm From vivacarlie at gmail.com Wed Sep 19 19:35:50 2007 From: vivacarlie at gmail.com (Nehemiah Dacres) Date: Wed, 19 Sep 2007 12:35:50 -0500 Subject: [Pythonmac-SIG] relocatable Python framework? In-Reply-To: <399CBF54-106F-4671-B156-D7E46C81B879@nrao.edu> References: <764456A5-5C7B-4EAB-BDFB-5FBBBFDD0BF1@nrao.edu> <6247DB24-C35B-47CF-A6E7-A9DC457E6225@nrao.edu> <46F14DDB.2030302@noaa.gov> <399CBF54-106F-4671-B156-D7E46C81B879@nrao.edu> Message-ID: <65fadfc30709191035v4e247ebfjd153d1e7666121a6@mail.gmail.com> which QT? tolltech's qt3 or qt4 (or quicktime? ... jk) QT is trying to be as platform independent as possible. how about puting python.frameworks in $appdir/resources/frameworks/python2.5.framework and building against that framework before you package it. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20070919/ddad673a/attachment.htm From kw at codebykevin.com Wed Sep 19 19:36:06 2007 From: kw at codebykevin.com (Kevin Walzer) Date: Wed, 19 Sep 2007 13:36:06 -0400 Subject: [Pythonmac-SIG] relocatable Python framework? In-Reply-To: <399CBF54-106F-4671-B156-D7E46C81B879@nrao.edu> References: <764456A5-5C7B-4EAB-BDFB-5FBBBFDD0BF1@nrao.edu> <6247DB24-C35B-47CF-A6E7-A9DC457E6225@nrao.edu> <46F14DDB.2030302@noaa.gov> <399CBF54-106F-4671-B156-D7E46C81B879@nrao.edu> Message-ID: <46F15E06.3060602@codebykevin.com> Boyd Waters wrote: > > My short answer to "why not py2app" is that this is not just a Python > application. It's a large C++ system. There are Qt applications in > there as well. > You might simply be better off putting together a package installer (pkg) that will put all the supporting bits in the right place, and include some sort of stub launcher in .app format (AppleScript works well here) that can be relocated if necessary. Some applications simply have too many moving parts to wrap in a single application bundle. Also, if your audience is technical rather than the average end user, they won't object to package installers--it's pretty standard for large, complex application systems. -- Kevin Walzer Code by Kevin http://www.codebykevin.com From bwaters at nrao.edu Wed Sep 19 19:46:45 2007 From: bwaters at nrao.edu (Boyd Waters) Date: Wed, 19 Sep 2007 11:46:45 -0600 Subject: [Pythonmac-SIG] relocatable Python framework? In-Reply-To: <65fadfc30709191032x76c924f9m71257e195402833b@mail.gmail.com> References: <764456A5-5C7B-4EAB-BDFB-5FBBBFDD0BF1@nrao.edu> <6247DB24-C35B-47CF-A6E7-A9DC457E6225@nrao.edu> <46F14DDB.2030302@noaa.gov> <399CBF54-106F-4671-B156-D7E46C81B879@nrao.edu> <65fadfc30709191032x76c924f9m71257e195402833b@mail.gmail.com> Message-ID: On Sep 19, 2007, at 11:32 AM, Nehemiah Dacres wrote: > which QT? tolltech's qt3 or qt4 (or quicktime? ... jk) Qt 4.3.1 > how about puting python.frameworks in $appdir/resources/ > frameworks/python2.5.framework and building against that framework > before you package it. This is exactly it -- I was able to (manually) run install_name_tool against the Qt frameworks that I'd built so that I could put them inside my application bundle. I used @loader_path in order to make the Qt frameworks relocatable. But I have found no documentation for doing the same thing with the Python.framework -- and it seems that such would not be sufficient, in any case. I have set the PYTHONEXECUTABLE environment variable but that does not work. I found out about this environment variable by reading the Python source code. Someone else must have included Python inside an application bundle. I think that OpenOffice does this... - boyd From Chris.Barker at noaa.gov Wed Sep 19 20:13:52 2007 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Wed, 19 Sep 2007 11:13:52 -0700 Subject: [Pythonmac-SIG] Minimal Python 2.5 and Django install In-Reply-To: <46F158B1.8030302@cornell.edu> References: <46F13171.9090101@cornell.edu> <46F150CE.1030708@noaa.gov> <46F158B1.8030302@cornell.edu> Message-ID: <46F166E0.7090809@noaa.gov> Joel Bender wrote: >> If you already have a .profile file, open it in an editor, and add >> that line to it. > > I didn't have one, so I tried to create it using TextWrangler. When I > went to save it, it complained "The name ".profile" is already used by a > folder." really? who the heck put that in? There is also .bash_profile and .bashrc that work. There are subtle differences that I don't understand about how those are loaded by bash. > directory, and then made .profile with your PATH="..." expression using > '$ cat > .profile'. > > The new path doesn't show up anywhere that I can see, even after logging > out and logging back in. odd. it works for me. Do look at your .profile file and make sure it has in it what you expect. From the bash man page: """ When bash is invoked as an interactive login shell, or as a non-inter- active shell with the --login option, it first reads and executes com- mands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. """ so maybe you have a .bash_profile or .bash_login and it's reading that and stopping. From the looks of this, and the fact that you had another .profile, maybe .bash_profile is the best one to use. -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 Wed Sep 19 20:15:19 2007 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Wed, 19 Sep 2007 20:15:19 +0200 Subject: [Pythonmac-SIG] py2app and qt jpeg plugin In-Reply-To: References: Message-ID: <1C314B6A-4899-48CF-B739-0731AB097C1D@mac.com> On 19 Sep, 2007, at 7:14, Emanuele Santos wrote: > Hi, > > I am having problems to show jpeg images on my bundled application > using pyqt4. > I know that the problem is with the qt plugins. How does py2app > handle them? Because if try to run from my source tree it works fine. Py2app doesn't handle qt plugins, at least not if they are seperate object files that aren't referenced from python extensions or the like. Py2app used to have a recipe for correctly handling pyqt application, but that was removed because pyqt changed and nobody volunteered a new recipe. We need at least information about how to manually fix the app bundle that py2app creates, but a complete recipe (like the ones in py2app.recipes) would be even better. Ronald From deveritt at innotts.co.uk Wed Sep 19 20:44:23 2007 From: deveritt at innotts.co.uk (Dave Everitt) Date: Wed, 19 Sep 2007 19:44:23 +0100 Subject: [Pythonmac-SIG] Minimal Python 2.5 and Django install In-Reply-To: <46F114FB.8010905@tds.net> References: <46F114FB.8010905@tds.net> Message-ID: <72E6A4AD-911B-4580-84EC-84E8A6F68E0F@innotts.co.uk> >> After earlier failed attempts to get Django up and running (see: >> 'Macports and Django install problems') I started again and wrote >> an 'absurdly simple' OS X 10.4 Django install guide here: >> http://ecoconsulting.co.uk/training/python/python-django-OSX.shtml > > You don't need to install PySQLite. Python 2.5 includes a version > of SQLite and Django will use that version. Ah yes - I've removed that part in the guide. I'd read this: 'SQLite module for Python 2.5' http://mail.python.org/pipermail/python-dev/2004-October/049534.html but (having already installed PySQLite) wasn't sure how to check for the bundled PySQLite, so... ...a couple of questions before I remove my (now extraneous) PySQLite install: 1. Is it embedded in Python 2.5? If so I'll remove my separate install at: /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- packages/ 2. Can it be tested for with: >>> from pysqlite2 import test >>> test.test() - Dave From kent37 at tds.net Wed Sep 19 21:02:32 2007 From: kent37 at tds.net (Kent Johnson) Date: Wed, 19 Sep 2007 15:02:32 -0400 Subject: [Pythonmac-SIG] Minimal Python 2.5 and Django install In-Reply-To: <72E6A4AD-911B-4580-84EC-84E8A6F68E0F@innotts.co.uk> References: <46F114FB.8010905@tds.net> <72E6A4AD-911B-4580-84EC-84E8A6F68E0F@innotts.co.uk> Message-ID: <46F17248.9070702@tds.net> Dave Everitt wrote: > 1. Is it embedded in Python 2.5? Yes, in the sqlite3 package. > 2. Can it be tested for with: > >>> from pysqlite2 import test > >>> test.test() No, the package is called sqlite3 and there is no umbrella test.test(). You can run individual tests, e.g. In [6]: from sqlite3.test import dbapi In [7]: dbapi.test() Kent From kent37 at tds.net Wed Sep 19 14:24:27 2007 From: kent37 at tds.net (Kent Johnson) Date: Wed, 19 Sep 2007 08:24:27 -0400 Subject: [Pythonmac-SIG] Minimal Python 2.5 and Django install In-Reply-To: References: Message-ID: <46F114FB.8010905@tds.net> Dave Everitt wrote: > After earlier failed attempts to get Django up and running (see: > 'Macports and Django install problems') I started again and wrote an > 'absurdly simple' OS X 10.4 Django install guide here: > > http://ecoconsulting.co.uk/training/python/python-django-OSX.shtml You don't need to install PySQLite. Python 2.5 includes a version of SQLite and Django will use that version. Kent From hraban at fiee.net Wed Sep 19 23:14:44 2007 From: hraban at fiee.net (Henning Hraban Ramm) Date: Wed, 19 Sep 2007 23:14:44 +0200 Subject: [Pythonmac-SIG] design questions: new hierarchy/tree class? In-Reply-To: <26FA1D2D-F107-4877-AFD5-EC6482463478@avatar.com.au> References: <954f61110709161025m3c308f4fx38fe238c37466762@mail.gmail.com> <26FA1D2D-F107-4877-AFD5-EC6482463478@avatar.com.au> Message-ID: Am 2007-09-18 um 00:19 schrieb David Worrall: > www.pytables.org Looks good, I'll check this out, thank you! Greetlings from Lake Constance! Hraban --- http://www.fiee.net https://www.cacert.org (I'm an assurer) From hraban at fiee.net Wed Sep 19 23:23:02 2007 From: hraban at fiee.net (Henning Hraban Ramm) Date: Wed, 19 Sep 2007 23:23:02 +0200 Subject: [Pythonmac-SIG] design questions: new hierarchy/tree class? In-Reply-To: <65fadfc30709171013v22d9bcddj2866d0b723ae5974@mail.gmail.com> References: <954f61110709161025m3c308f4fx38fe238c37466762@mail.gmail.com> <65fadfc30709171013v22d9bcddj2866d0b723ae5974@mail.gmail.com> Message-ID: <8006C84E-A280-4902-B5BF-64DED0D486E8@fiee.net> Am 2007-09-17 um 19:13 schrieb Nehemiah Dacres: > While i dont know this library verry well, try xml tree. as for > tree like data, most people use nested lists and nested tuples to > display hirarchial (ergo nested) info. google uses xmltree for the > python G-Data client library so it should be either good or improving. It's not only that I need to store/display nested/hierachical data - I'm very used to use nested dicts/lists, but I'm tired of writing specialized handlers for each of my nested data structures - too much code duplication without compatibility... And I don't really want to go the XML path - I guess it's much more efficient to use methods of storage objects than to transverse some DOM. Hm, while I think about it - I guess the DOM libraries held their parsed data in memory, too; and for they had better programmers than me, I should try it first. I guess I could use a DOM tree without really using XML. Greetlings from Lake Constance! Hraban --- http://www.fiee.net https://www.cacert.org (I'm an assurer) From hraban at fiee.net Wed Sep 19 23:28:01 2007 From: hraban at fiee.net (Henning Hraban Ramm) Date: Wed, 19 Sep 2007 23:28:01 +0200 Subject: [Pythonmac-SIG] Macports and Django install problems In-Reply-To: <1C00F41D-E940-4A48-84DD-B0D8B646DB5D@sent.com> References: <77FBD535-B3D8-4A23-8D0D-86A39804C152@innotts.co.uk> <1C00F41D-E940-4A48-84DD-B0D8B646DB5D@sent.com> Message-ID: Am 2007-09-19 um 00:18 schrieb Brian Ray: > However we need a installer/montitor app for Django development on on > OSX. Does anyone know if one already exists or has been started? I > would consider helping. There is one great installer for django and a lot of other projects, and every developer should know it: It's called subversion, svn for short... :-) Works great for me! (Hint: Collect your checkouts in a shell script and call that daily with cron.) Greetlings from Lake Constance! Hraban --- http://www.fiee.net https://www.cacert.org (I'm an assurer) From bwaters at nrao.edu Thu Sep 20 02:22:42 2007 From: bwaters at nrao.edu (Boyd Waters) Date: Wed, 19 Sep 2007 18:22:42 -0600 Subject: [Pythonmac-SIG] py2app and qt jpeg plugin In-Reply-To: <1C314B6A-4899-48CF-B739-0731AB097C1D@mac.com> References: <1C314B6A-4899-48CF-B739-0731AB097C1D@mac.com> Message-ID: <1A8BD190-CD49-4D1E-823B-0D38516A25FB@nrao.edu> Qt4 has an extra directory of image plugins that you need. These are in ${PREFIX}/lib/qt4-mac I have to put these inside my application bundle and then use install_name_tool to change the library dependency paths. I can send more-specific instructions once I get my application working. - boyd Boyd Waters National Radio Astronomy Observatory http://www.aoc.nrao.edu/~bwaters On Sep 19, 2007, at 12:15 PM, Ronald Oussoren wrote: > > On 19 Sep, 2007, at 7:14, Emanuele Santos wrote: > >> Hi, >> >> I am having problems to show jpeg images on my bundled application >> using pyqt4. >> I know that the problem is with the qt plugins. How does py2app >> handle them? Because if try to run from my source tree it works fine. > > Py2app doesn't handle qt plugins, at least not if they are seperate > object files that aren't referenced from python extensions or the > like. > > Py2app used to have a recipe for correctly handling pyqt application, > but that was removed because pyqt changed and nobody volunteered a new > recipe. We need at least information about how to manually fix the > app bundle that py2app creates, but a complete recipe (like the ones > in py2app.recipes) would be even better. > > Ronald > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig From emanuelesantos at gmail.com Thu Sep 20 03:06:42 2007 From: emanuelesantos at gmail.com (Emanuele Santos) Date: Wed, 19 Sep 2007 19:06:42 -0600 Subject: [Pythonmac-SIG] py2app and qt jpeg plugin In-Reply-To: <1A8BD190-CD49-4D1E-823B-0D38516A25FB@nrao.edu> References: <1C314B6A-4899-48CF-B739-0731AB097C1D@mac.com> <1A8BD190-CD49-4D1E-823B-0D38516A25FB@nrao.edu> Message-ID: <1A1A6DE2-CC04-4209-89C9-2474A4A20C44@gmail.com> Thanks Ronald and Boyd, This is how I finally fixed the problem: Put an empty qt.conf inside the bundle's resources folder. Copy the contents of qt's plugins directory to the bundle's MacOS folder use install_name_tool on the libraries inside the plugins directory. After that it found the plugins directory, but it couldn't load them because the bundle would still also load the system qt libraries (I don't know why) and I would have those QObject::moveToThread errors. To finally solve this, I had to rename the qt directory so it couldn't find the system libraries and load only the bundled ones. I wish I could help with a recipe for PyQt, but I don't know how to make one. What I am doing now is just including sip in py2app includes option and PyQt4 in the packages option. Of course, I have to copy the plugins and relink them after that. Can we define in the recipe to tell py2app to include the plugins directory? Thanks again, -- Emanuele. On Sep 19, 2007, at 6:22 PM, Boyd Waters wrote: > Qt4 has an extra directory of image plugins that you need. > > These are in ${PREFIX}/lib/qt4-mac > > I have to put these inside my application bundle and then use > install_name_tool to change the library dependency paths. > > I can send more-specific instructions once I get my application > working. > > - boyd > > Boyd Waters > National Radio Astronomy Observatory > http://www.aoc.nrao.edu/~bwaters > > > > On Sep 19, 2007, at 12:15 PM, Ronald Oussoren wrote: > >> >> On 19 Sep, 2007, at 7:14, Emanuele Santos wrote: >> >>> Hi, >>> >>> I am having problems to show jpeg images on my bundled application >>> using pyqt4. >>> I know that the problem is with the qt plugins. How does py2app >>> handle them? Because if try to run from my source tree it works >>> fine. >> >> Py2app doesn't handle qt plugins, at least not if they are seperate >> object files that aren't referenced from python extensions or the >> like. >> >> Py2app used to have a recipe for correctly handling pyqt application, >> but that was removed because pyqt changed and nobody volunteered a >> new >> recipe. We need at least information about how to manually fix the >> app bundle that py2app creates, but a complete recipe (like the ones >> in py2app.recipes) would be even better. >> >> Ronald >> >> _______________________________________________ >> Pythonmac-SIG maillist - Pythonmac-SIG at python.org >> http://mail.python.org/mailman/listinfo/pythonmac-sig > From nad at acm.org Thu Sep 20 10:09:39 2007 From: nad at acm.org (Ned Deily) Date: Thu, 20 Sep 2007 01:09:39 -0700 Subject: [Pythonmac-SIG] Minimal Python 2.5 and Django install References: Message-ID: In article , Dave Everitt wrote: > After earlier failed attempts to get Django up and running (see: > 'Macports and Django install problems') I started again and wrote an > 'absurdly simple' OS X 10.4 Django install guide here: > > http://ecoconsulting.co.uk/training/python/python-django-OSX.shtml > > It avoids Macports or Subversion and is intended for anyone (like me) > who just wants to try out Django and complete the tutorials without > doing any serious development yet. A few more comments after trying things on a vanilla 10.4.10 system. One, now that the recipe doesn't use MacPorts, installing the Apple Developer Tools (Xcode) isn't needed. They would only be needed to build any C extensions and Django doesn't appear to have any. Two, one's mileage may vary of course but I think it's much easier to use the power of easy_install in setuptools. So step 3 could be replaced by: [if easy_install not already available:} curl http://peak.telecommunity.com/dist/ez_setup.py -O python ez_setup.py easy_install http://www.djangoproject.com/download/0.96/tarball/ That's it: you're now ready for the tutorials. {Note, in theory one should be able to just type something like: easy_install Django096 and setuptools will search the Python Package Index for the latest Django download. Unfortunately, the PyPi entry for Django doesn't seem to work with easy_install at the moment, hence the lengthier URL version above.] In the spirit of keeping things "absurdly simple", wth the above recipe there is no need to worry about the Django admin script not being executable, so you can safely remove the directions for the chmod. And the django-admin.py script is installed into the /Library/Frameworks/Python.framework/Versions/Current/bin directory which the Python 2.5.1 installer automatically adds to one's path so the directions to manually manipulate the PATH variable aren't needed, either. And there's no need to test for SQLite. It's just there in 2.5.1. Finally, I'd limit the References to just the first www.python.org mac link. The others and more are referenced from there (and the one link isn't really relevant to current OSX stuff anyway). Thanks again for doing this. -- Ned Deily, nad at acm.org From deveritt at innotts.co.uk Thu Sep 20 10:40:32 2007 From: deveritt at innotts.co.uk (Dave Everitt) Date: Thu, 20 Sep 2007 09:40:32 +0100 Subject: [Pythonmac-SIG] Minimal Python 2.5 and Django install In-Reply-To: References: Message-ID: <01A10E17-6B6E-4580-9BC9-C9D0012F9438@innotts.co.uk> Ned - that's great, I'll be changing the instructions accordingly (although time's run out for me the week). And if that's right about not requiring XCode, it lowers the entry barrier even further, which was always the intention. Will try on my (almost vanilla but with XCode) iMac soon as I can and maybe get a final version up sometime soon on the MacPython Wiki? - Dave Everitt > In article , > Dave Everitt wrote: >> [SNIP] I started again and wrote an >> 'absurdly simple' OS X 10.4 Django install guide here: >> >> http://ecoconsulting.co.uk/training/python/python-django-OSX.shtml >> >> It avoids Macports or Subversion [SNIP] complete the tutorials >> without >> doing any serious development yet. > > A few more comments after trying things on a vanilla 10.4.10 system. > > One, now that the recipe doesn't use MacPorts, installing the Apple > Developer Tools (Xcode) isn't needed. They would only be needed to > build any C extensions and Django doesn't appear to have any. > > Two, one's mileage may vary of course but I think it's much easier to > use the power of easy_install in setuptools. So step 3 could be > replaced by: > > [if easy_install not already available:} > curl http://peak.telecommunity.com/dist/ez_setup.py -O > python ez_setup.py > > easy_install http://www.djangoproject.com/download/0.96/tarball/ > > That's it: you're now ready for the tutorials. > > {Note, in theory one should be able to just type something like: > easy_install Django096 > and setuptools will search the Python Package Index for the latest > Django download. Unfortunately, the PyPi entry for Django doesn't > seem > to work with easy_install at the moment, hence the lengthier URL > version > above.] > > In the spirit of keeping things "absurdly simple", wth the above > recipe > there is no need to worry about the Django admin script not being > executable, so you can safely remove the directions for the chmod. > And > the django-admin.py script is installed into the > /Library/Frameworks/Python.framework/Versions/Current/bin directory > which the Python 2.5.1 installer automatically adds to one's path > so the > directions to manually manipulate the PATH variable aren't needed, > either. And there's no need to test for SQLite. It's just there in > 2.5.1. > > Finally, I'd limit the References to just the first www.python.org mac > link. The others and more are referenced from there (and the one link > isn't really relevant to current OSX stuff anyway). > > Thanks again for doing this. > > -- > Ned Deily, > nad at acm.org From ronaldoussoren at mac.com Thu Sep 20 10:37:22 2007 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Thu, 20 Sep 2007 10:37:22 +0200 Subject: [Pythonmac-SIG] py2app and qt jpeg plugin In-Reply-To: <1A8BD190-CD49-4D1E-823B-0D38516A25FB@nrao.edu> References: <1C314B6A-4899-48CF-B739-0731AB097C1D@mac.com> <1A8BD190-CD49-4D1E-823B-0D38516A25FB@nrao.edu> Message-ID: On 20 Sep, 2007, at 2:22, Boyd Waters wrote: > Qt4 has an extra directory of image plugins that you need. > > These are in ${PREFIX}/lib/qt4-mac > > I have to put these inside my application bundle and then use > install_name_tool to change the library dependency paths. > > I can send more-specific instructions once I get my application > working. That would be helpfull in getting a working recipe. A small demo application that allows me to test the recipe would also be helpfull (nothing fancy, just something that uses a qt4 plugin). Ronald > > > - boyd > > Boyd Waters > National Radio Astronomy Observatory > http://www.aoc.nrao.edu/~bwaters > > > > On Sep 19, 2007, at 12:15 PM, Ronald Oussoren wrote: > >> >> On 19 Sep, 2007, at 7:14, Emanuele Santos wrote: >> >>> Hi, >>> >>> I am having problems to show jpeg images on my bundled application >>> using pyqt4. >>> I know that the problem is with the qt plugins. How does py2app >>> handle them? Because if try to run from my source tree it works >>> fine. >> >> Py2app doesn't handle qt plugins, at least not if they are seperate >> object files that aren't referenced from python extensions or the >> like. >> >> Py2app used to have a recipe for correctly handling pyqt application, >> but that was removed because pyqt changed and nobody volunteered a >> new >> recipe. We need at least information about how to manually fix the >> app bundle that py2app creates, but a complete recipe (like the ones >> in py2app.recipes) would be even better. >> >> Ronald >> >> _______________________________________________ >> Pythonmac-SIG maillist - Pythonmac-SIG at python.org >> http://mail.python.org/mailman/listinfo/pythonmac-sig > From janssen at parc.com Tue Sep 25 06:26:01 2007 From: janssen at parc.com (Bill Janssen) Date: Mon, 24 Sep 2007 21:26:01 PDT Subject: [Pythonmac-SIG] more Carbon modules for new libraries? Message-ID: <07Sep24.212607pdt."57996"@synergy1.parc.xerox.com> Is anyone planning to update the code in Lib/plat-mac/Carbon/ to include more toolbox modules? For instance, one for the MDQuery system would be useful. How would I go about building such an extension? Bill From janssen at parc.com Tue Sep 25 18:51:04 2007 From: janssen at parc.com (Bill Janssen) Date: Tue, 25 Sep 2007 09:51:04 PDT Subject: [Pythonmac-SIG] ctypes and gestalt Message-ID: <07Sep25.095113pdt."57996"@synergy1.parc.xerox.com> I noticed that ctypes doesn't load on my Mac, due to the fact that I build 2.5.1 with --disable-toolbox-glue, and ctypes critically depends on gestalt, which doesn't get built. The only use for the gestalt dependency is to check the version of OS X. I'd like to replace that with DEFAULT_MODE = RTLD_LOCAL if _os.name == "posix" and _sys.platform == "darwin": import platform # On OS X 10.3, we use RTLD_GLOBAL as default mode # because RTLD_LOCAL does not work at least on some # libraries. if [10, 4] > [int(x) for x in platform.release().split('.')[:2]]: DEFAULT_MODE = RTLD_GLOBAL Bill From skip at pobox.com Tue Sep 25 19:04:53 2007 From: skip at pobox.com (skip at pobox.com) Date: Tue, 25 Sep 2007 12:04:53 -0500 Subject: [Pythonmac-SIG] ctypes and gestalt In-Reply-To: <07Sep25.095113pdt."57996"@synergy1.parc.xerox.com> References: <07Sep25.095113pdt."57996"@synergy1.parc.xerox.com> Message-ID: <18169.16309.949785.728073@montanaro.dyndns.org> Bill> The only use for the gestalt dependency is to check the version of Bill> OS X. Bill> I'd like to replace that with ... Looks find to me. I say check it in and let people (or buildbots) complain if something breaks. Skip From janssen at parc.com Tue Sep 25 19:32:58 2007 From: janssen at parc.com (Bill Janssen) Date: Tue, 25 Sep 2007 10:32:58 PDT Subject: [Pythonmac-SIG] ctypes and gestalt In-Reply-To: <18169.16309.949785.728073@montanaro.dyndns.org> References: <07Sep25.095113pdt."57996"@synergy1.parc.xerox.com> <18169.16309.949785.728073@montanaro.dyndns.org> Message-ID: <07Sep25.103303pdt."57996"@synergy1.parc.xerox.com> > Looks find to me. I say check it in and let people (or buildbots) complain > if something breaks. Actually, it's broken. Should be if int(platform.release().split('.')[0]) < 8: DEFAULT_MODE = RTLD_GLOBAL We're looking at the version of Darwin, not OS X. Bill From jdc at uwo.ca Thu Sep 27 04:36:51 2007 From: jdc at uwo.ca (Dan Christensen) Date: Wed, 26 Sep 2007 22:36:51 -0400 Subject: [Pythonmac-SIG] python program in menu bar Message-ID: Can anyone point to a simple example of a python program that runs in the menu bar? I'd like a program that just displays a few characters of text in the menu bar, and updates the display once a minute or so. Thanks, Dan From delza at livingcode.org Thu Sep 27 06:16:47 2007 From: delza at livingcode.org (Dethe Elza) Date: Wed, 26 Sep 2007 21:16:47 -0700 Subject: [Pythonmac-SIG] python program in menu bar In-Reply-To: References: Message-ID: <24d517dd0709262116r6be377a6q3d8ba2b139d04f2b@mail.gmail.com> Hi Dan, On 9/26/07, Dan Christensen wrote: > Can anyone point to a simple example of a python program that runs in > the menu bar? I'd like a program that just displays a few characters of > text in the menu bar, and updates the display once a minute or so. The first thing to figure out is that Apple calls an app that can live in the menu bar "NSStatusItem". Knowing that makes it a LOT easier to find documentation for writing them. I highly recommend getting a copy of AppKiDo to browse the Cocoa docs, if you don't already have it. I posted a very simple example of getting an NSStatusItem using PyObjC on this list awhile back: http://mail.python.org/pipermail/pythonmac-sig/2005-April/013731.html Let me know if it helps, or if you need more help getting going. --Dethe From an003141 at gmail.com Sat Sep 29 20:54:03 2007 From: an003141 at gmail.com (Nick Anderson) Date: Sat, 29 Sep 2007 14:54:03 -0400 Subject: [Pythonmac-SIG] py2app: how to include the entire standard library of modules? In-Reply-To: References: Message-ID: Hello: I am attempting to build a mac application using py2app. I need to include all of the standard modules even though the application does not import them expressly. (The end user will be able to write scripts, and if his script uses a standard module it needs to be available.) The only way I have found to do this is by using the -i argument: python setup.py py2app -i "THE NAMES OF ALL MODULES SEPARATED BY A COMMA" I guess I could write a shell script that contains the above command but is there an easier way? From hraban at fiee.net Sat Sep 29 21:38:01 2007 From: hraban at fiee.net (Henning Hraban Ramm) Date: Sat, 29 Sep 2007 21:38:01 +0200 Subject: [Pythonmac-SIG] py2app: how to include the entire standard library of modules? In-Reply-To: References: Message-ID: <87B90A6A-4B95-4313-B24A-ED11A6E0A3F3@fiee.net> Am 2007-09-29 um 20:54 schrieb Nick Anderson: > I am attempting to build a mac application using py2app. I need to > include all of the standard modules even though the application does > not import them expressly. (The end user will be able to write > scripts, and if his script uses a standard module it needs to be > available.) The only way I have found to do this is by using the -i > argument: You can set that up in your setup.py (sic!), but it's hard to find how. The py2app docs are no help: http://svn.pythonmac.org/py2app/py2app/trunk/doc/index.html Documentation for py2exe is better (and mostly valid for py2app, too): http://www.py2exe.org/ e.g. http://www.py2exe.org/index.cgi/PassingOptionsToPy2Exe You can use the command line options in a dict like: opts = { 'py2app' : { 'includes' : ('os', 'sys'), } } setup ( options = opts ) Did you try just to import all the modules in your main script? (Don't know if py2app optimizes that away...) Greetlings from Lake Constance! Hraban --- http://www.fiee.net https://www.cacert.org (I'm an assurer) From jdc at uwo.ca Sun Sep 30 04:28:50 2007 From: jdc at uwo.ca (Dan Christensen) Date: Sat, 29 Sep 2007 22:28:50 -0400 Subject: [Pythonmac-SIG] python program in menu bar References: <24d517dd0709262116r6be377a6q3d8ba2b139d04f2b@mail.gmail.com> Message-ID: "Dethe Elza" writes: > On 9/26/07, Dan Christensen wrote: >> Can anyone point to a simple example of a python program that runs in >> the menu bar? I'd like a program that just displays a few characters of >> text in the menu bar, and updates the display once a minute or so. > > I posted a very simple example of getting an NSStatusItem using PyObjC > on this list awhile back: > http://mail.python.org/pipermail/pythonmac-sig/2005-April/013731.html Thanks so much for that. It was quite easy to adapt it to my needs, even though I don't understand the Cocoa side of the code. A few questions: 1) I noticed that my code runs fine directly from the shell prompt, so I'm curious what the advantage of making a real .app is. I guess this would allow me to add the program as a "Startup Item". (Or can one run any command as a Startup Item?) 2) It is easy to change the colour of the title text that appears in the menu bar? 3) Is it easy to generate a beep of some sort? I plan to look over some of the PyObjC documentation and examples, and I apologize if some of this is answered there. Thanks again for pointing out your code to me, as it is almost exactly what I was looking for! Dan From delza at livingcode.org Sun Sep 30 07:16:32 2007 From: delza at livingcode.org (Dethe Elza) Date: Sat, 29 Sep 2007 22:16:32 -0700 Subject: [Pythonmac-SIG] python program in menu bar In-Reply-To: References: <24d517dd0709262116r6be377a6q3d8ba2b139d04f2b@mail.gmail.com> Message-ID: <24d517dd0709292216w7225e9c8p285efa8e4aef054d@mail.gmail.com> Dan wrote: > Thanks so much for that. It was quite easy to adapt it to my needs, > even though I don't understand the Cocoa side of the code. A few > questions: Glad it helped. I recommend getting familiar with the Cocoa libraries, they are quite rich, and PyObjC makes it very easy to experiment. The AppKiDo application makes it very easy to browse and search the documentation. > 1) I noticed that my code runs fine directly from the shell prompt, so > I'm curious what the advantage of making a real .app is. I guess this > would allow me to add the program as a "Startup Item". (Or can one > run any command as a Startup Item?) Making it a real application makes it double-clickable from the Finder and may make it behave better with other Cocoa applications. You will see your application's name when you switch to it, rather than "Python." And I think Startup Items are expected to be .app applications, although I wouldn't swear to it. It's relatively easy to make it a .app with py2app, and good practice for when you develop a killer app that you want to distribute far and wide. > 2) It is easy to change the colour of the title text that appears > in the menu bar? It should be. I'm borrowing my wife's computer right now (mine was stolen recently) so I don't actually have the docs handy, but it should be easy to figure out. I think NSAttributedString is the relevant class to start with. > 3) Is it easy to generate a beep of some sort? NSBeep is your friend. > I plan to look over some of the PyObjC documentation and examples, and I > apologize if some of this is answered there. Thanks again for pointing > out your code to me, as it is almost exactly what I was looking for! All of it is answerd in the Cocoa docs, but the hard part is knowing where to start. I hope I've been able to give you some good starting points. I'm glad the code example was helpful. One of these days I'm going to get my weblog working again, and I'll post it as a tutorial. --Dethe From bray at sent.com Sun Sep 30 18:40:39 2007 From: bray at sent.com (Brian Ray) Date: Sun, 30 Sep 2007 11:40:39 -0500 Subject: [Pythonmac-SIG] Macports and Django install problems In-Reply-To: <6F533F2E-D171-41FC-9D8C-8E953ECEBAF0@innotts.co.uk> References: <77FBD535-B3D8-4A23-8D0D-86A39804C152@innotts.co.uk> <1C00F41D-E940-4A48-84DD-B0D8B646DB5D@sent.com> <6F533F2E-D171-41FC-9D8C-8E953ECEBAF0@innotts.co.uk> Message-ID: <14FC4A3F-95CB-4182-9BA7-F304818A81FD@sent.com> On Sep 19, 2007, at 6:53 AM, Dave Everitt wrote: > The idea is for it to be completely accessible to beginners (i.e. > those who may not even know how to cd in Terminal). > I think we need to do for Python and Django, what Marc Liyanage did for PHP on OSX. >> Does anyone know if one already exists or has been started? I >> would consider helping. > > I can't contribute to the code, but might be able to help polish > things up somehow. Accepted. I was sort of hoping someone else would take the lead on this. I guess I will be forced to. I am a little surprised something is not started already. I just made the project iDjango. My intention here is to do something really simple, quick, and with minimal functionality. I see no reason why it can't do an automated checkout from svn. Any volunteers to help? I may also ping the Django list. Brian Ray bray at sent.com http://kazavoo.com/blog