From steph-info at wanadoo.fr Thu Apr 2 09:52:26 2009 From: steph-info at wanadoo.fr (Steph-info) Date: Thu, 2 Apr 2009 09:52:26 +0200 Subject: [Pythonmac-SIG] [PyObjC] setting button name in NSOpenPanel Message-ID: <2F9231F2-A2DB-4A97-9B44-FB1685BFDF99@wanadoo.fr> Hi, I have the following piece of code : """ @objc.IBAction def chooseRec_(self, sender): op = NSOpenPanel.openPanel() op.setTitle_('Choisir un dossier') op.setCanChooseDirectories_(True) op.setCanChooseFiles_(False) op.setResolvesAliases_(True) op.setAllowsMultipleSelection_(False) result = op.runModalForDirectory_file_types_(None, None, None) if result == NSOKButton: self.pathRec = op.filename() self.pathField.setStringValue_(self.pathRec) """ which open an NSOpenPanel but I can't find how to change the default "Open" and "Cancel" button's names. Could anybody post a line of code demonstrating how to achieve this task ? Thanks Cordialement, St?phane Serra. From njriley at uiuc.edu Thu Apr 2 12:28:18 2009 From: njriley at uiuc.edu (Nicholas Riley) Date: Thu, 2 Apr 2009 05:28:18 -0500 Subject: [Pythonmac-SIG] [PyObjC] setting button name in NSOpenPanel In-Reply-To: <2F9231F2-A2DB-4A97-9B44-FB1685BFDF99@wanadoo.fr> References: <2F9231F2-A2DB-4A97-9B44-FB1685BFDF99@wanadoo.fr> Message-ID: <20090402102818.GA25200@uiuc.edu> On Thu, Apr 02, 2009 at 09:52:26AM +0200, Steph-info wrote: > Hi, > > I have the following piece of code : > > """ > @objc.IBAction > def chooseRec_(self, sender): > op = NSOpenPanel.openPanel() > op.setTitle_('Choisir un dossier') > op.setCanChooseDirectories_(True) > op.setCanChooseFiles_(False) > op.setResolvesAliases_(True) > op.setAllowsMultipleSelection_(False) > result = op.runModalForDirectory_file_types_(None, None, > None) > if result == NSOKButton: > self.pathRec = op.filename() > self.pathField.setStringValue_(self.pathRec) > > """ > which open an NSOpenPanel but I can't find how to change the default > "Open" and "Cancel" button's names. > > Could anybody post a line of code demonstrating how to achieve this > task ? op.setPrompt_('foo') will change Open. Note that NSOpenPanel inherits from NSSavePanel and a bunch of the API you might be looking for is in NSSavePanel. I don't believe it's possible to change 'Cancel' (beyond localizing it). -- Nicholas Riley From steph-info at wanadoo.fr Thu Apr 2 13:36:46 2009 From: steph-info at wanadoo.fr (Steph-info) Date: Thu, 2 Apr 2009 13:36:46 +0200 Subject: [Pythonmac-SIG] [PyObjC] setting button name in NSOpenPanel In-Reply-To: <20090402102818.GA25200@uiuc.edu> References: <2F9231F2-A2DB-4A97-9B44-FB1685BFDF99@wanadoo.fr> <20090402102818.GA25200@uiuc.edu> Message-ID: <25DB19D9-006D-4119-90DE-09634C9D0F74@wanadoo.fr> Le 2 avr. 09 ? 12:28, Nicholas Riley a ?crit : > > On Thu, Apr 02, 2009 at 09:52:26AM +0200, Steph-info wrote: >> Hi, >> >> I have the following piece of code : >> >> """ >> @objc.IBAction >> def chooseRec_(self, sender): >> op = NSOpenPanel.openPanel() >> op.setTitle_('Choisir un dossier') >> op.setCanChooseDirectories_(True) >> op.setCanChooseFiles_(False) >> op.setResolvesAliases_(True) >> op.setAllowsMultipleSelection_(False) >> result = op.runModalForDirectory_file_types_(None, None, >> None) >> if result == NSOKButton: >> self.pathRec = op.filename() >> self.pathField.setStringValue_(self.pathRec) >> >> """ >> which open an NSOpenPanel but I can't find how to change the default >> "Open" and "Cancel" button's names. >> >> Could anybody post a line of code demonstrating how to achieve this >> task ? > > op.setPrompt_('foo') will change Open. Note that NSOpenPanel inherits > from NSSavePanel and a bunch of the API you might be looking for is in > NSSavePanel. > > I don't believe it's possible to change 'Cancel' (beyond localizing > it). Thanks Nicholas, it works for the "Open" button. I found the following cocoa reference for the "Cancel" button : """ NSSavePanel *panel = [NSSavePanel savePanel]; NSButton* cancelButton = [[panel contentView] buttonWithTag:NSFileHandlingPanelCancelButton]; """ Do you know how I can translate this to PyObjC ? > > > -- > Nicholas Riley > > > Cordialement, St?phane Serra. From njriley at uiuc.edu Thu Apr 2 14:23:03 2009 From: njriley at uiuc.edu (Nicholas Riley) Date: Thu, 2 Apr 2009 07:23:03 -0500 Subject: [Pythonmac-SIG] [PyObjC] setting button name in NSOpenPanel In-Reply-To: <25DB19D9-006D-4119-90DE-09634C9D0F74@wanadoo.fr> References: <2F9231F2-A2DB-4A97-9B44-FB1685BFDF99@wanadoo.fr> <20090402102818.GA25200@uiuc.edu> <25DB19D9-006D-4119-90DE-09634C9D0F74@wanadoo.fr> Message-ID: <20090402122302.GA29560@uiuc.edu> On Thu, Apr 02, 2009 at 01:36:46PM +0200, Steph-info wrote: > Thanks Nicholas, it works for the "Open" button. > > I found the following cocoa reference for the "Cancel" button : > > """ > NSSavePanel *panel = [NSSavePanel savePanel]; > NSButton* cancelButton = > [[panel contentView] > buttonWithTag:NSFileHandlingPanelCancelButton]; > """ > > Do you know how I can translate this to PyObjC ? This is a hack - NSFileHandlingPanelCancelButton is 0, so trying to match the tag like this will match all buttons with no tag assigned (as is the default in Interface Builder). In addition, it assumes that the button is a direct descendant of the window's content view - since 2002 when the code above was written, it is no longer the case, so that code is already broken on OS X 10.5. That said, if you really must, a better way would be to check the control's action rather than its tag, searching through the entire hierarchy - something like this. def buttons_with_action(view, action): for subview in view.subviews(): if isinstance(subview, NSButton) and subview.action() == action: yield subview for i in buttons_with_action(subview, action): yield i cancelButtons = list(buttons_with_action(openPanel.contentView(), 'cancel:')) if len(cancelButtons) != 1: pass # handle error cancelButtons[0].setTitle_('Go Away') openPanel.runModalForTypes_(None) and assuming you're going to be distributing your app, make sure you handle the case when the button isn't there, or there are two of them, or the button doesn't have a title, or something else weird happens in a future OS version. -- Nicholas Riley From dfh at forestfield.co.uk Thu Apr 2 20:40:14 2009 From: dfh at forestfield.co.uk (David Hughes) Date: Thu, 02 Apr 2009 19:40:14 +0100 Subject: [Pythonmac-SIG] py2app traceback with wxPython 2.8.9.2 In-Reply-To: <49C863C0.2010606@ulmcnett.com> References: <49C863C0.2010606@ulmcnett.com> Message-ID: <49D5068E.1060404@forestfield.co.uk> Paul McNett wrote: > Hi, > > I get a traceback running py2app with wxPython 2.8.9.2, but not with > wxPython 2.8.9.1. Here's the traceback: > > copying > /Library/Frameworks/Python.framework/Versions/2.5/lib/libncurses.5.dylib > -> > ValueError: Unknown load command: 27 > > > /Users/pmcnett/py/sbs/shutter_studio/trunk/clients/shutter_studio/build/bdist.macosx-10.3-i386/egg/macholib/MachO.py(178)load() > > (Pdb) > > > Everything is the same, except the wxPython version. Any ideas? > > Paul I recall getting an "Unknown load command" message from py2app after I compiled the Reportlab extension *_renderPM.so* as a universal binary under OS X 10.5 (Leopard) and tried to include it in the app. When I compiled it again under 10.4 (Tiger), py2app (running under 10.5) accepted it without any problem. I didn't (have time to) investigate any further, only to note that the 10.5-built version was only 240 Kb compared to 560Kb for the working, 10.4-built version. Maybe there are extensions in wxPython 2.8.9.2 built using OS X 10.5 that were previously built using 10.4 and causing a similar problem? Later.... I have just rerun py2app with my original 10.5-built *_renderPM.so* and -apart from me using a slightly earlier version of py2app than Paul - it produces the self same error word for word (see attachments). Could it be *_renderPM.so* itself that is causing your error Paul? --- Regards, David Hughes Forestfield Software -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: paul-py2app-error.log URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: david-py2app-error.log URL: From Chris.Barker at noaa.gov Thu Apr 2 23:43:38 2009 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Thu, 02 Apr 2009 14:43:38 -0700 Subject: [Pythonmac-SIG] py2app traceback with wxPython 2.8.9.2 In-Reply-To: <49D5068E.1060404@forestfield.co.uk> References: <49C863C0.2010606@ulmcnett.com> <49D5068E.1060404@forestfield.co.uk> Message-ID: <49D5318A.3040702@noaa.gov> > Paul McNett wrote: >> I get a traceback running py2app with wxPython 2.8.9.2, but not with >> wxPython 2.8.9.1. Here's the traceback: >> >> copying >> /Library/Frameworks/Python.framework/Versions/2.5/lib/libncurses.5.dylib >> -> > >> ValueError: Unknown load command: 27 Are you using the latest py2app and macholib? $ easy_install macholib==dev -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov From warren_rekow at speedyquick.net Fri Apr 3 02:36:27 2009 From: warren_rekow at speedyquick.net (Rekow Warren) Date: Thu, 2 Apr 2009 18:36:27 -0600 Subject: [Pythonmac-SIG] using the "PyUSB" module Message-ID: <91226C01-DFF5-44C5-826B-1190A3A06B89@speedyquick.net> I am a new MacPython (ver 2.6.1) user who has downloaded the "PyUSB" module, but am unclear about how to make it available for use in a program. Included among the downloaded files is 'setup.py' (and 'setup.pyc'). Running 'setup.py' via IDLE yields the following error msg: --- Traceback (most recent call last): File "/Applications/Python 2.6/pyusb-0.4.1/setup.py", line 62, in ext_modules = [usbmodule]) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/distutils/core.py", line 140, in setup raise SystemExit, gen_usage(dist.script_name) + "\nerror: %s" % msg SystemExit: usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or: setup.py --help [cmd1 cmd2 ...] or: setup.py --help-commands or: setup.py cmd --help error: no commands supplied --- It seemed that 'setup.py' should be run in order to access functions in the PyUSB module, but perhaps I misunderstand the process. It would be appreciated if someone could suggest a related reference to read. Thanks, Warren From pythonmac at rebertia.com Fri Apr 3 03:06:16 2009 From: pythonmac at rebertia.com (Chris Rebert) Date: Thu, 2 Apr 2009 18:06:16 -0700 Subject: [Pythonmac-SIG] using the "PyUSB" module In-Reply-To: <91226C01-DFF5-44C5-826B-1190A3A06B89@speedyquick.net> References: <91226C01-DFF5-44C5-826B-1190A3A06B89@speedyquick.net> Message-ID: <50697b2c0904021806j63e4a66ayf24f2aa8926efbe9@mail.gmail.com> On Thu, Apr 2, 2009 at 5:36 PM, Rekow Warren wrote: > I am a new MacPython (ver 2.6.1) user who has downloaded the "PyUSB" module, > but am unclear about how to make it available for use in a program. Included > among the downloaded files is 'setup.py' (and 'setup.pyc'). Running > 'setup.py' via IDLE yields the following error msg: > --- > Traceback (most recent call last): > ?File "/Applications/Python 2.6/pyusb-0.4.1/setup.py", line 62, in > ? ?ext_modules = [usbmodule]) > ?File > "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/core.py", > line 140, in setup > ? ?raise SystemExit, gen_usage(dist.script_name) + "\nerror: %s" % msg > SystemExit: usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] > ...] > ? or: setup.py --help [cmd1 cmd2 ...] > ? or: setup.py --help-commands > ? or: setup.py cmd --help > > error: no commands supplied > --- > It seemed that 'setup.py' should be run in order to access functions in the > PyUSB module, but perhaps I misunderstand the process. It would be > appreciated if someone could suggest a related reference to read. Use the command suggested in the error message: setup.py --help-commands You have to give setup.py a command argument; it cannot be run without any arguments. That command should give you a list and explanation from which you can figure out which command you want. Cheers, Chris -- I have a blog: http://blog.rebertia.com From dfh at forestfield.co.uk Fri Apr 3 13:09:20 2009 From: dfh at forestfield.co.uk (David Hughes) Date: Fri, 03 Apr 2009 12:09:20 +0100 Subject: [Pythonmac-SIG] py2app traceback with wxPython 2.8.9.2 In-Reply-To: <49D5318A.3040702@noaa.gov> References: <49C863C0.2010606@ulmcnett.com> <49D5068E.1060404@forestfield.co.uk> <49D5318A.3040702@noaa.gov> Message-ID: <49D5EE60.9060508@forestfield.co.uk> Christopher Barker wrote: >> Paul McNett wrote: >>> I get a traceback running py2app with wxPython 2.8.9.2, but not with >>> wxPython 2.8.9.1. Here's the traceback: >>> >>> copying >>> /Library/Frameworks/Python.framework/Versions/2.5/lib/libncurses.5.dylib >>> -> >> >>> ValueError: Unknown load command: 27 > > Are you using the latest py2app and macholib? > > $ easy_install macholib==dev Updating macholib has fixed the problem for me. Thanks, Chris. -- David Hughes Forestfield Software -------------- next part -------------- An HTML attachment was scrubbed... URL: From Chris.Barker at noaa.gov Fri Apr 3 19:24:46 2009 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Fri, 03 Apr 2009 10:24:46 -0700 Subject: [Pythonmac-SIG] using the "PyUSB" module In-Reply-To: <50697b2c0904021806j63e4a66ayf24f2aa8926efbe9@mail.gmail.com> References: <91226C01-DFF5-44C5-826B-1190A3A06B89@speedyquick.net> <50697b2c0904021806j63e4a66ayf24f2aa8926efbe9@mail.gmail.com> Message-ID: <49D6465E.4020404@noaa.gov> Chris Rebert wrote: > On Thu, Apr 2, 2009 at 5:36 PM, Rekow Warren > wrote: >> I am a new MacPython (ver 2.6.1) user who has downloaded the "PyUSB" module, >> but am unclear about how to make it available for use in a program. Included >> among the downloaded files is 'setup.py' (and 'setup.pyc'). Running > You have to give setup.py a command argument; it cannot be run without > any arguments. That command should give you a list and explanation > from which you can figure out which command you want. Chances are, it is: $ python setup.py install -Chris From jbeeland at rhythm.com Mon Apr 6 20:26:52 2009 From: jbeeland at rhythm.com (Jeffery Beeland) Date: Mon, 06 Apr 2009 11:26:52 -0700 Subject: [Pythonmac-SIG] mactypes Alias/File object question Message-ID: <49DA496C.7060308@rhythm.com> Hey gang, New to the list and mostly a Perl developer, so please excuse my lack of knowledge at this point. ;) I'm using appscript to interface with Photoshop, which has gone pretty well to this point. The problem is that I can't seem to find a way to get a posix path out of an Alias or File object from mactypes. As best I can tell there are no public methods for the classes. This becomes a problem when I want to query a list of open documents and expect to be able to get at the actual file path for something like display of file information in a UI component. I'd really hate to have to parse the file path out of the stringified object. I would greatly appreciate any advice any of you might have. --Jeff -- ____________________________ J e f f e r y B e e l a n d Lead Pipeline TD Rhythm + Hues Studios jbeeland at rhythm.com ____________________________ Excercision sounds like something you'd do to a zombie Richard Simmons. From njriley at uiuc.edu Mon Apr 6 21:13:38 2009 From: njriley at uiuc.edu (Nicholas Riley) Date: Mon, 6 Apr 2009 14:13:38 -0500 Subject: [Pythonmac-SIG] mactypes Alias/File object question In-Reply-To: <49DA496C.7060308@rhythm.com> References: <49DA496C.7060308@rhythm.com> Message-ID: <20090406191338.GA16276@uiuc.edu> On Mon, Apr 06, 2009 at 11:26:52AM -0700, Jeffery Beeland wrote: > I'm using appscript to interface with Photoshop, which has gone pretty > well to this point. The problem is that I can't seem to find a way to > get a posix path out of an Alias or File object from mactypes. As best > I can tell there are no public methods for the classes. This becomes a > problem when I want to query a list of open documents and expect to be > able to get at the actual file path for something like display of file > information in a UI component. No public methods, but a public property (path) will give you what you want. -- Nicholas Riley From jbeeland at rhythm.com Mon Apr 6 23:02:33 2009 From: jbeeland at rhythm.com (Jeffery Beeland) Date: Mon, 06 Apr 2009 14:02:33 -0700 Subject: [Pythonmac-SIG] mactypes Alias/File object question In-Reply-To: <20090406191338.GA16276@uiuc.edu> References: <49DA496C.7060308@rhythm.com> <20090406191338.GA16276@uiuc.edu> Message-ID: <49DA6DE9.9070208@rhythm.com> That seems to be the case. Thanks for the help. :) --Jeff Nicholas Riley wrote: > On Mon, Apr 06, 2009 at 11:26:52AM -0700, Jeffery Beeland wrote: > >> I'm using appscript to interface with Photoshop, which has gone pretty >> well to this point. The problem is that I can't seem to find a way to >> get a posix path out of an Alias or File object from mactypes. As best >> I can tell there are no public methods for the classes. This becomes a >> problem when I want to query a list of open documents and expect to be >> able to get at the actual file path for something like display of file >> information in a UI component. >> > > No public methods, but a public property (path) will give you what you > want. > > > > -- ____________________________ J e f f e r y B e e l a n d Lead Pipeline TD Rhythm + Hues Studios jbeeland at rhythm.com ____________________________ Excercision sounds like something you'd do to a zombie Richard Simmons. -------------- next part -------------- An HTML attachment was scrubbed... URL: From warren_rekow at speedyquick.net Tue Apr 7 05:07:28 2009 From: warren_rekow at speedyquick.net (Rekow Warren) Date: Mon, 6 Apr 2009 21:07:28 -0600 Subject: [Pythonmac-SIG] using the "PyUSB" module In-Reply-To: <49D6465E.4020404@noaa.gov> References: <91226C01-DFF5-44C5-826B-1190A3A06B89@speedyquick.net> <50697b2c0904021806j63e4a66ayf24f2aa8926efbe9@mail.gmail.com> <49D6465E.4020404@noaa.gov> Message-ID: <8BEAB2C5-FCD7-43B4-953B-647D42B5E90C@speedyquick.net> Chris and Kevin, thanks for the feedback. I did this... DualG4-2:~ rekow$ python /Applications/pyusb-0.4.1/setup.py install ...and got this result... running install running build running build_ext building 'usb' extension Compiling with an SDK that doesn't seem to exist: /Developer/SDKs/ MacOSX10.4u.sdk Please check your Xcode installation ... Under /Developer/SDKs/ there is no "MacOSX10.4u.sdk", but there is a "MacOSX10.4.0.sdk" folder. Have any idea how to fix this? Warren On Apr 3, 2009, at 11:24 AM, Christopher Barker wrote: Chris Rebert wrote: > On Thu, Apr 2, 2009 at 5:36 PM, Rekow Warren > wrote: >> I am a new MacPython (ver 2.6.1) user who has downloaded the >> "PyUSB" module, >> but am unclear about how to make it available for use in a >> program. Included >> among the downloaded files is 'setup.py' (and 'setup.pyc'). Running > You have to give setup.py a command argument; it cannot be run without > any arguments. That command should give you a list and explanation > from which you can figure out which command you want. Chances are, it is: $ python setup.py install -Chris From Chris.Barker at noaa.gov Tue Apr 7 05:37:43 2009 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Mon, 06 Apr 2009 20:37:43 -0700 Subject: [Pythonmac-SIG] using the "PyUSB" module In-Reply-To: <8BEAB2C5-FCD7-43B4-953B-647D42B5E90C@speedyquick.net> References: <91226C01-DFF5-44C5-826B-1190A3A06B89@speedyquick.net> <50697b2c0904021806j63e4a66ayf24f2aa8926efbe9@mail.gmail.com> <49D6465E.4020404@noaa.gov> <8BEAB2C5-FCD7-43B4-953B-647D42B5E90C@speedyquick.net> Message-ID: <49DACA87.5050606@noaa.gov> Rekow Warren wrote: > Compiling with an SDK that doesn't seem to exist: > /Developer/SDKs/MacOSX10.4u.sdk > Please check your Xcode installation > ... > > Under /Developer/SDKs/ there is no "MacOSX10.4u.sdk", but there is a > "MacOSX10.4.0.sdk" folder. > Have any idea how to fix this? that is the SDKfor "universal" binaries -- PPC and Intel. It is the SDK that the python.org binary is built with. I know i have it, but I can't tell you where I got it. It probably came with the XCode Tools massive download -- you may need to re-install that, making sure you include all the optional packages. You could also try googling to see of you can find a download of just the SDK, but I have no idea if you cant do that. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov From ronaldoussoren at mac.com Tue Apr 7 10:59:09 2009 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Tue, 07 Apr 2009 10:59:09 +0200 Subject: [Pythonmac-SIG] using the "PyUSB" module In-Reply-To: <8BEAB2C5-FCD7-43B4-953B-647D42B5E90C@speedyquick.net> References: <91226C01-DFF5-44C5-826B-1190A3A06B89@speedyquick.net> <50697b2c0904021806j63e4a66ayf24f2aa8926efbe9@mail.gmail.com> <49D6465E.4020404@noaa.gov> <8BEAB2C5-FCD7-43B4-953B-647D42B5E90C@speedyquick.net> Message-ID: <718E5F77-848E-4645-9AC5-B98253E670B7@mac.com> On 7 Apr, 2009, at 5:07, Rekow Warren wrote: > Chris and Kevin, thanks for the feedback. > I did this... > > DualG4-2:~ rekow$ python /Applications/pyusb-0.4.1/setup.py install > > ...and got this result... > > running install > running build > running build_ext > building 'usb' extension > Compiling with an SDK that doesn't seem to exist: /Developer/SDKs/ > MacOSX10.4u.sdk > Please check your Xcode installation > ... > > Under /Developer/SDKs/ there is no "MacOSX10.4u.sdk", but there is a > "MacOSX10.4.0.sdk" folder. > Have any idea how to fix this? Which version of OSX are you running? MacOSX10.4u.sdk is a component of the developer tools, as Chris noted. You may have to download a newer version of Xcode from developer.apple.com when you're running OSX 10.4, the version of Xcode that's included with OSX 10.5 ships with the 10.4u SDK. Ronald Ronald > Warren > > > On Apr 3, 2009, at 11:24 AM, Christopher Barker wrote: > > Chris Rebert wrote: >> On Thu, Apr 2, 2009 at 5:36 PM, Rekow Warren >> wrote: >>> I am a new MacPython (ver 2.6.1) user who has downloaded the >>> "PyUSB" module, >>> but am unclear about how to make it available for use in a >>> program. Included >>> among the downloaded files is 'setup.py' (and 'setup.pyc'). Running > >> You have to give setup.py a command argument; it cannot be run >> without >> any arguments. That command should give you a list and explanation >> from which you can figure out which command you want. > > Chances are, it is: > > $ python setup.py install > > -Chris > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2224 bytes Desc: not available URL: From strawman at astraw.com Tue Apr 7 19:48:32 2009 From: strawman at astraw.com (Andrew Straw) Date: Tue, 07 Apr 2009 10:48:32 -0700 Subject: [Pythonmac-SIG] using the "PyUSB" module In-Reply-To: <8BEAB2C5-FCD7-43B4-953B-647D42B5E90C@speedyquick.net> References: <91226C01-DFF5-44C5-826B-1190A3A06B89@speedyquick.net> <50697b2c0904021806j63e4a66ayf24f2aa8926efbe9@mail.gmail.com> <49D6465E.4020404@noaa.gov> <8BEAB2C5-FCD7-43B4-953B-647D42B5E90C@speedyquick.net> Message-ID: <49DB91F0.4010903@astraw.com> I have done a terrible job advertising and documenting this, but I have a ctypes based wrapper of libusb which therefore does not require Xcode to be installed: https://code.astraw.com/projects/pylibusb Perhaps it suits your needs? -Andrew Rekow Warren wrote: > Chris and Kevin, thanks for the feedback. > I did this... > > DualG4-2:~ rekow$ python /Applications/pyusb-0.4.1/setup.py install > > ...and got this result... > > running install > running build > running build_ext > building 'usb' extension > Compiling with an SDK that doesn't seem to exist: > /Developer/SDKs/MacOSX10.4u.sdk > Please check your Xcode installation > ... > > Under /Developer/SDKs/ there is no "MacOSX10.4u.sdk", but there is a > "MacOSX10.4.0.sdk" folder. > Have any idea how to fix this? > Warren > > > On Apr 3, 2009, at 11:24 AM, Christopher Barker wrote: > > Chris Rebert wrote: >> On Thu, Apr 2, 2009 at 5:36 PM, Rekow Warren >> wrote: >>> I am a new MacPython (ver 2.6.1) user who has downloaded the "PyUSB" >>> module, >>> but am unclear about how to make it available for use in a program. >>> Included >>> among the downloaded files is 'setup.py' (and 'setup.pyc'). Running > >> You have to give setup.py a command argument; it cannot be run without >> any arguments. That command should give you a list and explanation >> from which you can figure out which command you want. > > Chances are, it is: > > $ python setup.py install > > -Chris > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig From gmlobdell at seanet.com Thu Apr 9 00:52:20 2009 From: gmlobdell at seanet.com (Gregg Lobdell) Date: Wed, 8 Apr 2009 15:52:20 -0700 Subject: [Pythonmac-SIG] Using Python with Emacs Message-ID: <15717858-ADD8-4E90-847F-6403BBB66C77@seanet.com> How do I get Emacs to start the latest version of Python? I'm using "GNU Emacs 22.0.50.1 (powerpc-apple-darwin8.2.0) of 2005-08-06 on quartet.local" (as reported by M-x emacs-verion) on a PowerPC G5 running Mac OS X version 10.4.11 (yes I know I'm not running 10.5) The default Python version that came installed with 10.4 is Python 2.3.5 (#1, Jan 12 2009, 14:43:55), and I'd like to run Python 3.0. How can I convince Emacs to run 3.0 instead of the default 2.3? I've tried setting PYTHONPATH in my .cshrc, .login, and .emacs. My .cshrc adds /Library/Frameworks/Python.framework/Versions/3.0/bin to the PATH, but (getenv "PATH") in emacs returns "/usr/bin:/bin:/usr/sbin:/ sbin:/usr/local/bin:/usr/X11R6/bin" I can get it to start python 3.0 if, in python.el, I set python- python-command to "/Library/Frameworks/Python.framework/Versions/3.0/ bin/python". But this seems like a kludge, to have to set the full path. There must be a better way. After I did get python 3.0 to start, then I had to fix a bunch of stuff in emacs.py, mostly parens for print commands and converting tabs in the indentation to 8 spaces. Gregg Lobdell gmlobdell at seanet.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From janssen at parc.com Thu Apr 9 02:12:45 2009 From: janssen at parc.com (Bill Janssen) Date: Wed, 8 Apr 2009 17:12:45 PDT Subject: [Pythonmac-SIG] Using Python with Emacs In-Reply-To: <15717858-ADD8-4E90-847F-6403BBB66C77@seanet.com> References: <15717858-ADD8-4E90-847F-6403BBB66C77@seanet.com> Message-ID: <59369.1239235965@parc.com> Gregg Lobdell wrote: > I can get it to start python 3.0 if, in python.el, I set python- > python-command to "/Library/Frameworks/Python.framework/Versions/3.0/ > bin/python". But this seems like a kludge, to have to set the full > path. There must be a better way. This is really a python-list question. But I set py-python-command in my .emacs file. And the full path is indeed the way to go. Bill From stuart.davenport at gmail.com Sat Apr 11 19:38:59 2009 From: stuart.davenport at gmail.com (Stuart Davenport) Date: Sat, 11 Apr 2009 18:38:59 +0100 Subject: [Pythonmac-SIG] Virtual Serial/USB Port Message-ID: Hi all, I am trying to write a python program to "emulate" a USB GPS device on my Mac, is there anyway this is possible via Python? Basically I have something running over the network to tell my Mac its GPS location. The application I have running is listening to the data from the network and then I want that data be pushed onto a "virtual" USB GPS device. The data I will send out of it will be the standard NMEA data for any navigation software on a Mac (e.g. RouteBuddy) to read. Would anyone know how to create this "virtual port" through python? Thanks Stu -------------- next part -------------- An HTML attachment was scrubbed... URL: From msanders42 at gmail.com Sat Apr 11 21:26:53 2009 From: msanders42 at gmail.com (Michael Sanders) Date: Sat, 11 Apr 2009 15:26:53 -0400 Subject: [Pythonmac-SIG] Problem with py2app and pygame on OS X Leopard (10.5.6) In-Reply-To: References: Message-ID: I can't seem to get py2app to work with pygame. I'm testing by just trying to compile a simple hello world app: . > '''A simple app that displays "Hello, world!" the title bar of its > window.''' import pygame > quit = False pygame.init() screen = pygame.display.set_mode((640, 480)) pygame.display.set_caption('Hello, world!') > while not quit: pygame.event.pump() for event in [pygame.event.wait()] + pygame.event.get(): if event.type == pygame.QUIT: quit = True I ran py2applet --make-setup hello_world.py to make the setup.py, and it looks like this: """ This is a setup.py script generated by py2applet > Usage: python setup.py py2app """ > from setuptools import setup > APP = ['hello_world.py'] DATA_FILES = [] OPTIONS = {'argv_emulation': True} setup( app=APP, data_files=DATA_FILES, options={'py2app': OPTIONS}, setup_requires=['py2app'], ) Running "python setup.py py2app" now seems to work fine with no errors, however, when I run the app I get this error message: hello_world Error "An unexpected error has occured during execution of the main script ImportError: PyObjC 1.2 or later is required to use pygame on Mac OS X. > http://pygame.org/wiki/PyObjC (Leopard comes with PyObjC 2.0 and I haven't uninstalled it.) If I run "python setup.py py2app -A", I get: hello_world Error "An unexpected error has occured during execution of the main script ImportError: No module named pygame Any ideas on how to fix this? This app runs fine on my machine by running "python hello_world.py", and py2app seems to work with another test app I tried using pyglet. -------------- next part -------------- An HTML attachment was scrubbed... URL: From khorton01 at rogers.com Sat Apr 11 22:59:53 2009 From: khorton01 at rogers.com (Kevin Horton) Date: Sat, 11 Apr 2009 16:59:53 -0400 Subject: [Pythonmac-SIG] Virtual Serial/USB Port In-Reply-To: References: Message-ID: <9D8A246C-435D-4F89-A203-6B4CB5BEEAA0@rogers.com> On 11 Apr 2009, at 13:38, Stuart Davenport wrote: > I am trying to write a python program to "emulate" a USB GPS device > on my Mac, is there anyway this is possible via Python? > > Basically I have something running over the network to tell my Mac > its GPS location. The application I have running is listening to the > data from the network and then I want that data be pushed onto a > "virtual" USB GPS device. The data I will send out of it will be the > standard NMEA data for any navigation software on a Mac (e.g. > RouteBuddy) to read. > > Would anyone know how to create this "virtual port" through python? I'm not sure I completely understand what you want to achieve, but it might be worth looking at the python code in the gpsd package of programs. One of those programs, possibly gpsfake, may either do what you want, or at least give some good ideas. http://gpsd.berlios.de/ http://gpsd.berlios.de/gpsfake.html -- Kevin Horton Ottawa, Canada From dhain+pythonmac at zognot.org Sun Apr 12 21:18:09 2009 From: dhain+pythonmac at zognot.org (David Hain) Date: Sun, 12 Apr 2009 12:18:09 -0700 Subject: [Pythonmac-SIG] Getting None in KVC objectInKeyAtIndex_ Message-ID: <9E58C502-C54A-4A54-B473-0E4BE92DDAC0@zognot.org> I'm trying to use bindings to hook up my model to an NSOutlineView, and I'm attempting to use the countOf, objectInAtIndex_ methods to do the KVC half. The problem I'm running into is that I'm getting None for the index argument, and I can't figure out what to do with that. The reference materials[1] say that the method corresponds to the NSArray objectAtIndex: method, which takes an NSUInteger, but doesn't mention anything about null or nil or whatever it is in objc- land. So the question is, is the view supposed to be giving me None for that argument, or did I hook something up in IB (or elsewhere) incorrectly? If None is expected, then how am I supposed to interpret that? What should I return? Here's a paraphrase of my model: class Node(NSObject): ... def countOfChildren(self): return len(self.children) def objectInChildrenAtIndex_(self, index): return self.children[index] If other information or code would be helpful, I'd be happy to provide it. Thanks! -David [1]: http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/AccessorConventions.html From johan.rydberg at gmail.com Mon Apr 13 11:10:10 2009 From: johan.rydberg at gmail.com (Johan Rydberg) Date: Mon, 13 Apr 2009 11:10:10 +0200 Subject: [Pythonmac-SIG] Getting None in KVC objectInKeyAtIndex_ In-Reply-To: <9E58C502-C54A-4A54-B473-0E4BE92DDAC0@zognot.org> References: <9E58C502-C54A-4A54-B473-0E4BE92DDAC0@zognot.org> Message-ID: <49E30172.30203@gmail.com> David Hain skrev: > I'm trying to use bindings to hook up my model to an NSOutlineView, and > I'm attempting to use the countOf, objectInAtIndex_ methods to > do the KVC half. The problem I'm running into is that I'm getting None > for the index argument, and I can't figure out what to do with that. The > reference materials[1] say that the method corresponds to the NSArray > objectAtIndex: method, which takes an NSUInteger, but doesn't mention > anything about null or nil or whatever it is in objc-land. Maybe this will help you: http://jimmatthews.wordpress.com/2007/07/12/objcselector-and-objcsignature/ From dhain+pythonmac at zognot.org Mon Apr 13 19:00:30 2009 From: dhain+pythonmac at zognot.org (David Hain) Date: Mon, 13 Apr 2009 10:00:30 -0700 Subject: [Pythonmac-SIG] Getting None in KVC objectInKeyAtIndex_ In-Reply-To: <49E30172.30203@gmail.com> References: <9E58C502-C54A-4A54-B473-0E4BE92DDAC0@zognot.org> <49E30172.30203@gmail.com> Message-ID: <852A7FCB-DE70-4971-B547-B09AD3B20399@zognot.org> On Apr 13, 2009, at 2:10 AM, Johan Rydberg wrote: > http://jimmatthews.wordpress.com/2007/07/12/objcselector-and-objcsignature/ Yes! That was exactly what I needed. I had actually thought that pyobjc could be interpreting a zero as nil, and did something like: if index is None: index = 0 but then the program crashed with a Bus Error. I now assume that is because the bridge didn't know what to expect my method to return. With the signature line, I've told it to expect an object, so it works flawlessly! Thanks for the help! -David From ronaldoussoren at mac.com Tue Apr 14 09:44:29 2009 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Tue, 14 Apr 2009 09:44:29 +0200 Subject: [Pythonmac-SIG] Getting None in KVC objectInKeyAtIndex_ In-Reply-To: <852A7FCB-DE70-4971-B547-B09AD3B20399@zognot.org> References: <9E58C502-C54A-4A54-B473-0E4BE92DDAC0@zognot.org> <49E30172.30203@gmail.com> <852A7FCB-DE70-4971-B547-B09AD3B20399@zognot.org> Message-ID: <50CAD33C-6BA2-4E1C-B245-AB506D7FD79E@mac.com> A better way to define such accessors is like so: @objc.accessor def objectInFooAtIndex_(self, index): pass This should deduce the right method signature based on the method name. I guess this needs better documentation :-( Ronald On 13 Apr, 2009, at 19:00, David Hain wrote: > On Apr 13, 2009, at 2:10 AM, Johan Rydberg wrote: > >> http://jimmatthews.wordpress.com/2007/07/12/objcselector-and-objcsignature/ > > Yes! That was exactly what I needed. I had actually thought that > pyobjc could be interpreting a zero as nil, and did something like: > > if index is None: > index = 0 > > but then the program crashed with a Bus Error. I now assume that is > because the bridge didn't know what to expect my method to return. > With the signature line, I've told it to expect an object, so it > works flawlessly! > > Thanks for the help! > -David > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2224 bytes Desc: not available URL: From dickinsm at gmail.com Tue Apr 14 19:14:20 2009 From: dickinsm at gmail.com (Mark Dickinson) Date: Tue, 14 Apr 2009 18:14:20 +0100 Subject: [Pythonmac-SIG] Official 'right way' to create a universal build of Python? Message-ID: <5c6f2a5d0904141014t6f171996x1847ca518e175d97@mail.gmail.com> This question has probably been asked and answered before, but I've failed to find anything in the archives. What's the 'correct' way to create a universal build of Python? Specifically, I have two machines: (1) a Macbook Pro (Core 2 Duo) running OS X 10.5, and (2) an iBook G4 running OS X 10.4. and a fresh checkout of the py3k branch from svn.python.org. I have a fairly limited goal: I want to create a universal (32-bit Intel/32-bit PPC) build on the 10.5/Intel machine, transfer it to the 10.4/PPC machine and then run the testsuite. (This has to do with making sure that a planned checkin is compatible with universal builds; see the (long) thread at http://mail.python.org/pipermail/python-dev/2009-April/088417.html ). What are the commands that I should execute on the Macbook? I tried: ./configure --with-universal-archs=32-bit --enable-framework --enable-universalsdk=/ MACOSX_DEPLOYMENT_TARGET=10.4 && make This seems to give me the right thing: Macintosh-4:py3k-short-float-repr dickinsm$ file python.exe python.exe: Mach-O universal binary with 2 architectures python.exe (for architecture ppc): Mach-O executable ppc python.exe (for architecture i386): Mach-O executable i386 Having done this, how do I package things up to transfer them to the iBook? What files need to be transferred? Mark From skip at pobox.com Tue Apr 14 19:27:48 2009 From: skip at pobox.com (skip at pobox.com) Date: Tue, 14 Apr 2009 12:27:48 -0500 Subject: [Pythonmac-SIG] Official 'right way' to create a universal build of Python? In-Reply-To: <5c6f2a5d0904141014t6f171996x1847ca518e175d97@mail.gmail.com> References: <5c6f2a5d0904141014t6f171996x1847ca518e175d97@mail.gmail.com> Message-ID: <18916.51092.618555.977827@montanaro.dyndns.org> Mark> Having done this, how do I package things up to transfer them to Mark> the iBook? What files need to be transferred? If this is a one-time thing I would use brute force and tar up the entire source directory and put it over on your g4. Skip From ronaldoussoren at mac.com Tue Apr 14 20:36:13 2009 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Tue, 14 Apr 2009 20:36:13 +0200 Subject: [Pythonmac-SIG] Official 'right way' to create a universal build of Python? In-Reply-To: <5c6f2a5d0904141014t6f171996x1847ca518e175d97@mail.gmail.com> References: <5c6f2a5d0904141014t6f171996x1847ca518e175d97@mail.gmail.com> Message-ID: <93214C4F-998B-41AC-896B-D4BEAEC3EDC2@mac.com> Mark, If you're only testing I'd lose the --enable-framework bit and create a regular unix install. That way you won't mess up any regular python install's you have (such as Python.org binary install), and you can just copy the sys.prefix to the other machine. Ronald On 14 Apr, 2009, at 19:14, Mark Dickinson wrote: > This question has probably been asked and answered before, > but I've failed to find anything in the archives. > > What's the 'correct' way to create a universal build of Python? > > Specifically, I have two machines: > > (1) a Macbook Pro (Core 2 Duo) running OS X 10.5, and > (2) an iBook G4 running OS X 10.4. > > and a fresh checkout of the py3k branch from svn.python.org. > > I have a fairly limited goal: I want to create a universal > (32-bit Intel/32-bit PPC) build on the 10.5/Intel machine, > transfer it to the 10.4/PPC machine and then run the > testsuite. (This has to do with making sure that > a planned checkin is compatible with universal builds; > see the (long) thread at > > http://mail.python.org/pipermail/python-dev/2009-April/088417.html > > ). > > What are the commands that I should execute on the > Macbook? > > I tried: > > ./configure --with-universal-archs=32-bit --enable-framework > --enable-universalsdk=/ MACOSX_DEPLOYMENT_TARGET=10.4 && make > > This seems to give me the right thing: > > Macintosh-4:py3k-short-float-repr dickinsm$ file python.exe > python.exe: Mach-O universal binary with 2 architectures > python.exe (for architecture ppc): Mach-O executable ppc > python.exe (for architecture i386): Mach-O executable i386 > > Having done this, how do I package things up to transfer > them to the iBook? What files need to be transferred? > > Mark > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2224 bytes Desc: not available URL: From dickinsm at gmail.com Wed Apr 15 00:08:31 2009 From: dickinsm at gmail.com (Mark Dickinson) Date: Tue, 14 Apr 2009 23:08:31 +0100 Subject: [Pythonmac-SIG] Official 'right way' to create a universal build of Python? In-Reply-To: <93214C4F-998B-41AC-896B-D4BEAEC3EDC2@mac.com> References: <5c6f2a5d0904141014t6f171996x1847ca518e175d97@mail.gmail.com> <93214C4F-998B-41AC-896B-D4BEAEC3EDC2@mac.com> Message-ID: <5c6f2a5d0904141508s3eb488fbg5703f44ee64d86f3@mail.gmail.com> Thank you, Skip and Ronald. Together with Ned's information from the python-dev thread, I managed to build a non-framework universal build on Intel, transfer a tarball to PPC and get it to run the testsuite. For future reference, the steps that worked were: export MACOSX_DEPLOYMENT_TARGET=10.3 ./configure --enable-universalsdk=/Developer/SDKs/MacOSX10.4u.sdk --with-universal-archs='32-bit' && make Mark From johan.rydberg at gmail.com Mon Apr 13 11:10:10 2009 From: johan.rydberg at gmail.com (Johan Rydberg) Date: Mon, 13 Apr 2009 11:10:10 +0200 Subject: [Pythonmac-SIG] Getting None in KVC objectInKeyAtIndex_ In-Reply-To: <9E58C502-C54A-4A54-B473-0E4BE92DDAC0@zognot.org> References: <9E58C502-C54A-4A54-B473-0E4BE92DDAC0@zognot.org> Message-ID: <49E30172.30203@gmail.com> David Hain skrev: > I'm trying to use bindings to hook up my model to an NSOutlineView, and > I'm attempting to use the countOf, objectInAtIndex_ methods to > do the KVC half. The problem I'm running into is that I'm getting None > for the index argument, and I can't figure out what to do with that. The > reference materials[1] say that the method corresponds to the NSArray > objectAtIndex: method, which takes an NSUInteger, but doesn't mention > anything about null or nil or whatever it is in objc-land. Maybe this will help you: http://jimmatthews.wordpress.com/2007/07/12/objcselector-and-objcsignature/ From shane.clements at gmail.com Wed Apr 15 09:23:10 2009 From: shane.clements at gmail.com (Shane Clements) Date: Wed, 15 Apr 2009 01:23:10 -0600 Subject: [Pythonmac-SIG] py2app path question Message-ID: <1101ea550904150023p4646045am699753de76e980ca@mail.gmail.com> Hi. Looking for advice about p2app and paths during the bundling process. The application I am working with works fine finding the paths before being bundled with py2app but after has mangled ones. An example error: IOError: [Errno 2] No such file or directory: '/Users/Shane/UTc!/client/dist/client.app/Contents/Resources//Users/Shane/UTc!/client/dist/client.app/Contents/Resources/assets/objects/ships.xml' What is looks like is py2app is making aliases perhaps...? Is there a way to avoid this? Thanks, Shane -------------- next part -------------- An HTML attachment was scrubbed... URL: From ronaldoussoren at mac.com Wed Apr 15 09:29:01 2009 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Wed, 15 Apr 2009 09:29:01 +0200 Subject: [Pythonmac-SIG] py2app path question In-Reply-To: <1101ea550904150023p4646045am699753de76e980ca@mail.gmail.com> References: <1101ea550904150023p4646045am699753de76e980ca@mail.gmail.com> Message-ID: <109691277942951558423087754687446035149-Webmail@me.com> On Wednesday, April 15, 2009, at 09:23AM, "Shane Clements" wrote: >Hi. > >Looking for advice about p2app and paths during the bundling process. > >The application I am working with works fine finding the paths before being >bundled with py2app but after has mangled ones. That's odd. Can you reproduce the problem in a small program? Ronald From shane.clements at gmail.com Wed Apr 15 10:39:20 2009 From: shane.clements at gmail.com (Shane Clements) Date: Wed, 15 Apr 2009 02:39:20 -0600 Subject: [Pythonmac-SIG] py2app path question In-Reply-To: <109691277942951558423087754687446035149-Webmail@me.com> References: <1101ea550904150023p4646045am699753de76e980ca@mail.gmail.com> <109691277942951558423087754687446035149-Webmail@me.com> Message-ID: <1101ea550904150139l4e6c1654l6ea2af98491a88ca@mail.gmail.com> On Wed, Apr 15, 2009 at 1:29 AM, Ronald Oussoren wrote: > > On Wednesday, April 15, 2009, at 09:23AM, "Shane Clements" < > shane.clements at gmail.com> wrote: > >Hi. > > > >Looking for advice about p2app and paths during the bundling process. > > > >The application I am working with works fine finding the paths before > being > >bundled with py2app but after has mangled ones. > > That's odd. Can you reproduce the problem in a small program? > > Ronald > > Hi. Thanks for your response. I think that I just need to rethink my pathfinding. It's interesting that the filename has no path before bundling, then the whole path after because .app is relocatable I'm probably just discovering the obvious: the program needs it's whole path. Thanks, Shane -------------- next part -------------- An HTML attachment was scrubbed... URL: From beegee63 at gmail.com Wed Apr 15 20:38:36 2009 From: beegee63 at gmail.com (beegee beegee) Date: Thu, 16 Apr 2009 00:08:36 +0530 Subject: [Pythonmac-SIG] Unable to run python application Message-ID: <7122b8730904151138o3a0cb401hbfaba2d3babfd391@mail.gmail.com> Hi there, I am a beginner in python and I wrote a simple program called first.py (using aquamacs) and stored it on my desktop. I opened IDLE and wrote the command python first.py and I got a syntax error with 'first' being highlighted I have a mac os 10.4.11, python 2.6.1 on IDLE and I also used the aquamacs compiler for python /* the program i wrote was*/ print " Hello world" user_input = raw_input("What is your name?") print "Thank you", user_input */ -------------- next part -------------- A non-text attachment was scrubbed... Name: first.py Type: application/octet-stream Size: 97 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Picture 1.png Type: image/png Size: 9035 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Picture 2.png Type: image/png Size: 10300 bytes Desc: not available URL: From massimodisasha at yahoo.it Wed Apr 15 21:06:50 2009 From: massimodisasha at yahoo.it (massimo di stefano) Date: Wed, 15 Apr 2009 21:06:50 +0200 Subject: [Pythonmac-SIG] Unable to run python application In-Reply-To: References: Message-ID: <3061C86A-CBC2-4C22-9CFE-27E6FBAF1D93@yahoo.it> Hi, you can run your program from the terminal.app (Application -> Utility -> Terminal.app) simply running : python /path/to/first.py if you want run it inside a python shall, you need to define a function, to do it : changes the code to : #|/usr/bin/python def first(): print " Hello world" user_input = raw_input("What is your name?") print "Thank you", user_input then open terminal.app cd /directory where is your file.py type python macbook-pro-15-di-sasha:Desktop sasha$ python Python 2.5.1 (r251:54863, Jan 13 2009, 10:26:13) [GCC 4.0.1 (Apple Inc. build 5465)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from first import * >>> first() Hello world What is your name?epi Thank you epi >>> Massimo Di Stefano massimodisasha at yahoo.it epifanio on irc.freenode.net /join gfoss Il giorno 15/apr/09, alle ore 20:38, pbeegee beegee ha scritto: > > > > Hi there, I am a beginner in python and I wrote a simple program > called first.py (using aquamacs) and stored it on my desktop. > I opened IDLE and wrote the command python first.py > and I got a syntax error with 'first' being highlighted > I have a mac os 10.4.11, python 2.6.1 on IDLE > and I also used the aquamacs compiler for python > /* the program i wrote was*/ > print " Hello world" > user_input = raw_input("What is your name?") > print "Thank you", user_input > */ > > Chiacchiera con i tuoi amici in tempo reale! http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com From nad at acm.org Wed Apr 15 21:46:44 2009 From: nad at acm.org (Ned Deily) Date: Wed, 15 Apr 2009 12:46:44 -0700 Subject: [Pythonmac-SIG] Unable to run python application References: <7122b8730904151138o3a0cb401hbfaba2d3babfd391@mail.gmail.com> Message-ID: In article <7122b8730904151138o3a0cb401hbfaba2d3babfd391 at mail.gmail.com>, beegee beegee wrote: > Hi there, I am a beginner in python and I wrote a simple program > called first.py (using aquamacs) and stored it on my desktop. > I opened IDLE and wrote the command python first.py > and I got a syntax error with 'first' being highlighted > I have a mac os 10.4.11, python 2.6.1 on IDLE > and I also used the aquamacs compiler for python When you are in IDLE, use the Open command from the File menu bar item to open a python file in a new window. With focus on the new window, the menu bar will change to include a Run menu. -- Ned Deily, nad at acm.org From dan at rosspixelworks.com Wed Apr 15 21:27:00 2009 From: dan at rosspixelworks.com (Dan Ross) Date: Wed, 15 Apr 2009 14:27:00 -0500 Subject: [Pythonmac-SIG] Unable to run python application (beegee beegee) Message-ID: <49E63504.7060105@rosspixelworks.com> Hi bee gee - You need to type "python first.py" into Terminal, not IDLE. Dan pythonmac-sig-request at python.org wrote: > Send Pythonmac-SIG mailing list submissions to > pythonmac-sig at python.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://mail.python.org/mailman/listinfo/pythonmac-sig > or, via email, send a message with subject or body 'help' to > pythonmac-sig-request at python.org > > You can reach the person managing the list at > pythonmac-sig-owner at python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Pythonmac-SIG digest..." > > ------------------------------------------------------------------------ > > Today's Topics: > > 1. Unable to run python application (beegee beegee) > -------------- next part -------------- An HTML attachment was scrubbed... URL: From shane.clements at gmail.com Thu Apr 16 09:04:50 2009 From: shane.clements at gmail.com (Shane Clements) Date: Thu, 16 Apr 2009 01:04:50 -0600 Subject: [Pythonmac-SIG] Loading dynamic library Message-ID: <1101ea550904160004h7ed87712r1d10cc2f3439b318@mail.gmail.com> Hi. I'm using py2app to try to port a game to OS X, is there any to avoid this error? Traceback (most recent call last): File "game.py", line 18, in import ode ImportError: dlopen(/Users/Shane/UTc!/client/dist/client.app/Contents/Resources/lib/python2.5/lib-dynload/ode.so, 2): Library not loaded: @executable_path/../Frameworks/libode.dylib Referenced from: /Users/Shane/UTc!/client/dist/client.app/Contents/Resources/lib/python2.5/lib-dynload/ode.so Reason: image not found I think there's an attempt to load a dynamic library, but not entirely clear what is happening here. Googling suggests that there's some issue with the Framework, which I'll admit I'm just kinda puzzling out. Ideas? Shane -------------- next part -------------- An HTML attachment was scrubbed... URL: From alexandre at quessy.net Thu Apr 16 16:43:28 2009 From: alexandre at quessy.net (Alexandre Quessy) Date: Thu, 16 Apr 2009 10:43:28 -0400 Subject: [Pythonmac-SIG] Unable to run python application In-Reply-To: References: <7122b8730904151138o3a0cb401hbfaba2d3babfd391@mail.gmail.com> Message-ID: <72236ba90904160743x3549c2eao173337f29068c919@mail.gmail.com> Hi beegee ! "/* */" as a comments delimiter is not supported in Python. The simplest way to create comments in Python is to begin each comment line with a #. You can also use triple-delimited strings for documentation. a 2009/4/15 Ned Deily : > In article > <7122b8730904151138o3a0cb401hbfaba2d3babfd391 at mail.gmail.com>, > ?beegee beegee wrote: >> Hi there, I am a beginner in python and I wrote a simple program >> called first.py (using aquamacs) and stored it on my desktop. >> I opened IDLE and wrote the command python first.py >> and I got a syntax error with 'first' being highlighted >> I have a mac os 10.4.11, python 2.6.1 on IDLE >> and I also used the aquamacs compiler for python > > When you are in IDLE, use the Open command from the File menu bar item > to open a python file in a new window. ?With focus on the new window, > the menu bar will change to include a Run menu. > > -- > ?Ned Deily, > ?nad at acm.org > > _______________________________________________ > Pythonmac-SIG maillist ?- ?Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > -- Alexandre Quessy http://alexandre.quessy.net/ From janssen at parc.com Fri Apr 17 19:56:30 2009 From: janssen at parc.com (Bill Janssen) Date: Fri, 17 Apr 2009 10:56:30 PDT Subject: [Pythonmac-SIG] Building a PreferencePane with PyObjC? Message-ID: <53148.1239990990@parc.com> Hi, all. I'm trying to build a PreferencePane with Python and Interface Builder, and the examples I can find on the Web seem somewhat out-of-date. In particular, the EnvironmentPane example seems to use a "magic NIB", which I can't figure out how to construct from scratch, and which I can't seem to convert to XIB format. If someone could outline the steps of what needs to happen to build a new PreferencePane XIB file from scratch, using IB, I'd be grateful. Or if you've got a pointer to an up-to-date Xcode 3 example, that would be useful, too. Thanks! Bill From pascals_sub at pobox.com Sun Apr 19 02:23:25 2009 From: pascals_sub at pobox.com (Pascal Schaedeli) Date: Sat, 18 Apr 2009 17:23:25 -0700 Subject: [Pythonmac-SIG] Use Setup.py to install to /usr Message-ID: <2aa16a690904181723m5d6893f3g6db270ba44928e2e@mail.gmail.com> How to you instruct "setup.py install" to install all files under /usr instead of /Library/Frameworks/Python.framework/Versions/Current/bin/? I tried: python ./setup.py install --prefix=/usr --dry-run But it still attempts to create directories like /usr/lib/python2.5/site-packages I am trying to install "Duplicity", a backup tool using rsync and don't want it to be installed in the tree of a specific Python distribution in order to be able to upgrade or switch to another python version without affecting the availability of duplicity. Thanks. Pascal S. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ronaldoussoren at mac.com Sun Apr 19 17:53:31 2009 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Sun, 19 Apr 2009 17:53:31 +0200 Subject: [Pythonmac-SIG] Building a PreferencePane with PyObjC? In-Reply-To: <53148.1239990990@parc.com> References: <53148.1239990990@parc.com> Message-ID: Bill, The example that's in the repository is fully up-to-date, although it doesn't use Interface Builder. The easiest way to develop preference panes for now is to have a dummy xcode project to get the nibfile integration in interface builder (that is, when you add python files to an xcode project IB automaticly knows about those files). Then use py2app to actually build the preference pane. Py2app in subversion already can compile .xib files when building a bundle, unless you use the '-A' flag. In that case you're better of to instruct Interface builder to save your IB documents as '.nib' files. BTW, AFAIK there are no Xcode templates for building plugin bundles in Python and I have no intention to create those because I don't like Xcode for Python development. Ronald On 17 Apr, 2009, at 19:56, Bill Janssen wrote: > Hi, all. I'm trying to build a PreferencePane with Python and > Interface > Builder, and the examples I can find on the Web seem somewhat > out-of-date. In particular, the EnvironmentPane example seems to > use a > "magic NIB", which I can't figure out how to construct from scratch, > and > which I can't seem to convert to XIB format. If someone could outline > the steps of what needs to happen to build a new PreferencePane XIB > file > from scratch, using IB, I'd be grateful. > > Or if you've got a pointer to an up-to-date Xcode 3 example, that > would > be useful, too. > > Thanks! > > Bill > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2224 bytes Desc: not available URL: From janssen at parc.com Sun Apr 19 21:01:58 2009 From: janssen at parc.com (Bill Janssen) Date: Sun, 19 Apr 2009 12:01:58 PDT Subject: [Pythonmac-SIG] Building a PreferencePane with PyObjC? In-Reply-To: References: <53148.1239990990@parc.com> Message-ID: <91752.1240167718@parc.com> Ronald Oussoren wrote: > The example that's in the repository is fully up-to-date, although it > doesn't use Interface Builder. Good to know. I'd downloaded a version of the example from somewhere, which seems a bit antique compared to what's in http://svn.red-bean.com/pyobjc/trunk/ (I presume that's the repository?). But the repo code still has things like marking actions with "@objc.IBAction", which I haven't found necessary in my code. Is that still necessary? > The easiest way to develop preference panes for now is to have a dummy > xcode project to get the nibfile integration in interface builder > (that is, when you add python files to an xcode project IB automaticly > knows about those files). Then use py2app to actually build the > preference pane. OK, that seems straightforward. Do I have to run "File>>Reload All Class Files" to get IB to know about the specifics of the class? And, how do I build an appropriate setup.py file to run py2app on? Where is that documented? > Py2app in subversion already can compile .xib files when building a > bundle, unless you use the '-A' flag. In that case you're better of to > instruct Interface builder to save your IB documents as '.nib' files. My problem is connecting things up in IB in the first place, which is why I was talking about a step-by-step example. Suppose I use XCode to build a stub PrefPane project called "test". I remove the testPref.h and testPref.m files it provides, and add my own testPref.py file, using the "Python class which inherits from NSObject template". I make sure that testPref.py is in the "Classes" part of the Xcode project. I edit testPref.py to have the class "testPref" inherit from NSPreferencePane instead of NSObject. I then double-click on testPref.xib to bring up IB. That's where I get lost. What specific actions do I need to do to connect the preference pane to that new class file? Here's what I think is right: 1. In IB, use "File >> Reload All Class Files". 2. Select "File's Owner", and set its Class type to "testPref". 3. Build the UI of the PP and connect it up to outlets and actions on the "File's Owner" class. 4. Save everything in IB. 5. Run py2app to build the pane. > BTW, AFAIK there are no Xcode templates for building plugin bundles in > Python and I have no intention to create those because I don't like > Xcode for Python development. Yeah, I use Emacs myself, but it's handy to generate that stub project you recommend. Bill > Ronald > > On 17 Apr, 2009, at 19:56, Bill Janssen wrote: > > > Hi, all. I'm trying to build a PreferencePane with Python and > > Interface > > Builder, and the examples I can find on the Web seem somewhat > > out-of-date. In particular, the EnvironmentPane example seems to > > use a > > "magic NIB", which I can't figure out how to construct from scratch, > > and > > which I can't seem to convert to XIB format. If someone could outline > > the steps of what needs to happen to build a new PreferencePane XIB > > file > > from scratch, using IB, I'd be grateful. > > > > Or if you've got a pointer to an up-to-date Xcode 3 example, that > > would > > be useful, too. > > > > Thanks! > > > > Bill > > _______________________________________________ > > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > > http://mail.python.org/mailman/listinfo/pythonmac-sig > From dhain+pythonmac at zognot.org Sun Apr 19 21:17:05 2009 From: dhain+pythonmac at zognot.org (David Hain) Date: Sun, 19 Apr 2009 12:17:05 -0700 Subject: [Pythonmac-SIG] Building a PreferencePane with PyObjC? In-Reply-To: <91752.1240167718@parc.com> References: <53148.1239990990@parc.com> <91752.1240167718@parc.com> Message-ID: <5353EECE-60FB-428B-B744-B7CE1424D401@zognot.org> On Apr 19, 2009, at 12:01 PM, Bill Janssen wrote: >> Py2app in subversion already can compile .xib files when building a >> bundle, unless you use the '-A' flag. In that case you're better of >> to >> instruct Interface builder to save your IB documents as '.nib' files. FYI, here's a little snippet from one of my setup.py files to add a 'compile_nib' command. This is what I use to compile my xib files to nibs while I'm developing with -A. import subprocess import glob import os from distutils.core import Command class CompileNib(Command): user_options = [] def initialize_options(self): pass def finalize_options(self): pass def run(self): outdir = u'resources/English.lproj' if not os.path.exists(outdir): os.mkdir(outdir) for fn in glob.iglob(u'*.[nx]ib'): outfn = os.path.splitext(fn)[0] outfile = os.path.join(outdir, outfn + u'.nib') subprocess.check_call(['ibtool', '--compile', outfile, fn]) if __name__ == '__main__': setup(**dict(setup_args, cmdclass=dict(compile_nib=CompileNib))) This will find any *.[nx]ib files in the CWD and compile them into the resources/English.lproj directory. Should be easy enough to modify. All it really does is call 'ibtool --compile' which does the work. To use, just run 'python setup.py compile_nib'. Hope this helps! -David From janssen at parc.com Sun Apr 19 21:23:46 2009 From: janssen at parc.com (Bill Janssen) Date: Sun, 19 Apr 2009 12:23:46 PDT Subject: [Pythonmac-SIG] Building a PreferencePane with PyObjC? In-Reply-To: <91752.1240167718@parc.com> References: <53148.1239990990@parc.com> <91752.1240167718@parc.com> Message-ID: <92022.1240169026@parc.com> Bill Janssen wrote: > Ronald Oussoren wrote: > > > The example that's in the repository is fully up-to-date, although it > > doesn't use Interface Builder. > > Good to know. I'd downloaded a version of the example from somewhere, > which seems a bit antique compared to what's in > http://svn.red-bean.com/pyobjc/trunk/ (I presume that's the > repository?). But the repo code still has things like marking actions > with "@objc.IBAction", which I haven't found necessary in my code. Is > that still necessary? > > > The easiest way to develop preference panes for now is to have a dummy > > xcode project to get the nibfile integration in interface builder > > (that is, when you add python files to an xcode project IB automaticly > > knows about those files). Then use py2app to actually build the > > preference pane. > > OK, that seems straightforward. Do I have to run "File>>Reload All > Class Files" to get IB to know about the specifics of the class? > > And, how do I build an appropriate setup.py file to run py2app on? > Where is that documented? > > > Py2app in subversion already can compile .xib files when building a > > bundle, unless you use the '-A' flag. In that case you're better of to > > instruct Interface builder to save your IB documents as '.nib' files. > > My problem is connecting things up in IB in the first place, which is > why I was talking about a step-by-step example. Suppose I use XCode to > build a stub PrefPane project called "test". I remove the testPref.h > and testPref.m files it provides, and add my own testPref.py file, using > the "Python class which inherits from NSObject template". I make sure > that testPref.py is in the "Classes" part of the Xcode project. I edit > testPref.py to have the class "testPref" inherit from NSPreferencePane > instead of NSObject. I then double-click on testPref.xib to bring up > IB. > > That's where I get lost. What specific actions do I need to do to > connect the preference pane to that new class file? > > Here's what I think is right: > > 1. In IB, use "File >> Reload All Class Files". > 2. Select "File's Owner", and set its Class type to "testPref". > 3. Build the UI of the PP and connect it up to outlets and actions > on the "File's Owner" class. > 4. Save everything in IB. > 5. Run py2app to build the pane. > > > BTW, AFAIK there are no Xcode templates for building plugin bundles in > > Python and I have no intention to create those because I don't like > > Xcode for Python development. > > Yeah, I use Emacs myself, but it's handy to generate that stub project > you recommend. > > Bill > > > Ronald > > > > On 17 Apr, 2009, at 19:56, Bill Janssen wrote: > > > > > Hi, all. I'm trying to build a PreferencePane with Python and > > > Interface > > > Builder, and the examples I can find on the Web seem somewhat > > > out-of-date. In particular, the EnvironmentPane example seems to > > > use a > > > "magic NIB", which I can't figure out how to construct from scratch, > > > and > > > which I can't seem to convert to XIB format. If someone could outline > > > the steps of what needs to happen to build a new PreferencePane XIB > > > file > > > from scratch, using IB, I'd be grateful. > > > > > > Or if you've got a pointer to an up-to-date Xcode 3 example, that > > > would > > > be useful, too. > > > > > > Thanks! > > > > > > Bill Yeah, I still can't get this to work. When I try to load the prefPane, I get the following error message on the console: *** -[NSCFArray insertObject:atIndex:]: attempt to insert nil I think I'm missing something in the NIB. Bill From ronaldoussoren at mac.com Sun Apr 19 22:13:40 2009 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Sun, 19 Apr 2009 22:13:40 +0200 Subject: [Pythonmac-SIG] Building a PreferencePane with PyObjC? In-Reply-To: <91752.1240167718@parc.com> References: <53148.1239990990@parc.com> <91752.1240167718@parc.com> Message-ID: <5F7807AD-47EF-4AD0-A858-91EBAD3BB954@mac.com> On 19 Apr, 2009, at 21:01, Bill Janssen wrote: > Ronald Oussoren wrote: > >> The example that's in the repository is fully up-to-date, although it >> doesn't use Interface Builder. > > Good to know. I'd downloaded a version of the example from somewhere, > which seems a bit antique compared to what's in > http://svn.red-bean.com/pyobjc/trunk/ (I presume that's the > repository?). But the repo code still has things like marking actions > with "@objc.IBAction", which I haven't found necessary in my code. Is > that still necessary? That isn't "still" necessary, it is necessary for the Python support in Interface Builder to work correctly. That's the purely functional reason for adding that decorator, although it also helps in documenting why the method is there. Ronald -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2224 bytes Desc: not available URL: From janssen at parc.com Sun Apr 19 22:40:28 2009 From: janssen at parc.com (Bill Janssen) Date: Sun, 19 Apr 2009 13:40:28 PDT Subject: [Pythonmac-SIG] Building a PreferencePane with PyObjC? In-Reply-To: <5F7807AD-47EF-4AD0-A858-91EBAD3BB954@mac.com> References: <53148.1239990990@parc.com> <91752.1240167718@parc.com> <5F7807AD-47EF-4AD0-A858-91EBAD3BB954@mac.com> Message-ID: <93763.1240173628@parc.com> Ronald Oussoren wrote: > > On 19 Apr, 2009, at 21:01, Bill Janssen wrote: > > > Ronald Oussoren wrote: > > > >> The example that's in the repository is fully up-to-date, although it > >> doesn't use Interface Builder. > > > > Good to know. I'd downloaded a version of the example from somewhere, > > which seems a bit antique compared to what's in > > http://svn.red-bean.com/pyobjc/trunk/ (I presume that's the > > repository?). But the repo code still has things like marking actions > > with "@objc.IBAction", which I haven't found necessary in my code. Is > > that still necessary? > > That isn't "still" necessary, it is necessary for the Python support > in Interface Builder to work correctly. That's the purely functional > reason for adding that decorator, although it also helps in > documenting why the method is there. "work properly"? So, what breaks if it's omitted? As I say, I've written functioning Cocoa-Python code that doesn't use @objc.IBAction, but the actions seem to get called correctly. Bill From pascals_sub at pobox.com Mon Apr 20 01:03:07 2009 From: pascals_sub at pobox.com (Pascal Schaedeli) Date: Sun, 19 Apr 2009 16:03:07 -0700 Subject: [Pythonmac-SIG] Use Setup.py to install to /usr In-Reply-To: <2aa16a690904181723m5d6893f3g6db270ba44928e2e@mail.gmail.com> References: <2aa16a690904181723m5d6893f3g6db270ba44928e2e@mail.gmail.com> Message-ID: <2aa16a690904191603p141f59aet51c1dcf3410e2fcc@mail.gmail.com> Here is the temporary solution I've found for my case. Still looking for better suggestions. To recap, my problem is that by default, "python setup.py install" places all files under "/Library/Frameworks/Python.framework/Versions/Current/bin/". When I added "--prefix=/usr" as a setup.py argument, the main executable is correctly located under /usr/bin, but many python files to be imported are copied to a newly created directory "/usr/lib/python2.5/site-packages". Then, when python starts, the site module (http://docs.python.org/library/site.html) adds the concatenation of sys.prefix and lib/python2.5/site-packages as well as lib/site-python and adds those combinations to the path. Unfortunately, sys.prefix is "/Library/Frameworks/Python.framework/Versions/2.5", so the necessary imports in "/usr/lib/python2.5/site-packages" are never found (didn't research further, but this is probably a python compile time option). I did two manual adjustments: - Moved necessary imports from "/usr/lib/python2.5/site-packages" to "/usr/lib/site-python" to remove the python version specificity. Let me know if there is any way to achieve this with setup.py. - Added "/usr/lib/site-python" to PYTHONPATH environment variable. Pascal On Sat, Apr 18, 2009 at 5:23 PM, Pascal Schaedeli wrote: > How to you instruct "setup.py install" to install all files under /usr > instead of /Library/Frameworks/Python.framework/Versions/Current/bin/? > I tried: > python ./setup.py install --prefix=/usr --dry-run > But it still attempts to create directories > like /usr/lib/python2.5/site-packages > > I am trying to install "Duplicity", a backup tool using rsync and don't > want it to be installed in the tree of a specific Python distribution in > order to be able to upgrade or switch to another python version without > affecting the availability of duplicity. > > Thanks. > Pascal S. > -- pascals at pobox.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From nad at acm.org Mon Apr 20 04:52:20 2009 From: nad at acm.org (Ned Deily) Date: Sun, 19 Apr 2009 19:52:20 -0700 Subject: [Pythonmac-SIG] Use Setup.py to install to /usr References: <2aa16a690904181723m5d6893f3g6db270ba44928e2e@mail.gmail.com> <2aa16a690904191603p141f59aet51c1dcf3410e2fcc@mail.gmail.com> Message-ID: In article <2aa16a690904191603p141f59aet51c1dcf3410e2fcc at mail.gmail.com>, Pascal Schaedeli wrote: > Here is the temporary solution I've found for my case. Still looking for > better suggestions. > To recap, my problem is that by default, "python setup.py install" places > all files under > "/Library/Frameworks/Python.framework/Versions/Current/bin/". When I added > "--prefix=/usr" as a setup.py argument, the main executable is correctly > located under /usr/bin, but many python files to be imported are copied to a > newly created directory "/usr/lib/python2.5/site-packages". Then, when > python starts, the site module (http://docs.python.org/library/site.html) > adds the concatenation of sys.prefix and lib/python2.5/site-packages as well > as lib/site-python and adds those combinations to the path. > > Unfortunately, sys.prefix is > "/Library/Frameworks/Python.framework/Versions/2.5", so the necessary > imports in "/usr/lib/python2.5/site-packages" are never found (didn't > research further, but this is probably a python compile time option). > > I did two manual adjustments: > > - Moved necessary imports from "/usr/lib/python2.5/site-packages" to > "/usr/lib/site-python" to remove the python version specificity. Let me > know > if there is any way to achieve this with setup.py. > - Added "/usr/lib/site-python" to PYTHONPATH environment variable. In general, you should not be installing anything into /usr/bin or /usr/lib; the contents of those directories are managed by OS X. /usr/local/ would be OK, though. No matter where duplicity gets installed, there will still be a dependency on a python interpreter version. If you are using python.org installers, the standard place for site-packages is within the framework. If you need to upgrade that python version, you can easily re-install duplicity and its dependencies or you can move them out of the way when you perform a python upgrade. If you use the 10.5 Apple-supplied python, the site packages are installed in /Library/Python/Frameworks/ and shouldn't be disturbed by an Apple 10.5.x upgrade. You could also install a Macports python to use as your "production" python; macports also includes a duplicity port, though no idea how well it is maintained. Or, in theory, you could use virtualenv with any of those python versions to create a "frozen" virtual python environment and install duplicity there. -- Ned Deily, nad at acm.org From ronaldoussoren at mac.com Mon Apr 20 07:37:04 2009 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Mon, 20 Apr 2009 07:37:04 +0200 Subject: [Pythonmac-SIG] Building a PreferencePane with PyObjC? In-Reply-To: <93763.1240173628@parc.com> References: <53148.1239990990@parc.com> <91752.1240167718@parc.com> <5F7807AD-47EF-4AD0-A858-91EBAD3BB954@mac.com> <93763.1240173628@parc.com> Message-ID: On 19 Apr, 2009, at 22:40, Bill Janssen wrote: > Ronald Oussoren wrote: > >> >> On 19 Apr, 2009, at 21:01, Bill Janssen wrote: >> >>> Ronald Oussoren wrote: >>> >>>> The example that's in the repository is fully up-to-date, >>>> although it >>>> doesn't use Interface Builder. >>> >>> Good to know. I'd downloaded a version of the example from >>> somewhere, >>> which seems a bit antique compared to what's in >>> http://svn.red-bean.com/pyobjc/trunk/ (I presume that's the >>> repository?). But the repo code still has things like marking >>> actions >>> with "@objc.IBAction", which I haven't found necessary in my >>> code. Is >>> that still necessary? >> >> That isn't "still" necessary, it is necessary for the Python support >> in Interface Builder to work correctly. That's the purely functional >> reason for adding that decorator, although it also helps in >> documenting why the method is there. > > "work properly"? So, what breaks if it's omitted? If you don't add the IBAction decorator Interface Builder won't show your action methods as actions when you ctrl-drag a connection to an instance of your class. Ronald -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2224 bytes Desc: not available URL: From janssen at parc.com Mon Apr 20 17:24:14 2009 From: janssen at parc.com (Bill Janssen) Date: Mon, 20 Apr 2009 08:24:14 PDT Subject: [Pythonmac-SIG] Building a PreferencePane with PyObjC? In-Reply-To: References: <53148.1239990990@parc.com> <91752.1240167718@parc.com> <5F7807AD-47EF-4AD0-A858-91EBAD3BB954@mac.com> <93763.1240173628@parc.com> Message-ID: <5125.1240241054@parc.com> Ronald Oussoren wrote: > If you don't add the IBAction decorator Interface Builder won't show > your action methods as actions when you ctrl-drag a connection to an > instance of your class. Thanks, Ronald. So this is part of what IB looks for when you tell it to scan the class files. I've been adding the actions myself manually to the class in IB, before ctrl-dragging the connection, which is another way of doing it but laborious. Bill From ronaldoussoren at mac.com Mon Apr 20 18:54:12 2009 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Mon, 20 Apr 2009 18:54:12 +0200 Subject: [Pythonmac-SIG] Building a PreferencePane with PyObjC? In-Reply-To: <5125.1240241054@parc.com> References: <53148.1239990990@parc.com> <91752.1240167718@parc.com> <5F7807AD-47EF-4AD0-A858-91EBAD3BB954@mac.com> <93763.1240173628@parc.com> <5125.1240241054@parc.com> Message-ID: On 20 Apr, 2009, at 17:24, Bill Janssen wrote: > Ronald Oussoren wrote: > >> If you don't add the IBAction decorator Interface Builder won't show >> your action methods as actions when you ctrl-drag a connection to an >> instance of your class. > > Thanks, Ronald. > > So this is part of what IB looks for when you tell it to scan the > class > files. I've been adding the actions myself manually to the class in > IB, > before ctrl-dragging the connection, which is another way of doing > it but > laborious. That right. Interface Builder looks for the IBAction decorator to define outlets and IBOutlet definitions to define outlets: class MyController (NSObject): outlet = objc.IBOutlet() @objc.IBAction def myAction_(self, sender): pass Ronald > > Bill -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2224 bytes Desc: not available URL: From Chris.Barker at noaa.gov Mon Apr 20 21:15:16 2009 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Mon, 20 Apr 2009 12:15:16 -0700 Subject: [Pythonmac-SIG] Use Setup.py to install to /usr In-Reply-To: <2aa16a690904191603p141f59aet51c1dcf3410e2fcc@mail.gmail.com> References: <2aa16a690904181723m5d6893f3g6db270ba44928e2e@mail.gmail.com> <2aa16a690904191603p141f59aet51c1dcf3410e2fcc@mail.gmail.com> Message-ID: <49ECC9C4.1070200@noaa.gov> Pascal Schaedeli wrote: > Here is the temporary solution I've found for my case. Still looking for > better suggestions. my main suggestion is to "don't do that". A few notes: 1) Ned's right -- DO NOT put stuff in /usr/lib -- use /usr/local/lib, if at all. > To recap, my problem is that by default, "python setup.py install" > places all files under > "/Library/Frameworks/Python.framework/Versions/Current/bin/". Right, that's the whole point of distutils -- it installs stuff where it belongs for the python the setup,oy is run with. If all else fails, you could do: setup.py build then hand-copy everything where you want it. > Unfortunately, sys.prefix is > "/Library/Frameworks/Python.framework/Versions/2.5", so the necessary > imports in "/usr/lib/python2.5/site-packages" are never found (didn't > research further, but this is probably a python compile time option). it's doing the right thing -- you are trying to do something odd, so you'll need to add the extra path yourself. > I did two manual adjustments: > > * Moved necessary imports from "/usr/lib/python2.5/site-packages" to > "/usr/lib/site-python" to remove the python version specificity. Bad idea -- version specificity is there for a reason -- 2.x and 2.x+n are not necessarily fully compatibile -- definitely not if they have any compiled extensions > Let me know if there is any way to achieve this with setup.py. I don't think so. > * Added "/usr/lib/site-python" to PYTHONPATH environment variable. I dont like using PYTHONPATH -- it's global to ALL pythons, which can cause trouble. Rather, I'd use a *.pth file, put in /Library/........./site-packages. You can look at wxPython for an example, it uses a *.pth file to add paths in /usr/local so that the python,org an Apple pythons can share the same wxPython install -- note that those are both 2.5, though. I'm still not sure what problem you are trying to solve. If you install in the usual way, and upgrade form 2.5.x to 2.5.x+1, it will just work. If you upgrade to 2.6.*, it probably will need a new install of your package anyway. > in order to be able to upgrade or switch to another > python version without affecting the availability of duplicity. You can install a new python, and keep the old one around, so that it will still be able to run old code, so this may be a non-issue anyway. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov From jsmith at medplus.com Tue Apr 21 22:53:12 2009 From: jsmith at medplus.com (Smith, Jeff) Date: Tue, 21 Apr 2009 16:53:12 -0400 Subject: [Pythonmac-SIG] Using getwcd() in a frozen app Message-ID: I am using py2app 0.3.6 on Mac OX 10.5 and after I freeze a simple command line tool, os.getcwd() returns the location where the application binary lives and not the directory the application is run from. Is there expected behavior and if so, is there a workaround for this? Jeffery G. Smith MedPlus, A Quest Diagnostics Company | Senior SCM Specialist | 4690 Parkway Drive | Mason, OH 45040 USA | phone +1.513.204.2601 | fax +1.513.229.5505 | mobile +1.513.335.1517 | jsmith at MedPlus.com | www.MedPlus.com Please think about resource conservation before you print this message Confidentiality Notice: The information contained in this electronic transmission is confidential and may be legally privileged. It is intended only for the addressee(s) named above. If you are not an intended recipient, be aware that any disclosure, copying, distribution or use of the information contained in this transmission is prohibited and may be unlawful. If you have received this transmission in error, please notify us by telephone (513) 229-5500 or by email (postmaster at MedPlus.com). After replying, please erase it from your computer system. -------------- next part -------------- An HTML attachment was scrubbed... URL: From rowen at u.washington.edu Wed Apr 22 01:10:30 2009 From: rowen at u.washington.edu (Russell E. Owen) Date: Tue, 21 Apr 2009 16:10:30 -0700 Subject: [Pythonmac-SIG] Patch for bdist_mpkg Message-ID: bdist_mpkg failed for me on 10.5.6 when I tried to build a binary for numarray 1.3.0/Python 2.6 as follows: "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-pac kages/bdist_mpkg/tools.py", line 106, in admin_writable gid = get_gid('admin') File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-pac kages/bdist_mpkg/tools.py", line 90, in get_gid raise ValueError('group %s not found' % (name,)) ValueError: group admin not found When I noted this on a numpy mailing list David Cournapeau pointed out the a patch, which is at the very end of the following document: and stated: "It is a bug of bdist_mpkg on leopard (the error message is a bit misleading - if you look at the code, you will see it calls for a command line utility which does not exist on leopard)." I applied the patch and it worked for me. I'm hoping the patch (or an equivalent) could make its way to the release version. If there's anything I can do to help this process let me know. -- Russell P.S. I have a binary installer for numpy 1.3.0 on MacPython 2.6. Email me if you want to test it or serve it. So far binary installers for MacPython 2.6 seem to be in very short supply (I still need matplotlib and PIL before I can switch away from Python 2.5). From Chris.Barker at noaa.gov Wed Apr 22 01:34:04 2009 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Tue, 21 Apr 2009 16:34:04 -0700 Subject: [Pythonmac-SIG] Using getwcd() in a frozen app In-Reply-To: References: Message-ID: <49EE57EC.1040307@noaa.gov> Smith, Jeff wrote: > I am using py2app 0.3.6 on Mac OX 10.5 and after I freeze a simple > command line tool, os.getcwd() returns the location where the > application binary lives and not the directory the application is run > from. Is there expected behavior Yes. The idea is that with a GUI app, the working dir is poorly defined, so this can be useful. > and if so, is there a workaround for this? Hmmm. Py2app really isn't designed for command line apps -- how are you launching it? But in any case, it looks like this option may do what you want: --no-chdir (-C) do not change to the data directory (Contents/Resources) [forced for plugins] I found that here: http://svn.pythonmac.org/py2app/py2app/trunk/doc/index.html#option-reference -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 Apr 22 07:27:38 2009 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Wed, 22 Apr 2009 07:27:38 +0200 Subject: [Pythonmac-SIG] Patch for bdist_mpkg In-Reply-To: References: Message-ID: Russel, The patch is already in the reposity. I guess Bob never released a version with that patch included. Are you using bdist_mpkg 0.4.3? If so, I'll push out a new release that includes the patch. Ronald On 22 Apr, 2009, at 1:10, Russell E. Owen wrote: > bdist_mpkg failed for me on 10.5.6 when I tried to build a binary for > numarray 1.3.0/Python 2.6 as follows: > "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ > site-pac > kages/bdist_mpkg/tools.py", line 106, in admin_writable > gid = get_gid('admin') > File > "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ > site-pac > kages/bdist_mpkg/tools.py", line 90, in get_gid > raise ValueError('group %s not found' % (name,)) > ValueError: group admin not found > > When I noted this on a numpy mailing list David Cournapeau pointed out > the a patch, which is at the very end of the following document: > > and stated: > "It is a bug of bdist_mpkg on leopard (the error message is a bit > misleading - if you look at the code, you will see it calls for a > command line utility which does not exist on leopard)." > > I applied the patch and it worked for me. > > I'm hoping the patch (or an equivalent) could make its way to the > release version. If there's anything I can do to help this process let > me know. > > -- Russell > > P.S. I have a binary installer for numpy 1.3.0 on MacPython 2.6. Email > me if you want to test it or serve it. So far binary installers for > MacPython 2.6 seem to be in very short supply (I still need matplotlib > and PIL before I can switch away from Python 2.5). > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2224 bytes Desc: not available URL: From bollen_85 at hotmail.com Wed Apr 22 09:52:14 2009 From: bollen_85 at hotmail.com (Mikael Andersson) Date: Wed, 22 Apr 2009 07:52:14 +0000 Subject: [Pythonmac-SIG] FW: Upgrade python Apple tv (Mac) Message-ID: From: bollen_85 at hotmail.com To: pythonmac-sig at python.org Subject: Upgrade python Apple tv (Mac) Date: Wed, 22 Apr 2009 07:50:16 +0000 Hi, I have python on my Apple tv but the version I'm using is 2.5 and I would like to update to current version 3.0.1 Cheers Mikael L?gg till karta och v?gbeskrivning f?r din fest. Visa v?gen! _________________________________________________________________ Hitta k?rleken nu i v?r! http://dejting.se.msn.com/channel/index.aspx?trackingid=1002952 -------------- next part -------------- An HTML attachment was scrubbed... URL: From bollen_85 at hotmail.com Wed Apr 22 09:50:16 2009 From: bollen_85 at hotmail.com (Mikael Andersson) Date: Wed, 22 Apr 2009 07:50:16 +0000 Subject: [Pythonmac-SIG] Upgrade python Apple tv (Mac) Message-ID: Hi, I have python on my Apple tv but the version I'm using is 2.5 and I would like to update to current version 3.0.1 Cheers Mikael _________________________________________________________________ Hitta hetaste singlarna p? MSN Dejting! http://dejting.se.msn.com/channel/index.aspx?trackingid=1002952 -------------- next part -------------- An HTML attachment was scrubbed... URL: From Chris.Barker at noaa.gov Wed Apr 22 19:30:59 2009 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Wed, 22 Apr 2009 10:30:59 -0700 Subject: [Pythonmac-SIG] Using getwcd() in a frozen app In-Reply-To: References: <49EE57EC.1040307@noaa.gov> Message-ID: <49EF5453.10909@noaa.gov> NOTE: your reply only went to me, not the list -- you need to "reply all". Smith, Jeff wrote: > Thanks...that did the trick. good, it wasn't totally clear to me that that was quite what it did! > In case you are interested in the context, we have an automated build > system that works across multiple platforms and use a frozen python app > for some things. We freeze it to avoid having to install Python on all > the build machines. We just added Mac to the list of platforms and the > freezing tool that works on Linux and Windows (cx_Freeze) doesn't work > on Mac so I am using py2app for that platform. It sounds like you are done, but just in case, you might look into bbfreeze -- it works on all those platforms, and while it doesn't build app bundles on OS-X, it may work well for your 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 jsmith at medplus.com Wed Apr 22 20:21:42 2009 From: jsmith at medplus.com (Smith, Jeff) Date: Wed, 22 Apr 2009 14:21:42 -0400 Subject: [Pythonmac-SIG] Using getwcd() in a frozen app In-Reply-To: <49EF5453.10909@noaa.gov> References: <49EE57EC.1040307@noaa.gov> <49EF5453.10909@noaa.gov> Message-ID: Unfortunately, bbfreeze doesn't even work for simple cases on Mac OS X: Warning: don't know how to handle binary dependencies on this platform (darwin) Jeffery G. Smith MedPlus, A Quest Diagnostics Company | Senior SCM Specialist | 4690 Parkway Drive | Mason, OH 45040 USA | phone +1.513.204.2601 | fax +1.513.229.5505 | mobile +1.513.335.1517 | jsmith at MedPlus.com | www.MedPlus.com Please think about resource conservation before you print this message -----Original Message----- From: pythonmac-sig-bounces+jsmith=medplus.com at python.org [mailto:pythonmac-sig-bounces+jsmith=medplus.com at python.org] On Behalf Of Christopher Barker Sent: Wednesday, April 22, 2009 1:31 PM To: Pythonmac-sig Subject: Re: [Pythonmac-SIG] Using getwcd() in a frozen app NOTE: your reply only went to me, not the list -- you need to "reply all". Smith, Jeff wrote: > Thanks...that did the trick. good, it wasn't totally clear to me that that was quite what it did! > In case you are interested in the context, we have an automated build > system that works across multiple platforms and use a frozen python > app for some things. We freeze it to avoid having to install Python > on all the build machines. We just added Mac to the list of platforms > and the freezing tool that works on Linux and Windows (cx_Freeze) > doesn't work on Mac so I am using py2app for that platform. It sounds like you are done, but just in case, you might look into bbfreeze -- it works on all those platforms, and while it doesn't build app bundles on OS-X, it may work well for your 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 _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG at python.org http://mail.python.org/mailman/listinfo/pythonmac-sig Confidentiality Notice: The information contained in this electronic transmission is confidential and may be legally privileged. It is intended only for the addressee(s) named above. If you are not an intended recipient, be aware that any disclosure, copying, distribution or use of the information contained in this transmission is prohibited and may be unlawful. If you have received this transmission in error, please notify us by telephone (513) 229-5500 or by email (postmaster at MedPlus.com). After replying, please erase it from your computer system. From Chris.Barker at noaa.gov Wed Apr 22 20:31:34 2009 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Wed, 22 Apr 2009 11:31:34 -0700 Subject: [Pythonmac-SIG] Using getwcd() in a frozen app In-Reply-To: References: <49EE57EC.1040307@noaa.gov> <49EF5453.10909@noaa.gov> Message-ID: <49EF6286.7090502@noaa.gov> Smith, Jeff wrote: > Unfortunately, bbfreeze doesn't even work for simple cases on Mac OS X: > > Warning: don't know how to handle binary dependencies on this platform > (darwin) Are you using the development version? I don't know that Mac support has made it to a release version, but it has worked for me at least once -- it didn't build an app bundle, so I didn't go forward with it, but it has been used. Here is a thread from the bbfreeze-users list -- I don't know if any progress has been made since then: http://groups.google.com/group/bbfreeze-users/browse_thread/thread/5652e1a12a085054?hl=en# -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 jsmith at medplus.com Wed Apr 22 20:41:30 2009 From: jsmith at medplus.com (Smith, Jeff) Date: Wed, 22 Apr 2009 14:41:30 -0400 Subject: [Pythonmac-SIG] Interesting problem with frozen app Message-ID: This is only a test case for a larger system. I have created an app that freezes itself. setup.py ------------ from setuptools import setup APP = ['freezer.py'] DATA_FILES = [] OPTIONS = {'argv_emulation': True, 'no_chdir': True, 'optimize': True} setup( app=APP, data_files=DATA_FILES, options={'py2app': OPTIONS}, setup_requires=['py2app'], ) freezer.py -------------- import os os.system('python setup.py py2app') Running: python freezer.py works as expected. But the frozen app does not work: > mv dist run > run/freezer.app/Contents/MacOS/freezer Traceback (most recent call last): File "setup.py", line 1, in from setuptools import setup ImportError: No module named setuptools Note that the error is not comming from the frozen app but from the copy of Python being run by the frozen app in the os.system call. Jeffery G. Smith MedPlus, A Quest Diagnostics Company | Senior SCM Specialist | 4690 Parkway Drive | Mason, OH 45040 USA | phone +1.513.204.2601 | fax +1.513.229.5505 | mobile +1.513.335.1517 | jsmith at MedPlus.com | www.MedPlus.com Please think about resource conservation before you print this message Confidentiality Notice: The information contained in this electronic transmission is confidential and may be legally privileged. It is intended only for the addressee(s) named above. If you are not an intended recipient, be aware that any disclosure, copying, distribution or use of the information contained in this transmission is prohibited and may be unlawful. If you have received this transmission in error, please notify us by telephone (513) 229-5500 or by email (postmaster at MedPlus.com). After replying, please erase it from your computer system. -------------- next part -------------- An HTML attachment was scrubbed... URL: From beegee63 at gmail.com Thu Apr 23 15:36:58 2009 From: beegee63 at gmail.com (beegee beegee) Date: Thu, 23 Apr 2009 19:06:58 +0530 Subject: [Pythonmac-SIG] applications of python in software testing Message-ID: <7122b8730904230636l374bf5faqad56239d699d31db@mail.gmail.com> Hello, I am into software testing (manual). I would like to know how could I apply python to test a software, please provide some examples or references to reading material which would explain the same. regards From bgquest at gmail.com Fri Apr 24 09:47:38 2009 From: bgquest at gmail.com (beegee beegee) Date: Fri, 24 Apr 2009 13:17:38 +0530 Subject: [Pythonmac-SIG] How can python help in testing of applications Message-ID: <4644d56e0904240047m7c8fbce4x74f7d1e66b247924@mail.gmail.com> Hello, I am a software tester (black box, manual), and I would like to know, by learning python, how would it benefit my black box testing efforts Regards -------------- next part -------------- An HTML attachment was scrubbed... URL: From info at reatlas.com Sat Apr 25 00:33:04 2009 From: info at reatlas.com (Ethan Herdrick) Date: Fri, 24 Apr 2009 15:33:04 -0700 Subject: [Pythonmac-SIG] How to remove Python from my Mac? In-Reply-To: <91f48dbf0904241531g2d5283a6jc01f4b9d282a0a59@mail.gmail.com> References: <91f48dbf0904241531g2d5283a6jc01f4b9d282a0a59@mail.gmail.com> Message-ID: <91f48dbf0904241533k3722b56au56bb7726eed30229@mail.gmail.com> Hi - I'm getting started with Python and am getting ImportError trouble with the first step of the very simple tutorial for web.py. I'm suspecting that the fact that I have two installations of Python - one that my Mac came with and one that I installed from python-2.6.2-macosx2009-04-16.dmg which I got from python.org/download/ - might be the problem. Also, in trying to get this thing going I was fiddling with the install_lib setting in .pydistutils.cfg and left it in a modified state before running setup.py on a module, so the module ended up in a strange location. Anyway, I'd really be happier if I could wipe all python stuff - including things like easy_install - from my machine so I can just start over. ?This seems to be harder than it sounds. ?True? ?And how do I do this? Thank you in advance. From Chris.Barker at noaa.gov Sat Apr 25 01:08:20 2009 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Fri, 24 Apr 2009 16:08:20 -0700 Subject: [Pythonmac-SIG] How to remove Python from my Mac? In-Reply-To: <91f48dbf0904241533k3722b56au56bb7726eed30229@mail.gmail.com> References: <91f48dbf0904241531g2d5283a6jc01f4b9d282a0a59@mail.gmail.com> <91f48dbf0904241533k3722b56au56bb7726eed30229@mail.gmail.com> Message-ID: <49F24664.8020001@noaa.gov> Ethan Herdrick wrote: > Hi - I'm getting started with Python and am getting ImportError > trouble with the first step of the very simple tutorial for web.py. > I'm suspecting that the fact that I have two installations of Python - > one that my Mac came with and one that I installed from > python-2.6.2-macosx2009-04-16.dmg which I got from > python.org/download/ - might be the problem. that shouldn't be a problem, but you do need to make sure you are running the one you think you are. "which python" will help you know if you PATH is set right. > Anyway, I'd really be happier if I could wipe all python stuff - > including things like easy_install - from my machine so I can just > start over. Well, you don't want to wipe the Apple-supplied one. You can get rid of the python.org one be deleting: /Library/Frameworks/Python.framework/ and: /Applications/MacPython 2.6/ you may need to clean up your PATH in .bash_profile. If you've set any environment variable, like PYTHONPATH, you need to make sure you clear those in .bash_profile, etc. and I guess delete .pydistutils.cfg -CHB -- 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 rowen at u.washington.edu Sat Apr 25 01:13:55 2009 From: rowen at u.washington.edu (Russell E. Owen) Date: Fri, 24 Apr 2009 16:13:55 -0700 Subject: [Pythonmac-SIG] How to remove Python from my Mac? References: <91f48dbf0904241531g2d5283a6jc01f4b9d282a0a59@mail.gmail.com> <91f48dbf0904241533k3722b56au56bb7726eed30229@mail.gmail.com> Message-ID: In article <91f48dbf0904241533k3722b56au56bb7726eed30229 at mail.gmail.com>, Ethan Herdrick wrote: > Hi - I'm getting started with Python and am getting ImportError > trouble with the first step of the very simple tutorial for web.py. > I'm suspecting that the fact that I have two installations of Python - > one that my Mac came with and one that I installed from > python-2.6.2-macosx2009-04-16.dmg which I got from > python.org/download/ - might be the problem. > > Also, in trying to get this thing going I was fiddling with the > install_lib setting in .pydistutils.cfg and left it in a modified > state before running setup.py on a module, so the module ended up in a > strange location. > > Anyway, I'd really be happier if I could wipe all python stuff - > including things like easy_install - from my machine so I can just > start over. ?This seems to be harder than it sounds. ?True? ?And how > do I do this? Wiping the user-installed python is easy. Just delete: /Library/Frameworks/Python.Framework To do this from terminal you can type: rm -rf /Library/Frameworks/Python.Framework Note that you can also delete just a particular version if python if you have more than one -- just look in the directory mentioned above. This may leave some symlinks in /usr/local/bin, but if you plan to install a fresh python you can ignore them because they will get overwritten. Otherwise look for python* and in the case of Python 2.6, also *2to3* If you messed up your system python, that can be harder, but at least user-installed packages that were properly installed are easy to remove. Look in /Library/Python/2.3/site-packages/ (e.g. in Terminal type "open /Library/Python/2.3/site-packages") and remove everything except ReadMe and Extras.pth Then you can look at Extras.pth and make sure it only has one line that points somewhere in /System (you can delete any additional lines). For some reason I found I also have /Library/Python/2.5; not sure where that came from but it is basically empty (just contains site-packages/README). You might want to look for the 2.6 version and make sure it is basically empty. -- Russell From info at reatlas.com Sat Apr 25 05:07:53 2009 From: info at reatlas.com (Ethan Herdrick) Date: Fri, 24 Apr 2009 20:07:53 -0700 Subject: [Pythonmac-SIG] How to remove Python from my Mac? In-Reply-To: References: <91f48dbf0904241531g2d5283a6jc01f4b9d282a0a59@mail.gmail.com> <91f48dbf0904241533k3722b56au56bb7726eed30229@mail.gmail.com> Message-ID: <91f48dbf0904242007kc6d15beqd4ee60851cbe47c6@mail.gmail.com> Thank you for the info. Things are working OK now, so I'm going to stick with what I've got and not kill anything. I just wiped out the old dir I had specified as install_lib in .pydistutils.cfg , then restored that value (that is, the install_lib value in .pydistutils.cfg) to what it was supposed to be, ~/Library/Python/$py_version_short/site-packages . Then I used setup.py on the module I was trying to install. Everything seems to be working OK now. Good thing you guys prevented me from wiping out my pre-installed Python. I had assumed it was expendable. Thanks! -Ethan On Fri, Apr 24, 2009 at 4:13 PM, Russell E. Owen wrote: > In article > <91f48dbf0904241533k3722b56au56bb7726eed30229 at mail.gmail.com>, > ?Ethan Herdrick wrote: > >> Hi - I'm getting started with Python and am getting ImportError >> trouble with the first step of the very simple tutorial for web.py. >> I'm suspecting that the fact that I have two installations of Python - >> one that my Mac came with and one that I installed from >> python-2.6.2-macosx2009-04-16.dmg which I got from >> python.org/download/ - might be the problem. >> >> Also, in trying to get this thing going I was fiddling with the >> install_lib setting in .pydistutils.cfg and left it in a modified >> state before running setup.py on a module, so the module ended up in a >> strange location. >> >> Anyway, I'd really be happier if I could wipe all python stuff - >> including things like easy_install - from my machine so I can just >> start over. ?This seems to be harder than it sounds. ?True? ?And how >> do I do this? > > Wiping the user-installed python is easy. Just delete: > /Library/Frameworks/Python.Framework > > To do this from terminal you can type: > rm -rf /Library/Frameworks/Python.Framework > > Note that you can also delete just a particular version if python if you > have more than one -- just look in the directory mentioned above. > > This may leave some symlinks in /usr/local/bin, but if you plan to > install a fresh python you can ignore them because they will get > overwritten. Otherwise look for python* and in the case of Python 2.6, > also *2to3* > > If you messed up your system python, that can be harder, but at least > user-installed packages that were properly installed are easy to remove. > Look in /Library/Python/2.3/site-packages/ > (e.g. in Terminal type "open /Library/Python/2.3/site-packages") > and remove everything except ReadMe and Extras.pth > Then you can look at Extras.pth and make sure it only has one line that > points somewhere in /System > (you can delete any additional lines). > > For some reason I found I also have /Library/Python/2.5; not sure where > that came from but it is basically empty (just contains > site-packages/README). You might want to look for the 2.6 version and > make sure it is basically empty. > > -- Russell > > > _______________________________________________ > Pythonmac-SIG maillist ?- ?Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > > From pascals_sub at pobox.com Mon Apr 27 07:38:53 2009 From: pascals_sub at pobox.com (Pascal Schaedeli) Date: Sun, 26 Apr 2009 22:38:53 -0700 Subject: [Pythonmac-SIG] Use Setup.py to install to /usr In-Reply-To: <585F7865-C482-4345-94EC-0DE42843EAB9@mac.com> References: <2aa16a690904181723m5d6893f3g6db270ba44928e2e@mail.gmail.com> <585F7865-C482-4345-94EC-0DE42843EAB9@mac.com> Message-ID: <2aa16a690904262238r478dc14drc184a42f369c0093@mail.gmail.com> Thank you all on and off the list for your help and suggestions. I had tried to understand the meaning of http://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard for OS X, and your warnings clarified the difference between /usr and usr/local. Since duplicity is written to run under all Python >= 2.3, I attempted to make the installation non-version specific to ease Python upgrades. However, I hadn't realized that .pyc files were not backward compatible. So for now, duplicity is again installed in the version specific Python.framework directory. I sincerely appreciate your time helping me out. Thx again. Pascal > ---------- Forwarded message ---------- > From: Christopher Barker > To: pythonmac-sig at python.org > Date: Mon, 20 Apr 2009 12:15:16 -0700 > Subject: Re: [Pythonmac-SIG] Use Setup.py to install to /usr > Pascal Schaedeli wrote: > >> Here is the temporary solution I've found for my case. Still looking for >> better suggestions. >> > > my main suggestion is to "don't do that". A few notes: > > 1) Ned's right -- DO NOT put stuff in /usr/lib -- use /usr/local/lib, if at > all. > > To recap, my problem is that by default, "python setup.py install" places >> all files under >> "/Library/Frameworks/Python.framework/Versions/Current/bin/". >> > > Right, that's the whole point of distutils -- it installs stuff where it > belongs for the python the setup,oy is run with. If all else fails, you > could do: > > setup.py build > > then hand-copy everything where you want it. > > Unfortunately, sys.prefix is >> "/Library/Frameworks/Python.framework/Versions/2.5", so the necessary >> imports in "/usr/lib/python2.5/site-packages" are never found (didn't >> research further, but this is probably a python compile time option). >> > > it's doing the right thing -- you are trying to do something odd, so you'll > need to add the extra path yourself. > > I did two manual adjustments: >> >> * Moved necessary imports from "/usr/lib/python2.5/site-packages" to >> "/usr/lib/site-python" to remove the python version specificity. >> > > Bad idea -- version specificity is there for a reason -- 2.x and 2.x+n are > not necessarily fully compatibile -- definitely not if they have any > compiled extensions > > Let me know if there is any way to achieve this with setup.py. >> > > I don't think so. > > * Added "/usr/lib/site-python" to PYTHONPATH environment variable. >> > > I dont like using PYTHONPATH -- it's global to ALL pythons, which can cause > trouble. > > Rather, I'd use a *.pth file, put in /Library/........./site-packages. You > can look at wxPython for an example, it uses a *.pth file to add paths in > /usr/local so that the python,org an Apple pythons can share the same > wxPython install -- note that those are both 2.5, though. > > > I'm still not sure what problem you are trying to solve. If you install in > the usual way, and upgrade form 2.5.x to 2.5.x+1, it will just work. > > If you upgrade to 2.6.*, it probably will need a new install of your > package anyway. > > in order to be able to upgrade or switch to another >> python version without affecting the availability of duplicity. >> > > You can install a new python, and keep the old one around, so that it will > still be able to run old code, so this may be a non-issue anyway. > > -Chris > > > > > -- > Christopher Barker, Ph.D. > Oceanographer > > Emergency Response Division > NOAA/NOS/OR&R (206) 526-6959 voice > 7600 Sand Point Way NE (206) 526-6329 fax > Seattle, WA 98115 (206) 526-6317 main reception > > Chris.Barker at noaa.gov > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elizabeth.k.lackey at gmail.com Mon Apr 27 08:18:30 2009 From: elizabeth.k.lackey at gmail.com (Elizabeth Lackey) Date: Mon, 27 Apr 2009 01:18:30 -0500 Subject: [Pythonmac-SIG] py2app and mysqldb In-Reply-To: <5ed4161b0904262313ycf30ca8g441e2e9bdcc9c4b4@mail.gmail.com> References: <5ed4161b0904262313ycf30ca8g441e2e9bdcc9c4b4@mail.gmail.com> Message-ID: <5ed4161b0904262318q4d54714dqf4266cce4defac55@mail.gmail.com> I am trying to use py2app to create my .app file, it gives me no errors, but I have MySQLdb installed properly, I can get to it from the python command prompt. My program works properly when I run it through Terminal, but obviously, that's not good enough for distribution. When I execute the .app created by py2app, I error out claiming the module is not imported. I cannot figure out the syntax to edit the setup.py file created by py2applet to allow for the MySQLdb module. I am fairly certain it's a syntax issue... but...I don't know what to do with the syntax. my current setup.py from setuptools import setup APP = ['mac_test.py'] DATA_FILES = [] OPTIONS = {'argv_emulation': True} setup( app=APP, data_files=DATA_FILES, options={'py2app': OPTIONS}, setup_requires=['py2app'], options=dict(py2app=dict(argv_emulation=True), ) ) I assume I need to add something along the lines of this, but I can't figure out the syntax options=dict(includes=['MySQLdb']) Please help! -------------- next part -------------- An HTML attachment was scrubbed... URL: From Chris.Barker at noaa.gov Mon Apr 27 18:39:14 2009 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Mon, 27 Apr 2009 09:39:14 -0700 Subject: [Pythonmac-SIG] py2app and mysqldb In-Reply-To: <5ed4161b0904262318q4d54714dqf4266cce4defac55@mail.gmail.com> References: <5ed4161b0904262313ycf30ca8g441e2e9bdcc9c4b4@mail.gmail.com> <5ed4161b0904262318q4d54714dqf4266cce4defac55@mail.gmail.com> Message-ID: <49F5DFB2.9050700@noaa.gov> Elizabeth Lackey wrote: > I cannot figure out the syntax to edit the setup.py file created by > py2applet to allow for the MySQLdb module. there are a couple ways to pass options in, so it doe3s get hard to figure out: > from setuptools import setup > > APP = ['mac_test.py'] > DATA_FILES = [] PACKAGES = ['A_Package', 'Another_Package', ] INCLUDES = ['A_Module', 'Another_Module', ] EXCLUDES = ['A_module_you_don't_want', ] OPTIONS = {'argv_emulation': True, 'packages': PACKAGES, 'includes': INCLUDES, 'excludes': EXCLUDES, } 'packages' includes the entire package -- including all data, etc. 'includes' only includes module, but it's a bit buggy if the module is inside a package hierarchy. For instance, if you have: import packageA.packageB.moduleA and you include 'packageA.PackageB.moduleA' in py2app, module A will get put in the bundle, but at the top level, so it would have to be imported by: 'import moduleA' you can work around that by either adding all of packageA, or, specifically including the whole chain: INCLUDES = ['packageA', 'packageA.packageB' 'packageA.packageB.moduleA' ] > setup( > app=APP, > data_files=DATA_FILES, > options={'py2app': OPTIONS}, > setup_requires=['py2app'], > options=dict(py2app=dict(argv_emulation=True), > ) > ) > > I assume I need to add something along the lines of this, but I can't > figure out the syntax > options=dict(includes=['MySQLdb']) > > Please help! > > > ------------------------------------------------------------------------ > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig -- 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 elizabeth.k.lackey at gmail.com Mon Apr 27 21:43:13 2009 From: elizabeth.k.lackey at gmail.com (Elizabeth Lackey) Date: Mon, 27 Apr 2009 14:43:13 -0500 Subject: [Pythonmac-SIG] py2app and mysqldb In-Reply-To: <49F5DFB2.9050700@noaa.gov> References: <5ed4161b0904262313ycf30ca8g441e2e9bdcc9c4b4@mail.gmail.com> <5ed4161b0904262318q4d54714dqf4266cce4defac55@mail.gmail.com> <49F5DFB2.9050700@noaa.gov> Message-ID: <5ed4161b0904271243n680ed265j2fa3da20c11b8af9@mail.gmail.com> My setup.py now looks like... from setuptools import setup APP = ['mac_test.py'] DATA_FILES = [] PACKAGES = ['MySQLdb'] INCLUDES = ['MySQLdb'] OPTIONS = {'argv_emulation': True, 'packages': PACKAGES, 'includes': INCLUDES, } setup( app=APP, data_files=DATA_FILES, options={'py2app': OPTIONS}, setup_requires=['py2app'], options=dict(py2app=dict(argv_emulation=True), ) ) I've tried it with only the PACKAGES, and only the INCLUDES, none of these have worked. MySQLdb is installed in /Library/Python/2.5/site-packages. mac_test.py includes 'import MySQLdb' at the top when I run "python setup.py py2app -A" the executable is created, I attempt to open it and receive ImportError: No Module named MySQLdb when I run "python setup.pu py2app" the executable is created and opening it receives... ImportError: '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-dynload/_mysql.so' On Mon, Apr 27, 2009 at 11:39, Christopher Barker wrote: > Elizabeth Lackey wrote: > > I cannot figure out the syntax to edit the setup.py file created by >> py2applet to allow for the MySQLdb module. >> > > there are a couple ways to pass options in, so it doe3s get hard to figure > out: > > from setuptools import setup >> >> APP = ['mac_test.py'] >> DATA_FILES = [] >> > > PACKAGES = ['A_Package', > 'Another_Package', > ] > > INCLUDES = ['A_Module', > 'Another_Module', > ] > > EXCLUDES = ['A_module_you_don't_want', > ] > > OPTIONS = {'argv_emulation': True, > 'packages': PACKAGES, > 'includes': INCLUDES, > 'excludes': EXCLUDES, > } > > > 'packages' includes the entire package -- including all data, etc. > 'includes' only includes module, but it's a bit buggy if the module is > inside a package hierarchy. For instance, if you have: > > import packageA.packageB.moduleA > > and you include 'packageA.PackageB.moduleA' in py2app, module A will get > put in the bundle, but at the top level, so it would have to be imported by: > 'import moduleA' > > you can work around that by either adding all of packageA, or, specifically > including the whole chain: > > INCLUDES = ['packageA', > 'packageA.packageB' > 'packageA.packageB.moduleA' > ] > > > setup( >> app=APP, >> data_files=DATA_FILES, >> options={'py2app': OPTIONS}, >> setup_requires=['py2app'], >> options=dict(py2app=dict(argv_emulation=True), >> ) >> ) >> >> I assume I need to add something along the lines of this, but I can't >> figure out the syntax >> options=dict(includes=['MySQLdb']) >> >> Please help! >> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Pythonmac-SIG maillist - Pythonmac-SIG at python.org >> http://mail.python.org/mailman/listinfo/pythonmac-sig >> > > > -- > Christopher Barker, Ph.D. > Oceanographer > > Emergency Response Division > NOAA/NOS/OR&R (206) 526-6959 voice > 7600 Sand Point Way NE (206) 526-6329 fax > Seattle, WA 98115 (206) 526-6317 main reception > > Chris.Barker at noaa.gov > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Chris.Barker at noaa.gov Tue Apr 28 00:58:41 2009 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Mon, 27 Apr 2009 15:58:41 -0700 Subject: [Pythonmac-SIG] py2app and mysqldb In-Reply-To: <5ed4161b0904271243n680ed265j2fa3da20c11b8af9@mail.gmail.com> References: <5ed4161b0904262313ycf30ca8g441e2e9bdcc9c4b4@mail.gmail.com> <5ed4161b0904262318q4d54714dqf4266cce4defac55@mail.gmail.com> <49F5DFB2.9050700@noaa.gov> <5ed4161b0904271243n680ed265j2fa3da20c11b8af9@mail.gmail.com> Message-ID: <49F638A1.9020502@noaa.gov> Elizabeth Lackey wrote: > My setup.py now looks like... > > from setuptools import setup > > APP = ['mac_test.py'] > DATA_FILES = [] > PACKAGES = ['MySQLdb'] > INCLUDES = ['MySQLdb'] That's odd -- you should only need PACKAGES > OPTIONS = {'argv_emulation': True, > 'packages': PACKAGES, > 'includes': INCLUDES, > } > > setup( > app=APP, > data_files=DATA_FILES, > options={'py2app': OPTIONS}, > setup_requires=['py2app'], > options=dict(py2app=dict(argv_emulation=True), whooa! you've defined "options" twice here -- maybe only the second one is taking... -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov From ronaldoussoren at mac.com Tue Apr 28 09:35:37 2009 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Tue, 28 Apr 2009 09:35:37 +0200 Subject: [Pythonmac-SIG] py2app and mysqldb In-Reply-To: <5ed4161b0904271243n680ed265j2fa3da20c11b8af9@mail.gmail.com> References: <5ed4161b0904262313ycf30ca8g441e2e9bdcc9c4b4@mail.gmail.com> <5ed4161b0904262318q4d54714dqf4266cce4defac55@mail.gmail.com> <49F5DFB2.9050700@noaa.gov> <5ed4161b0904271243n680ed265j2fa3da20c11b8af9@mail.gmail.com> Message-ID: <77077BB7-141A-47E9-BD8F-9C741F2CD1B1@mac.com> On 27 Apr, 2009, at 21:43, Elizabeth Lackey wrote: > > > when I run "python setup.py py2app -A" the executable is created, I > attempt to open it and receive > ImportError: No Module named MySQLdb > when I run "python setup.pu py2app" the executable is created and > opening it receives... > ImportError: '/System/Library/Frameworks/Python.framework/Versions/ > 2.5/lib/python2.5/lib-dynload/_mysql.so' What's the output of 'which python' and 'python -V'? Ronald -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2224 bytes Desc: not available URL: From elizabeth.k.lackey at gmail.com Tue Apr 28 13:49:14 2009 From: elizabeth.k.lackey at gmail.com (Elizabeth Lackey) Date: Tue, 28 Apr 2009 06:49:14 -0500 Subject: [Pythonmac-SIG] py2app and mysqldb In-Reply-To: <77077BB7-141A-47E9-BD8F-9C741F2CD1B1@mac.com> References: <5ed4161b0904262313ycf30ca8g441e2e9bdcc9c4b4@mail.gmail.com> <5ed4161b0904262318q4d54714dqf4266cce4defac55@mail.gmail.com> <49F5DFB2.9050700@noaa.gov> <5ed4161b0904271243n680ed265j2fa3da20c11b8af9@mail.gmail.com> <77077BB7-141A-47E9-BD8F-9C741F2CD1B1@mac.com> Message-ID: <5ed4161b0904280449r5ecd2430idd126a571bdd61a8@mail.gmail.com> What's the output of 'which python' /usr/bin/python > and 'python -V'? Python 2.5.1 > > Ronald > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elizabeth.k.lackey at gmail.com Tue Apr 28 18:50:01 2009 From: elizabeth.k.lackey at gmail.com (Elizabeth Lackey) Date: Tue, 28 Apr 2009 11:50:01 -0500 Subject: [Pythonmac-SIG] py2app and mysqldb In-Reply-To: <49F638A1.9020502@noaa.gov> References: <5ed4161b0904262313ycf30ca8g441e2e9bdcc9c4b4@mail.gmail.com> <5ed4161b0904262318q4d54714dqf4266cce4defac55@mail.gmail.com> <49F5DFB2.9050700@noaa.gov> <5ed4161b0904271243n680ed265j2fa3da20c11b8af9@mail.gmail.com> <49F638A1.9020502@noaa.gov> Message-ID: <5ed4161b0904280950g64e5baf4t2c5eed0dbbd892ca@mail.gmail.com> setup( >> app=APP, >> data_files=DATA_FILES, >> options={'py2app': OPTIONS}, >> setup_requires=['py2app'], >> options=dict(py2app=dict(argv_emulation=True), >> > > whooa! you've defined "options" twice here -- maybe only the second one is > taking... I've added the packages in this options, with the other options left in, and without. I've removed this one completely. None of them are doing any good. -------------- next part -------------- An HTML attachment was scrubbed... URL: From Chris.Barker at noaa.gov Tue Apr 28 19:23:52 2009 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Tue, 28 Apr 2009 10:23:52 -0700 Subject: [Pythonmac-SIG] py2app and mysqldb In-Reply-To: <5ed4161b0904280449r5ecd2430idd126a571bdd61a8@mail.gmail.com> References: <5ed4161b0904262313ycf30ca8g441e2e9bdcc9c4b4@mail.gmail.com> <5ed4161b0904262318q4d54714dqf4266cce4defac55@mail.gmail.com> <49F5DFB2.9050700@noaa.gov> <5ed4161b0904271243n680ed265j2fa3da20c11b8af9@mail.gmail.com> <77077BB7-141A-47E9-BD8F-9C741F2CD1B1@mac.com> <5ed4161b0904280449r5ecd2430idd126a571bdd61a8@mail.gmail.com> Message-ID: <49F73BA8.8020107@noaa.gov> Elizabeth Lackey wrote: > What's the output of 'which python' > > /usr/bin/python > > > and 'python -V'? > > Python 2.5.1 So you are using the python that Apples supplied with 10.5. In this case, py2app does not include python itself (or system installed standard packages?) I wonder if that's messing things up for you. If you want to deploy to non 10.5 systems, you should use the python.org python. It will install into /Library/Frameworks, and py2app will include everything needed to run the app on any 10.3.9 and above system Now for more diagnostics (sorry, I don't have mysqlbd installed, so I can't test easily): You can look into the build app bundle by right clicking on the bundle. Poke around in there, and you can see what's getting included. if you add something to "PACKAGES" the while package should get included as-is. Everything else gets included inside a zip file -- you can unzip it and see what's there. -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 elizabeth.k.lackey at gmail.com Wed Apr 29 16:07:02 2009 From: elizabeth.k.lackey at gmail.com (Elizabeth Lackey) Date: Wed, 29 Apr 2009 09:07:02 -0500 Subject: [Pythonmac-SIG] py2app and mysqldb In-Reply-To: <5ed4161b0904290704j73365856q607a8da3c8288077@mail.gmail.com> References: <5ed4161b0904290704j73365856q607a8da3c8288077@mail.gmail.com> Message-ID: <5ed4161b0904290707tadc1745h532dcaecb2bf0cd6@mail.gmail.com> > > So you are using the python that Apples supplied with 10.5. Actually I believe it came with 2.3 In this case, py2app does not include python itself (or system installed > standard packages?) > > I wonder if that's messing things up for you. > > If you want to deploy to non 10.5 systems, you should use the python.orgpython. It will install into /Library/Frameworks, and py2app will include > everything needed to run the app on any 10.3.9 and above system I was running Python 2.5.1, I'm now at 2.5.4. It is installed in /Library/Frameworks, /usr/bin is a symlink You can look into the build app bundle by right clicking on the bundle. Poke > around in there, and you can see what's getting included. > > if you add something to "PACKAGES" the while package should get included > as-is. Everything else gets included inside a zip file -- you can unzip it > and see what's there. Inside the package contents when I do a full build instead of an alias I see the following... /Users/elizabeth/Code/dist/mac_test.app/Contents/Resources/lib/python2.5/MySQLdb/ /Users/elizabeth/Code/dist/ mac_test.app/Contents/Resources/lib/python2.5/site-packages.zip I unzipped sites.packages.zip and found several .pyc files including _mysql.pyc and folders for the other module I'm importing (wx) Also when I try to build the whole app instead of the alias, using packages, I get "ImportModule error: No module MySQLdb" but when I use includes I receive the error "ImportError: '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-dynload/_mysql.so'" Is the Frameworks folder where my MySQLdb should be installed? because it's not there at all, it's in /Library/Python/2.5/site-packages and there is a _mysql.so in there. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ronaldoussoren at mac.com Wed Apr 29 16:19:37 2009 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Wed, 29 Apr 2009 16:19:37 +0200 Subject: [Pythonmac-SIG] py2app and mysqldb In-Reply-To: <5ed4161b0904290707tadc1745h532dcaecb2bf0cd6@mail.gmail.com> References: <5ed4161b0904290704j73365856q607a8da3c8288077@mail.gmail.com> <5ed4161b0904290707tadc1745h532dcaecb2bf0cd6@mail.gmail.com> Message-ID: <77611214498388143905406513999444747541-Webmail@me.com> On Wednesday, April 29, 2009, at 04:07PM, "Elizabeth Lackey" wrote: >> >> So you are using the python that Apples supplied with 10.5. > >Actually I believe it came with 2.3 10.5 ships with python 2.5 as /usr/bin/python, it also ships with 2.3 in /System/Library/Frameworks (for backward compatibility with earlier systems). > >In this case, py2app does not include python itself (or system installed >> standard packages?) >> >> I wonder if that's messing things up for you. >> >> If you want to deploy to non 10.5 systems, you should use the python.orgpython. It will install into /Library/Frameworks, and py2app will include >> everything needed to run the app on any 10.3.9 and above system > >I was running Python 2.5.1, I'm now at 2.5.4. >It is installed in /Library/Frameworks, /usr/bin is a symlink Don't do that! I haven't checked this for Leopard, but in previous version of the system Apple used /usr/bin/python in system functionality (such as PDF workflows) and therefore replacing /usr/bin/python by some other python could break your system. Ronald From thomas.robitaille at gmail.com Thu Apr 30 16:55:51 2009 From: thomas.robitaille at gmail.com (Thomas Robitaille) Date: Thu, 30 Apr 2009 10:55:51 -0400 Subject: [Pythonmac-SIG] py2app and ipython Message-ID: Hi, I am trying to use py2app to make a simple MacOS X application that launches an ipython shell. At the moment, I have the following python script: --- from IPython.Shell import IPShellEmbed args = ['-pi1','In <\\#>:','-pi2',' .\\D.:','-po','Out<\\#>:','- nosep'] ipshell = IPShellEmbed(args, banner = 'Dropping into IPython', exit_msg = 'Leaving Interpreter, back to program.') ipshell() --- and the following setup.py file: --- from setuptools import setup setup( app=["test.py"], setup_requires=["py2app"], ) --- However, when I try launching the resulting executable, I get a dialog with "ImportError: No module named ipy_profile_none" What am I missing? Not sure if this is important, but when running setup.py py2app, I get the following warning: /usr/bin/strip: the __LINKEDIT segment does not cover the end of the file (can't be processed) in: /Users/tom/Code/python/experimental/ ipython/test/dist/aplpy.app/Contents/Frameworks/libgcc_s.1.dylib (for architecture i386) stripping saved 2585112 bytes (45897079 / 48482191) Thanks in advance for any advice, Thomas From Chris.Barker at noaa.gov Thu Apr 30 19:30:20 2009 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Thu, 30 Apr 2009 10:30:20 -0700 Subject: [Pythonmac-SIG] py2app and ipython In-Reply-To: References: Message-ID: <49F9E02C.4040903@noaa.gov> Thomas Robitaille wrote: > Hi, > > I am trying to use py2app to make a simple MacOS X application that > launches an ipython shell. How do you expect to use this? It appears to need a terminal window -- Py2app is usually for GUI apps, so it will dump output to Console.app, but not give you a terminal. > However, when I try launching the resulting executable, I get a dialog > with "ImportError: No module named ipy_profile_none" where does that usually live? For more diagnostics you can look into the build app bundle by right clicking on the bundle. Poke around in there, and you can see what's getting included. You may need to explicitly include the IPython pacakge, so you'll get eveything. See a recent thread: py2app and mysqldb > What am I missing? > > Not sure if this is important, but when running setup.py py2app, I get > the following warning: > > /usr/bin/strip: the __LINKEDIT segment does not cover the end of the > file (can't be processed) in: > /Users/tom/Code/python/experimental/ipython/test/dist/aplpy.app/Contents/Frameworks/libgcc_s.1.dylib > (for architecture i386) You may need the latest macholib: easy_install macholib==dev -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov From thomas.robitaille at gmail.com Thu Apr 30 22:36:52 2009 From: thomas.robitaille at gmail.com (Thomas Robitaille) Date: Thu, 30 Apr 2009 16:36:52 -0400 Subject: [Pythonmac-SIG] py2app and ipython In-Reply-To: <49F9E02C.4040903@noaa.gov> References: <49F9E02C.4040903@noaa.gov> Message-ID: <8D4D601A-AAAF-4832-9971-9E07A99C8E7A@gmail.com> >> I am trying to use py2app to make a simple MacOS X application that >> launches an ipython shell. > > How do you expect to use this? It appears to need a terminal window > -- Py2app is usually for GUI apps, so it will dump output to > Console.app, but not give you a terminal. That's true - what I would really like is to be able to open a terminal with an ipython prompt from a .app file, and to include a specific module I am developing so that it can be used from that prompt. All this in a bundled file so that any user can download it and use it without installing python. I've poked around a bit and have found this http://svn.pythonmac.org/py2app/py2app/trunk/examples/EggInstaller/EggInstaller.py which looks like what I need for opening the terminal. But the problem is that when the terminal is opened, the script that is run uses the system python, not the one in the .app file, so if there is no system python, this will crash. I guess maybe a solution is that when the terminal is opened I should be setting the $PYTHONPATH to the path inside the .app file? Any ideas? >> However, when I try launching the resulting executable, I get a >> dialog with "ImportError: No module named ipy_profile_none" > > where does that usually live? > > For more diagnostics you can look into the build app bundle by right > clicking on the bundle. Poke around in there, and you can see what's > getting included. I looked into this some more. I actually had a problem even if my python module is a single line, for example import custommodule where custommodule is a module I wrote myself and installed using easy_install or python setup.py install. If I use such a module, the .app gives an ImportError... > You may need to explicitly include the IPython pacakge, so you'll > get eveything. See a recent thread: py2app and mysqldb > >> What am I missing? >> Not sure if this is important, but when running setup.py py2app, I >> get the following warning: >> /usr/bin/strip: the __LINKEDIT segment does not cover the end of >> the file (can't be processed) in: /Users/tom/Code/python/ >> experimental/ipython/test/dist/aplpy.app/Contents/Frameworks/ >> libgcc_s.1.dylib (for architecture i386) > > You may need the latest macholib: > > easy_install macholib==dev Thanks! Thomas > -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 dwf at cs.toronto.edu Thu Apr 30 23:54:32 2009 From: dwf at cs.toronto.edu (David Warde-Farley) Date: Thu, 30 Apr 2009 17:54:32 -0400 Subject: [Pythonmac-SIG] py2app and ipython In-Reply-To: <8D4D601A-AAAF-4832-9971-9E07A99C8E7A@gmail.com> References: <49F9E02C.4040903@noaa.gov> <8D4D601A-AAAF-4832-9971-9E07A99C8E7A@gmail.com> Message-ID: <43875141-6E49-4E8D-9004-B70B488BCB8C@cs.toronto.edu> On 30-Apr-09, at 4:36 PM, Thomas Robitaille wrote: >>> I am trying to use py2app to make a simple MacOS X application >>> that launches an ipython shell. >> >> How do you expect to use this? It appears to need a terminal window >> -- Py2app is usually for GUI apps, so it will dump output to >> Console.app, but not give you a terminal. > > That's true - what I would really like is to be able to open a > terminal with an ipython prompt from a .app file, and to include a > specific module I am developing so that it can be used from that > prompt. All this in a bundled file so that any user can download it > and use it without installing python. I've poked around a bit and > have found this It sounds like you've figured out how to spawn a Terminal like you want to, my first thought would be to use AppleScript. You might also be interested in Nicolas Rougier's Glipy package, which embeds IPython (and some other neat NumPy-related features) in an OpenGL pseudo-terminal. http://www.loria.fr/~rougier/glipy David From elizabeth.k.lackey at gmail.com Mon Apr 27 04:14:47 2009 From: elizabeth.k.lackey at gmail.com (elizapi) Date: Sun, 26 Apr 2009 19:14:47 -0700 (PDT) Subject: [Pythonmac-SIG] App distribution with eggs In-Reply-To: <20783552.post@talk.nabble.com> References: <49246AB8.2040305@noaa.gov> <20783552.post@talk.nabble.com> Message-ID: <23249056.post@talk.nabble.com> Scot Brew wrote: > > Uncompressing the .egg works with py2app and MySQLdb. I had the same > issue and was able to get py2app to correctly build the .app with MySQLdb > after manually unzipping the MySQLdb .egg under site-packages. > What do you mean by "site-packages" I've never had to actually create an application for distribution before, we've always just run the code, so this is all new to me, but I need MySQLdb... I did the uncompression, but I don't know where to put it I guess, because running the first step (python setup.py py2app -A) creates the executable file, but when I try to run I get a lovely popup message that gives an ImportError -- View this message in context: http://www.nabble.com/App-distribution-with-eggs-tp20569084p23249056.html Sent from the Python - pythonmac-sig mailing list archive at Nabble.com. From sbrew at yahoo.com Mon Apr 27 18:34:34 2009 From: sbrew at yahoo.com (Scot Brew) Date: Mon, 27 Apr 2009 09:34:34 -0700 (PDT) Subject: [Pythonmac-SIG] App distribution with eggs In-Reply-To: <23249056.post@talk.nabble.com> References: <49246AB8.2040305@noaa.gov> <20783552.post@talk.nabble.com> <23249056.post@talk.nabble.com> Message-ID: <23260172.post@talk.nabble.com> elizapi wrote: > > > What do you mean by "site-packages" I've never had to actually create an > application for distribution before, we've always just run the code, so > this is all new to me, but I need MySQLdb... > > I did the uncompression, but I don't know where to put it I guess, because > running the first step (python setup.py py2app -A) creates the executable > file, but when I try to run I get a lovely popup message that gives an > ImportError > The "site-packages" directory is the standard one provided by python. One way to find out exactly where a module (in this case MySQLdb) is located, import the module and then print the variable __file__ for that module. Here is an example of the calls, performed on an OSX machine: Mac:~ user$ python Python 2.5 (r25:51918, Sep 19 2006, 08:49:13) >>> import MySQLdb >>> MySQLdb.__file__ '/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/MySQL_python-1.2.2-py2.5-macosx-10.3-fat.egg/MySQLdb/__init__.pyc' In this case, the egg file/directory for MySQLdb is /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/MySQL_python-1.2.2-py2.5-macosx-10.3-fat.egg. -- View this message in context: http://www.nabble.com/App-distribution-with-eggs-tp20569084p23260172.html Sent from the Python - pythonmac-sig mailing list archive at Nabble.com.