From nathaniel.echols at gmail.com Thu Apr 4 00:45:15 2013 From: nathaniel.echols at gmail.com (Nat Echols) Date: Wed, 3 Apr 2013 15:45:15 -0700 Subject: [Pythonmac-SIG] py2app failure with framework build of 2.7 Message-ID: I'm trying to make a simple iconified Python launcher for a shell script, and something I'm doing isn't working, despite having used py2app successfully before. The target Python program ("my_program_wrapper.py") consists of this: import os import sys os.environ["PYTHONPATH"] = "" os.spawnv(os.P_NOWAIT, "/Users/nat/bin/my_program", ["my_program"]) I then run this: /path/to/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python Python.framework/Versions/Current/lib/python2.7/site-packages/py2app-0.7.3-py2.7.egg/py2app/script_py2applet.py --make-setup my_program_wrapper.py which is fine, and gives me this for setup.py: #### from setuptools import setup APP = ['my_program_wrapper.py'] DATA_FILES = [] OPTIONS = {'argv_emulation': False, 'iconfile': '/Users/nat/my_program.icns'} setup( app=APP, data_files=DATA_FILES, options={'py2app': OPTIONS}, setup_requires=['py2app'], ) #### Then I run this: /path/to/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python setup.py py2app and that runs for a few seconds, prints a bunch of output, then crashes here: creating /Users/nat/Desktop/py2app_tmp/py2app_tmp/dist/phenix.app/Contents/Frameworks/Python.framework creating /Users/nat/Desktop/py2app_tmp/py2app_tmp/dist/phenix.app/Contents/Frameworks/Python.framework/Versions creating /Users/nat/Desktop/py2app_tmp/py2app_tmp/dist/phenix.app/Contents/Frameworks/Python.framework/Versions/Current creating /Users/nat/Desktop/py2app_tmp/py2app_tmp/dist/phenix.app/Contents/Frameworks/Python.framework/Versions/Current/Resources error: File exists It works fine if I use /usr/bin/python instead, but that isn't an option because this needs to be able to run on OS 10.4, which has Python 2.3 (which chokes on an import in py2app). Am I doing something wrong, or is this a bug? thanks, Nat From nathaniel.echols at gmail.com Thu Apr 4 01:12:41 2013 From: nathaniel.echols at gmail.com (Nat Echols) Date: Wed, 3 Apr 2013 16:12:41 -0700 Subject: [Pythonmac-SIG] py2app failure with framework build of 2.7 In-Reply-To: References: Message-ID: Replying to my own post: after sending this, I read the section in the documentation about "alias mode". This seems to work fine, and produces an app that is 50KB instead of nearly 9MB. Since I'm running this script as part of a complicated build and installation process, and the path to the interpreter and all modules is frozen by the time I need to make my app, it would seem that alias mode should work fine for actually *deploying* my software. Is there any drawback to doing this? thanks, Nat On Wed, Apr 3, 2013 at 3:45 PM, Nat Echols wrote: > I'm trying to make a simple iconified Python launcher for a shell > script, and something I'm doing isn't working, despite having used > py2app successfully before. The target Python program > ("my_program_wrapper.py") consists of this: > > import os > import sys > os.environ["PYTHONPATH"] = "" > os.spawnv(os.P_NOWAIT, "/Users/nat/bin/my_program", ["my_program"]) > > I then run this: > > /path/to/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python > Python.framework/Versions/Current/lib/python2.7/site-packages/py2app-0.7.3-py2.7.egg/py2app/script_py2applet.py > --make-setup my_program_wrapper.py > > which is fine, and gives me this for setup.py: > > #### > from setuptools import setup > > APP = ['my_program_wrapper.py'] > DATA_FILES = [] > OPTIONS = {'argv_emulation': False, > 'iconfile': '/Users/nat/my_program.icns'} > > setup( > app=APP, > data_files=DATA_FILES, > options={'py2app': OPTIONS}, > setup_requires=['py2app'], > ) > #### > > Then I run this: > > /path/to/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python > setup.py py2app > > and that runs for a few seconds, prints a bunch of output, then crashes here: > > creating /Users/nat/Desktop/py2app_tmp/py2app_tmp/dist/phenix.app/Contents/Frameworks/Python.framework > creating /Users/nat/Desktop/py2app_tmp/py2app_tmp/dist/phenix.app/Contents/Frameworks/Python.framework/Versions > creating /Users/nat/Desktop/py2app_tmp/py2app_tmp/dist/phenix.app/Contents/Frameworks/Python.framework/Versions/Current > creating /Users/nat/Desktop/py2app_tmp/py2app_tmp/dist/phenix.app/Contents/Frameworks/Python.framework/Versions/Current/Resources > error: File exists > > It works fine if I use /usr/bin/python instead, but that isn't an > option because this needs to be able to run on OS 10.4, which has > Python 2.3 (which chokes on an import in py2app). Am I doing > something wrong, or is this a bug? > > thanks, > Nat From ronaldoussoren at mac.com Thu Apr 4 14:46:57 2013 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Thu, 4 Apr 2013 14:46:57 +0200 Subject: [Pythonmac-SIG] py2app failure with framework build of 2.7 In-Reply-To: References: Message-ID: <64BA8F6D-25C4-4BF8-82C7-3C37CD63B414@mac.com> On 4 Apr, 2013, at 1:12, Nat Echols wrote: > Replying to my own post: after sending this, I read the section in the > documentation about "alias mode". This seems to work fine, and > produces an app that is 50KB instead of nearly 9MB. Since I'm running > this script as part of a complicated build and installation process, > and the path to the interpreter and all modules is frozen by the time > I need to make my app, it would seem that alias mode should work fine > for actually *deploying* my software. Is there any drawback to doing > this? An alias mode build contains symlinks to the python files in your application, and is therefore not a useful way to deploy. I don't know yet why building the application fails, I'll try to reproduce the issue in the weekend. Ronald > > thanks, > Nat > > On Wed, Apr 3, 2013 at 3:45 PM, Nat Echols wrote: >> I'm trying to make a simple iconified Python launcher for a shell >> script, and something I'm doing isn't working, despite having used >> py2app successfully before. The target Python program >> ("my_program_wrapper.py") consists of this: >> >> import os >> import sys >> os.environ["PYTHONPATH"] = "" >> os.spawnv(os.P_NOWAIT, "/Users/nat/bin/my_program", ["my_program"]) >> >> I then run this: >> >> /path/to/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python >> Python.framework/Versions/Current/lib/python2.7/site-packages/py2app-0.7.3-py2.7.egg/py2app/script_py2applet.py >> --make-setup my_program_wrapper.py >> >> which is fine, and gives me this for setup.py: >> >> #### >> from setuptools import setup >> >> APP = ['my_program_wrapper.py'] >> DATA_FILES = [] >> OPTIONS = {'argv_emulation': False, >> 'iconfile': '/Users/nat/my_program.icns'} >> >> setup( >> app=APP, >> data_files=DATA_FILES, >> options={'py2app': OPTIONS}, >> setup_requires=['py2app'], >> ) >> #### >> >> Then I run this: >> >> /path/to/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python >> setup.py py2app >> >> and that runs for a few seconds, prints a bunch of output, then crashes here: >> >> creating /Users/nat/Desktop/py2app_tmp/py2app_tmp/dist/phenix.app/Contents/Frameworks/Python.framework >> creating /Users/nat/Desktop/py2app_tmp/py2app_tmp/dist/phenix.app/Contents/Frameworks/Python.framework/Versions >> creating /Users/nat/Desktop/py2app_tmp/py2app_tmp/dist/phenix.app/Contents/Frameworks/Python.framework/Versions/Current >> creating /Users/nat/Desktop/py2app_tmp/py2app_tmp/dist/phenix.app/Contents/Frameworks/Python.framework/Versions/Current/Resources >> error: File exists >> >> It works fine if I use /usr/bin/python instead, but that isn't an >> option because this needs to be able to run on OS 10.4, which has >> Python 2.3 (which chokes on an import in py2app). Am I doing >> something wrong, or is this a bug? >> >> thanks, >> Nat > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG From paulcoones at comcast.net Thu Apr 4 16:17:08 2013 From: paulcoones at comcast.net (Paul Coones) Date: Thu, 4 Apr 2013 07:17:08 -0700 Subject: [Pythonmac-SIG] Accessing .so files in BGE python scripts Message-ID: I am a Leap Developer trying to develop in Blender so I can move objects around with hand/finger motions in the game engine. This is sample of part of the LeapPython.so (.dynlib) I need to access in Blender 2.66a Game Engine on my MacMini SnowLeopard 32 bit: Possible C/C++ prototypes are: Leap::Tool::Tool() Leap::Tool::Tool(Leap::Pointable const &) O:new_Tool in method 'new_Tool', argument 1 of type 'Leap::Pointable const &' invalid null reference in method 'new_Tool', argument 1 of type 'Leap::Pointable const &' :new_Tool O:delete_Finger in method 'delete_Finger', argument 1 of type 'Leap::Finger *' O:Finger___str__ in method 'Finger___str__', argument 1 of type 'Leap::Finger const *' Wrong number or type of arguments for overloaded function 'new_Finger'. This is the type of errors I am getting when there is a call like: __swig_destroy__ = LeapPython.delete_FloatArray Python script error - object 'TheMostImportantEmpty', controller 'Process': Traceback (most recent call last): File "Process.py", line 1, in import Leap, GameLogic File "/Users/paulcoones/Desktop/AUTODESK(1).blend/Leap.py", line 247, in File "/Users/paulcoones/Desktop/AUTODESK(1).blend/Leap.py", line 289, in FloatArray AttributeError: 'module' object has no attribute 'delete_FloatArray' After looking at this type of error, what is the correct location to put the LeapPython.so ( dynamic library ) so a Blender script can find it and access the data on it? Or perhaps my .so file is of the wrong format? Paul From nathaniel.echols at gmail.com Thu Apr 4 17:01:37 2013 From: nathaniel.echols at gmail.com (Nat Echols) Date: Thu, 4 Apr 2013 08:01:37 -0700 Subject: [Pythonmac-SIG] py2app failure with framework build of 2.7 In-Reply-To: <64BA8F6D-25C4-4BF8-82C7-3C37CD63B414@mac.com> References: <64BA8F6D-25C4-4BF8-82C7-3C37CD63B414@mac.com> Message-ID: On Thu, Apr 4, 2013 at 5:46 AM, Ronald Oussoren wrote: >> Replying to my own post: after sending this, I read the section in the >> documentation about "alias mode". This seems to work fine, and >> produces an app that is 50KB instead of nearly 9MB. Since I'm running >> this script as part of a complicated build and installation process, >> and the path to the interpreter and all modules is frozen by the time >> I need to make my app, it would seem that alias mode should work fine >> for actually *deploying* my software. Is there any drawback to doing >> this? > > An alias mode build contains symlinks to the python files in your application, and is therefore not a useful way to deploy. It's still not totally clear to me if this is really a drawback in my case. The software distribution in question is a huge (~2GB) mess originally written for Unix systems, and the installation process is somewhat... inelegant. Users have a choice of a) running a shell script which installs to a destination of their choice, and runs the py2app script at the end (after the new location is made permanent), or b) running a .pkg which installs in /Applications, which includes the pre-built .app file. In the first case, I'm pretty certain the symlinks won't be a problem. I'm not sure about the second - will packagemaker screw these up? The original paths will be accurate but I have to move stuff around as part of the packaging process, and I have no idea what happens internally. thanks, Nat From chris.barker at noaa.gov Thu Apr 4 17:20:11 2013 From: chris.barker at noaa.gov (Chris Barker - NOAA Federal) Date: Thu, 4 Apr 2013 08:20:11 -0700 Subject: [Pythonmac-SIG] py2app failure with framework build of 2.7 In-Reply-To: References: <64BA8F6D-25C4-4BF8-82C7-3C37CD63B414@mac.com> Message-ID: On Thu, Apr 4, 2013 at 8:01 AM, Nat Echols wrote: > On Thu, Apr 4, 2013 at 5:46 AM, Ronald Oussoren wrote: >> An alias mode build contains symlinks to the python files in your application, and is therefore not a useful way to deploy. > > It's still not totally clear to me if this is really a drawback in my > case. The software distribution in question is a huge (~2GB) mess > originally written for Unix systems, and the installation process is > somewhat... inelegant. Users have a choice of a) running a shell > script which installs to a destination of their choice, and runs the > py2app script at the end (after the new location is made permanent), This should work well, and actually, issues with doing a "proper" py2app bundle aside, may be the best way to do it. The point of Py2app is to bundle up everything required into the app bundle, so that is it one movable directory, hides teh pyton stuff from the user, and does not rely on a particular pyton installation (i.e extra packages, etc). But it sounds like in your case, you've got to install the whole pyton environment anyway, along with all sorts of other stuff. So all you need the app bundle for is to make a nice clickable icon. That's exactly what I use alias mode for as well, though I've never tried to give it to anyone else that way. Actually, I have -- I have set up a setup.py script that works with py2app in alias mode (but not it regular mode), then advised users to get the code installed, install all the dependencies, then run py2app -A and build the alias really what you are doing, except you are automating the rest of the install. > or b) running a .pkg which installs in /Applications, which includes > the pre-built .app file. In the first case, I'm pretty certain the > symlinks won't be a problem. I'm not sure about the second - will > packagemaker screw these up? The original paths will be accurate but > I have to move stuff around as part of the packaging process, and I > have no idea what happens internally. if it all gets put in the same places by the installation process, I think it will work. But you never know until you try. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov From chris.barker at noaa.gov Thu Apr 4 18:08:29 2013 From: chris.barker at noaa.gov (Chris Barker - NOAA Federal) Date: Thu, 4 Apr 2013 09:08:29 -0700 Subject: [Pythonmac-SIG] Accessing .so files in BGE python scripts In-Reply-To: References: Message-ID: Hi, Not sure what "leap" is, but maybe this will be helpful... > This is sample of part of the LeapPython.so (.dynlib) I need to access in Blender 2.66a Game Engine on my MacMini SnowLeopard 32 bit: ... > This is the type of errors I am getting when there is a call like: > > __swig_destroy__ = LeapPython.delete_FloatArray > so this is SWIG-wrapped code -- are you doing the swig-ing, or are you just suing something provided? > AttributeError: 'module' object has no attribute 'delete_FloatArray' > > After looking at this type of error, what is the correct location to put the LeapPython.so ( dynamic library ) so a Blender script can find it and access the data on it? Or perhaps my .so file is of the wrong format? What is LeapPython.so ? is that the python extension file (i.e do you do "import LeapPython) -- in which case, it needs to be on sys.path somewhere -- not entirely sure where that would be with Blender, but the same place as where you put *.py files. However, if LeapPython.so is not an extension, but rather a library called by the extension, then it needs to be linked in when the extension is built. Check out the setup.py to see what's happening there. -HTH, -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov From ronaldoussoren at mac.com Fri Apr 5 08:28:07 2013 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Fri, 5 Apr 2013 08:28:07 +0200 Subject: [Pythonmac-SIG] py2app failure with framework build of 2.7 In-Reply-To: References: <64BA8F6D-25C4-4BF8-82C7-3C37CD63B414@mac.com> Message-ID: <1B573B3C-87C9-4427-B016-69789C10BCB2@mac.com> On 4 Apr, 2013, at 17:01, Nat Echols wrote: > On Thu, Apr 4, 2013 at 5:46 AM, Ronald Oussoren wrote: >>> Replying to my own post: after sending this, I read the section in the >>> documentation about "alias mode". This seems to work fine, and >>> produces an app that is 50KB instead of nearly 9MB. Since I'm running >>> this script as part of a complicated build and installation process, >>> and the path to the interpreter and all modules is frozen by the time >>> I need to make my app, it would seem that alias mode should work fine >>> for actually *deploying* my software. Is there any drawback to doing >>> this? >> >> An alias mode build contains symlinks to the python files in your application, and is therefore not a useful way to deploy. > > It's still not totally clear to me if this is really a drawback in my > case. The software distribution in question is a huge (~2GB) mess > originally written for Unix systems, and the installation process is > somewhat... inelegant. Users have a choice of a) running a shell > script which installs to a destination of their choice, and runs the > py2app script at the end (after the new location is made permanent), > or b) running a .pkg which installs in /Applications, which includes > the pre-built .app file. In the first case, I'm pretty certain the > symlinks won't be a problem. I'm not sure about the second - will > packagemaker screw these up? The original paths will be accurate but > I have to move stuff around as part of the packaging process, and I > have no idea what happens internally. Packagemaker should't be problem here, although the build procedure might be problematic: IIRC the app bundle contains symlinks where the target is an absolute path, and therefore you need to create the app from sources that are already in the final location (e.g. somewhere below /Applications). It might be better to create a --semi-standalone, --use-sitepackages build, and --exclude most of the code. Assuming you also install a shared library build (either --enable-shared or --enable-framework) of Python in /Applications that should be fairly easy to get to work (you have to update the application's Info.plist to force it to look for Python in the right location, but that's the hardest part). The primary reason I dislike using an alias build for deployment is that alias builds are meant to be a way to speed up development and I might accidently break the deployment usecase when I find ways to make alias builds better for the "application development" use case. Ronald > > thanks, > Nat From nathaniel.echols at gmail.com Fri Apr 5 20:44:50 2013 From: nathaniel.echols at gmail.com (Nat Echols) Date: Fri, 5 Apr 2013 11:44:50 -0700 Subject: [Pythonmac-SIG] py2app failure with framework build of 2.7 In-Reply-To: <1B573B3C-87C9-4427-B016-69789C10BCB2@mac.com> References: <64BA8F6D-25C4-4BF8-82C7-3C37CD63B414@mac.com> <1B573B3C-87C9-4427-B016-69789C10BCB2@mac.com> Message-ID: On Thu, Apr 4, 2013 at 11:28 PM, Ronald Oussoren wrote: > Packagemaker should't be problem here, although the build procedure might > be problematic: IIRC the app bundle contains symlinks where the target > is an absolute path, and therefore you need to create the app from > sources that are already in the final location (e.g. somewhere below /Applications). In fact this does appear to be problematic in our build system - the resulting .app contains references to the directory where I built the package. It appears, however, that the self-contained app builds okay in this context; the only place where the apparent bug shows up is on my laptop, where everything was installed more-or-less manually. I'm a little spooked by this, since it makes me suspect that my script isn't as general-purpose as would be ideal, but at least this should allow me to build working installers for distribution. -Nat From velman at cox.net Sun Apr 7 01:22:07 2013 From: velman at cox.net (John Velman) Date: Sat, 6 Apr 2013 16:22:07 -0700 Subject: [Pythonmac-SIG] Good way for beginner to get started with Python? Message-ID: <20130406232207.GA500@cox.net> Reply-To: I'm looking for a way to get a bright (of course) high school student started with Python. He has a recent iMac. He is pretty computer literate, and knows the names of some computer languages, but no experience in programming, and little experience with text editing per se. He is particularly interested in games. Is at a stage of trying to decide what he is going to do in college, and was asking me about getting started with computer programming. I recommend Python as a good starting language. It would be nice if there was a simple IDE that works with python without a lot of setting up options, moving things around in the file system, and so on. I don't want to throw him into Vim or Emacs. I'd like him to get to something interesting (GUI, very simple games) soon. I showed him some examples from Pythonista on my iPad, and he was impressed at what could be done in ~ 100 lines of Python. For now, it would be really nice if he could work with the Python already on his iMac, and minimal other setup. Maybe the TKInter that comes with the iMac would also be a place to start GUI. It looks like installing TextWrangler might be a good choice for an editor. Or just plain TextEdit? I've looked at PyGames, and done a little other googling, and every place I've looked says install this, install that, use Home Brew, use Ports, don't use Ports, be sure and set such and such an option, be sure and get a version greater than x.y...Things that I might do, but I've been at this, at least part time, more or less forever. We need something than one can just do, and then learn while doing. Well, something Mac like. (I myself haven't used Python much for a while, am trying to develop one good app in Objective C on an hour or so a day. I use the Xcode IDE, Vim outside of Xcode. Am personally a dynasaur, am mailing this via Mutt.) Any suggestions will be greatly appreciated. John V. From cweisiger at msg.ucsf.edu Sun Apr 7 02:13:52 2013 From: cweisiger at msg.ucsf.edu (Chris Weisiger) Date: Sat, 6 Apr 2013 17:13:52 -0700 Subject: [Pythonmac-SIG] Good way for beginner to get started with Python? In-Reply-To: <20130406232207.GA500@cox.net> References: <20130406232207.GA500@cox.net> Message-ID: My recommendation would be to go with PyGame, but as you note this does require some installation work. Unfortunately as soon as you start getting into being a software developer, the kid gloves come off and you have to learn a lot about how software works. I'm not aware of any one-stop user-friendly installer that will get you up and running in Python with an eye towards games. My best advice is to do the installation for him. -Chris On Sat, Apr 6, 2013 at 4:22 PM, John Velman wrote: > Reply-To: > > I'm looking for a way to get a bright (of course) high school student > started with Python. He has a recent iMac. He is pretty computer literate, > and knows the names of some computer languages, but no experience in > programming, and little experience with text editing per se. He is > particularly interested in games. Is at a stage of trying to decide what he > is going to do in college, and was asking me about getting started with > computer programming. > > I recommend Python as a good starting language. It would be nice if there > was a simple IDE that works with python without a lot of setting up > options, moving things around in the file system, and so on. I don't want > to throw him into Vim or Emacs. > > I'd like him to get to something interesting (GUI, very simple games) soon. > I showed him some examples from Pythonista on my iPad, and he was impressed > at what could be done in ~ 100 lines of Python. > > For now, it would be really nice if he could work with the Python already > on his iMac, and minimal other setup. Maybe the TKInter that comes with the > iMac would also be a place to start GUI. It looks like installing > TextWrangler might be a good choice for an editor. Or just plain TextEdit? > > I've looked at PyGames, and done a little other googling, and every place > I've looked says install this, install that, use Home Brew, use Ports, > don't use Ports, be sure and set such and such an option, be sure and get a > version greater than x.y...Things that I might do, but I've been at this, > at least part time, more or less forever. > > We need something than one can just do, and then learn while doing. Well, > something Mac like. > > (I myself haven't used Python much for a while, am trying to develop one > good app in Objective C on an hour or so a day. I use the Xcode IDE, Vim > outside of Xcode. Am personally a dynasaur, am mailing this via Mutt.) > > Any suggestions will be greatly appreciated. > > John V. > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ambrogi4 at gmail.com Sun Apr 7 13:34:05 2013 From: ambrogi4 at gmail.com (Matt Ambrogi) Date: Sun, 7 Apr 2013 06:34:05 -0500 Subject: [Pythonmac-SIG] Good way for beginner to get started with Python? In-Reply-To: References: <20130406232207.GA500@cox.net> Message-ID: John, I agree with Chris, some setup/installation is required basically everywhere. To get down to zero of that, you might have to look at some other online tools, as you might have seen when you were googling. Two that could be worth a look are: http://www.learnpython.org/ and http://www.codecademy.com/tracks/python as they seem to check at least one of your boxes (get learning fast). Offline, on my mac, the closest I get to your space (lightest weight, least setup/config, least ide learning required yet with some support) is a download of the free TextWrangler ide. One can have it up and running quickly and be off and coding python. It does nothing to help build games. regards, -Matt On Sat, Apr 6, 2013 at 7:13 PM, Chris Weisiger wrote: > My recommendation would be to go with PyGame, but as you note this does > require some installation work. Unfortunately as soon as you start getting > into being a software developer, the kid gloves come off and you have to > learn a lot about how software works. I'm not aware of any one-stop > user-friendly installer that will get you up and running in Python with an > eye towards games. My best advice is to do the installation for him. > > -Chris > > > On Sat, Apr 6, 2013 at 4:22 PM, John Velman wrote: > >> Reply-To: >> >> I'm looking for a way to get a bright (of course) high school student >> started with Python. He has a recent iMac. He is pretty computer >> literate, >> and knows the names of some computer languages, but no experience in >> programming, and little experience with text editing per se. He is >> particularly interested in games. Is at a stage of trying to decide what >> he >> is going to do in college, and was asking me about getting started with >> computer programming. >> >> I recommend Python as a good starting language. It would be nice if there >> was a simple IDE that works with python without a lot of setting up >> options, moving things around in the file system, and so on. I don't want >> to throw him into Vim or Emacs. >> >> I'd like him to get to something interesting (GUI, very simple games) >> soon. >> I showed him some examples from Pythonista on my iPad, and he was >> impressed >> at what could be done in ~ 100 lines of Python. >> >> For now, it would be really nice if he could work with the Python already >> on his iMac, and minimal other setup. Maybe the TKInter that comes with >> the >> iMac would also be a place to start GUI. It looks like installing >> TextWrangler might be a good choice for an editor. Or just plain >> TextEdit? >> >> I've looked at PyGames, and done a little other googling, and every place >> I've looked says install this, install that, use Home Brew, use Ports, >> don't use Ports, be sure and set such and such an option, be sure and get >> a >> version greater than x.y...Things that I might do, but I've been at this, >> at least part time, more or less forever. >> >> We need something than one can just do, and then learn while doing. Well, >> something Mac like. >> >> (I myself haven't used Python much for a while, am trying to develop one >> good app in Objective C on an hour or so a day. I use the Xcode IDE, Vim >> outside of Xcode. Am personally a dynasaur, am mailing this via Mutt.) >> >> Any suggestions will be greatly appreciated. >> >> John V. >> _______________________________________________ >> Pythonmac-SIG maillist - Pythonmac-SIG at python.org >> http://mail.python.org/mailman/listinfo/pythonmac-sig >> unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG >> > > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From velman at cox.net Sun Apr 7 17:50:57 2013 From: velman at cox.net (John Velman) Date: Sun, 7 Apr 2013 08:50:57 -0700 Subject: [Pythonmac-SIG] Good way for beginner to get started with Python? In-Reply-To: References: <20130406232207.GA500@cox.net> Message-ID: <20130407155057.GC500@cox.net> Thanks, Barry. This looks like just the right thing. The only problem may be the timing,since it starts about a month too soon relative the ending of the school year. But have sent the info for him to look into. John V. On Sat, Apr 06, 2013 at 07:54:29PM -0500, Barry McClendon wrote: > John, > > See if he might be interested in this course: > https://www.coursera.org/course/interactivepython > > Barry > > On Apr 6, 2013, at 6:22 PM, John Velman wrote: > > > Reply-To: > > > > I'm looking for a way to get a bright (of course) high school student > > started with Python. He has a recent iMac. He is pretty computer literate, > > and knows the names of some computer languages, but no experience in > > programming, and little experience with text editing per se. He is > > particularly interested in games. Is at a stage of trying to decide what he > > is going to do in college, and was asking me about getting started with > > computer programming. > > > > I recommend Python as a good starting language. It would be nice if there > > was a simple IDE that works with python without a lot of setting up > > options, moving things around in the file system, and so on. I don't want > > to throw him into Vim or Emacs. > > > > I'd like him to get to something interesting (GUI, very simple games) soon. > > I showed him some examples from Pythonista on my iPad, and he was impressed > > at what could be done in ~ 100 lines of Python. > > > > For now, it would be really nice if he could work with the Python already > > on his iMac, and minimal other setup. Maybe the TKInter that comes with the > > iMac would also be a place to start GUI. It looks like installing > > TextWrangler might be a good choice for an editor. Or just plain TextEdit? > > > > I've looked at PyGames, and done a little other googling, and every place > > I've looked says install this, install that, use Home Brew, use Ports, > > don't use Ports, be sure and set such and such an option, be sure and get a > > version greater than x.y...Things that I might do, but I've been at this, > > at least part time, more or less forever. > > > > We need something than one can just do, and then learn while doing. Well, > > something Mac like. > > > > (I myself haven't used Python much for a while, am trying to develop one > > good app in Objective C on an hour or so a day. I use the Xcode IDE, Vim > > outside of Xcode. Am personally a dynasaur, am mailing this via Mutt.) > > > > Any suggestions will be greatly appreciated. > > > > John V. > > _______________________________________________ > > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > > http://mail.python.org/mailman/listinfo/pythonmac-sig > > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG From terry.simons at gmail.com Sun Apr 7 17:58:58 2013 From: terry.simons at gmail.com (Terry Simons) Date: Sun, 7 Apr 2013 08:58:58 -0700 Subject: [Pythonmac-SIG] Good way for beginner to get started with Python? In-Reply-To: <20130406232207.GA500@cox.net> References: <20130406232207.GA500@cox.net> Message-ID: John, I highly recommend checking the following out (It's how I got into Python, and it kept me hooked): http://inventwithpython.com The Invent Your Own Computer Games with Python book is free web-based or pdf (or you can buy a print copy) and it starts out with terminal-based games that do not require Pygame, and will get you some Python Fundamentals. Later in the book, it does introduce Pygame as well, and gets you started. His second book, Making Games with Python & Pygame also has a free online/pdf version. These books, IMO, are much better for a beginner learner than Dive into Python, which while still a great book, I feel it's a better reference than a beginner's learning tool. I've done a lot with PyGame on OS X. If you're concerned about MacPorts cluttering up your system - don't be. The ports system puts everything in /opt (which is a directory that doens't exist by default) and so you can easily remove all of the bits if you decide you want to be rid of ports. The issue is that a lot of the support libraries simply don't compile cleanly in OS X. If you're absolutely averse to doing this, then I'd suggest trying the Pygame 1.9.1 precompiled binaries on pygame.org... it looks like they have it already compiled (but I haven't tried it): pygame-1.9.1release-python.org-32bit-py2.7-macosx10.3.dmg You might still need to manually install the SDL libraries and such, but that might be somewhat less painful. If you want to try going this route and run into any snags, I'd be happy to help. When I first started trying to get Pygame working on OS X it was huge pain, but I've since done it many times without too much trouble. And since you're interested in games, check out Spine. It's a 2D skeletal animation package for making game animations. I ported the Spine runtime to Python. Here's the Spine website (I'm in no way affiliated with the company): http://esotericsoftware.com Here's the Python runtime I created: https://github.com/terrysimons/spine-python It's still a work in progress, but it mostly works. There are some animation glitches that I need to sort out. - Terry On Sat, Apr 6, 2013 at 4:22 PM, John Velman wrote: > Reply-To: > > I'm looking for a way to get a bright (of course) high school student > started with Python. He has a recent iMac. He is pretty computer literate, > and knows the names of some computer languages, but no experience in > programming, and little experience with text editing per se. He is > particularly interested in games. Is at a stage of trying to decide what he > is going to do in college, and was asking me about getting started with > computer programming. > > I recommend Python as a good starting language. It would be nice if there > was a simple IDE that works with python without a lot of setting up > options, moving things around in the file system, and so on. I don't want > to throw him into Vim or Emacs. > > I'd like him to get to something interesting (GUI, very simple games) soon. > I showed him some examples from Pythonista on my iPad, and he was impressed > at what could be done in ~ 100 lines of Python. > > For now, it would be really nice if he could work with the Python already > on his iMac, and minimal other setup. Maybe the TKInter that comes with the > iMac would also be a place to start GUI. It looks like installing > TextWrangler might be a good choice for an editor. Or just plain TextEdit? > > I've looked at PyGames, and done a little other googling, and every place > I've looked says install this, install that, use Home Brew, use Ports, > don't use Ports, be sure and set such and such an option, be sure and get a > version greater than x.y...Things that I might do, but I've been at this, > at least part time, more or less forever. > > We need something than one can just do, and then learn while doing. Well, > something Mac like. > > (I myself haven't used Python much for a while, am trying to develop one > good app in Objective C on an hour or so a day. I use the Xcode IDE, Vim > outside of Xcode. Am personally a dynasaur, am mailing this via Mutt.) > > Any suggestions will be greatly appreciated. > > John V. > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG > -------------- next part -------------- An HTML attachment was scrubbed... URL: From henry.olders at mcgill.ca Sun Apr 7 18:11:04 2013 From: henry.olders at mcgill.ca (Henry Olders) Date: Sun, 07 Apr 2013 12:11:04 -0400 Subject: [Pythonmac-SIG] Good way for beginner to get started with Python? In-Reply-To: <20130406232207.GA500@cox.net> References: <20130406232207.GA500@cox.net> Message-ID: Have a look at this free online course offering from Coursera: https://www.coursera.org/course/interactivepython Learn to program python games entirely through your browser! Henry On 2013-04-06, at 19:22 , John Velman wrote: > Reply-To: > > I'm looking for a way to get a bright (of course) high school student > started with Python. He has a recent iMac. He is pretty computer literate, > and knows the names of some computer languages, but no experience in > programming, and little experience with text editing per se. He is > particularly interested in games. Is at a stage of trying to decide what he > is going to do in college, and was asking me about getting started with > computer programming. > > I recommend Python as a good starting language. It would be nice if there > was a simple IDE that works with python without a lot of setting up > options, moving things around in the file system, and so on. I don't want > to throw him into Vim or Emacs. > > I'd like him to get to something interesting (GUI, very simple games) soon. > I showed him some examples from Pythonista on my iPad, and he was impressed > at what could be done in ~ 100 lines of Python. > > For now, it would be really nice if he could work with the Python already > on his iMac, and minimal other setup. Maybe the TKInter that comes with the > iMac would also be a place to start GUI. It looks like installing > TextWrangler might be a good choice for an editor. Or just plain TextEdit? > > I've looked at PyGames, and done a little other googling, and every place > I've looked says install this, install that, use Home Brew, use Ports, > don't use Ports, be sure and set such and such an option, be sure and get a > version greater than x.y...Things that I might do, but I've been at this, > at least part time, more or less forever. > > We need something than one can just do, and then learn while doing. Well, > something Mac like. > > (I myself haven't used Python much for a while, am trying to develop one > good app in Objective C on an hour or so a day. I use the Xcode IDE, Vim > outside of Xcode. Am personally a dynasaur, am mailing this via Mutt.) > > Any suggestions will be greatly appreciated. > > John V. > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG From velman at cox.net Sun Apr 7 17:43:03 2013 From: velman at cox.net (John Velman) Date: Sun, 7 Apr 2013 08:43:03 -0700 Subject: [Pythonmac-SIG] Good way for beginner to get started with Python? In-Reply-To: References: <20130406232207.GA500@cox.net> Message-ID: <20130407154302.GB500@cox.net> Thanks to both Chris and Matt. I've been thinking somewhat along the lines Chris suggested, and will probably do that, or some kind of step by step. Even thinking of looking into PyGames myself (in line behind a bunch of other things -- it might come in front of learning OCaml). And thanks to Matt for the learnpython and codecademy links. Barry's reference to the Coursea course looks particularly good, but the timing may be bad, since it starts at the last month of the school year. Thanks again, John V. On Sun, Apr 07, 2013 at 06:34:05AM -0500, Matt Ambrogi wrote: > John, > I agree with Chris, some setup/installation is required basically > everywhere. To get down to zero of that, you might have to look at some > other online tools, as you might have seen when you were googling. Two > that could be worth a look are: http://www.learnpython.org/ and > http://www.codecademy.com/tracks/python as they seem to check at least > one of your boxes (get learning fast). > > Offline, on my mac, the closest I get to your space (lightest weight, least > setup/config, least ide learning required yet with some support) is a > download of the free TextWrangler ide. One can have it up and running > quickly and be off and coding python. It does nothing to help build games. > > regards, -Matt > > > > > On Sat, Apr 6, 2013 at 7:13 PM, Chris Weisiger wrote: > > > My recommendation would be to go with PyGame, but as you note this does > > require some installation work. Unfortunately as soon as you start getting > > into being a software developer, the kid gloves come off and you have to > > learn a lot about how software works. I'm not aware of any one-stop > > user-friendly installer that will get you up and running in Python with an > > eye towards games. My best advice is to do the installation for him. > > > > -Chris > > > > > > On Sat, Apr 6, 2013 at 4:22 PM, John Velman wrote: > > > >> Reply-To: > >> > >> I'm looking for a way to get a bright (of course) high school student > >> started with Python. He has a recent iMac. He is pretty computer > >> literate, > >> and knows the names of some computer languages, but no experience in > >> programming, and little experience with text editing per se. He is > >> particularly interested in games. Is at a stage of trying to decide what > >> he > >> is going to do in college, and was asking me about getting started with > >> computer programming. > >> > >> I recommend Python as a good starting language. It would be nice if there > >> was a simple IDE that works with python without a lot of setting up > >> options, moving things around in the file system, and so on. I don't want > >> to throw him into Vim or Emacs. > >> > >> I'd like him to get to something interesting (GUI, very simple games) > >> soon. > >> I showed him some examples from Pythonista on my iPad, and he was > >> impressed > >> at what could be done in ~ 100 lines of Python. > >> > >> For now, it would be really nice if he could work with the Python already > >> on his iMac, and minimal other setup. Maybe the TKInter that comes with > >> the > >> iMac would also be a place to start GUI. It looks like installing > >> TextWrangler might be a good choice for an editor. Or just plain > >> TextEdit? > >> > >> I've looked at PyGames, and done a little other googling, and every place > >> I've looked says install this, install that, use Home Brew, use Ports, > >> don't use Ports, be sure and set such and such an option, be sure and get > >> a > >> version greater than x.y...Things that I might do, but I've been at this, > >> at least part time, more or less forever. > >> > >> We need something than one can just do, and then learn while doing. Well, > >> something Mac like. > >> > >> (I myself haven't used Python much for a while, am trying to develop one > >> good app in Objective C on an hour or so a day. I use the Xcode IDE, Vim > >> outside of Xcode. Am personally a dynasaur, am mailing this via Mutt.) > >> > >> Any suggestions will be greatly appreciated. > >> > >> John V. > >> _______________________________________________ > >> Pythonmac-SIG maillist - Pythonmac-SIG at python.org > >> http://mail.python.org/mailman/listinfo/pythonmac-sig > >> unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG > >> > > > > > > _______________________________________________ > > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > > http://mail.python.org/mailman/listinfo/pythonmac-sig > > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG > > > > From zachary.pincus at yale.edu Sun Apr 7 21:01:38 2013 From: zachary.pincus at yale.edu (Zachary Pincus) Date: Sun, 7 Apr 2013 15:01:38 -0400 Subject: [Pythonmac-SIG] Good way for beginner to get started with Python? In-Reply-To: <20130407154302.GB500@cox.net> References: <20130406232207.GA500@cox.net> <20130407154302.GB500@cox.net> Message-ID: Consider also Processing (not python, but a learn-to-program environment that feels a little like a modern LOGO), or the not-dissimilar Python-based NodeBox environment. There's a lot less filesystem bother (etc.), and I think that both have built-in IDEs, so both should be more lightweight than jumping into a "real" python environment. Zach On Apr 7, 2013, at 11:43 AM, John Velman wrote: > Thanks to both Chris and Matt. I've been thinking somewhat along the lines > Chris suggested, and will probably do that, or some kind of step by step. > Even thinking of looking into PyGames myself (in line behind a bunch of > other things -- it might come in front of learning OCaml). And thanks to > Matt for the learnpython and codecademy links. > > Barry's reference to the Coursea course looks particularly good, but the > timing may be bad, since it starts at the last month of the school year. > > Thanks again, > > John V. > > On Sun, Apr 07, 2013 at 06:34:05AM -0500, Matt Ambrogi wrote: >> John, >> I agree with Chris, some setup/installation is required basically >> everywhere. To get down to zero of that, you might have to look at some >> other online tools, as you might have seen when you were googling. Two >> that could be worth a look are: http://www.learnpython.org/ and >> http://www.codecademy.com/tracks/python as they seem to check at least >> one of your boxes (get learning fast). >> >> Offline, on my mac, the closest I get to your space (lightest weight, least >> setup/config, least ide learning required yet with some support) is a >> download of the free TextWrangler ide. One can have it up and running >> quickly and be off and coding python. It does nothing to help build games. >> >> regards, -Matt >> >> >> >> >> On Sat, Apr 6, 2013 at 7:13 PM, Chris Weisiger wrote: >> >>> My recommendation would be to go with PyGame, but as you note this does >>> require some installation work. Unfortunately as soon as you start getting >>> into being a software developer, the kid gloves come off and you have to >>> learn a lot about how software works. I'm not aware of any one-stop >>> user-friendly installer that will get you up and running in Python with an >>> eye towards games. My best advice is to do the installation for him. >>> >>> -Chris >>> >>> >>> On Sat, Apr 6, 2013 at 4:22 PM, John Velman wrote: >>> >>>> Reply-To: >>>> >>>> I'm looking for a way to get a bright (of course) high school student >>>> started with Python. He has a recent iMac. He is pretty computer >>>> literate, >>>> and knows the names of some computer languages, but no experience in >>>> programming, and little experience with text editing per se. He is >>>> particularly interested in games. Is at a stage of trying to decide what >>>> he >>>> is going to do in college, and was asking me about getting started with >>>> computer programming. >>>> >>>> I recommend Python as a good starting language. It would be nice if there >>>> was a simple IDE that works with python without a lot of setting up >>>> options, moving things around in the file system, and so on. I don't want >>>> to throw him into Vim or Emacs. >>>> >>>> I'd like him to get to something interesting (GUI, very simple games) >>>> soon. >>>> I showed him some examples from Pythonista on my iPad, and he was >>>> impressed >>>> at what could be done in ~ 100 lines of Python. >>>> >>>> For now, it would be really nice if he could work with the Python already >>>> on his iMac, and minimal other setup. Maybe the TKInter that comes with >>>> the >>>> iMac would also be a place to start GUI. It looks like installing >>>> TextWrangler might be a good choice for an editor. Or just plain >>>> TextEdit? >>>> >>>> I've looked at PyGames, and done a little other googling, and every place >>>> I've looked says install this, install that, use Home Brew, use Ports, >>>> don't use Ports, be sure and set such and such an option, be sure and get >>>> a >>>> version greater than x.y...Things that I might do, but I've been at this, >>>> at least part time, more or less forever. >>>> >>>> We need something than one can just do, and then learn while doing. Well, >>>> something Mac like. >>>> >>>> (I myself haven't used Python much for a while, am trying to develop one >>>> good app in Objective C on an hour or so a day. I use the Xcode IDE, Vim >>>> outside of Xcode. Am personally a dynasaur, am mailing this via Mutt.) >>>> >>>> Any suggestions will be greatly appreciated. >>>> >>>> John V. >>>> _______________________________________________ >>>> Pythonmac-SIG maillist - Pythonmac-SIG at python.org >>>> http://mail.python.org/mailman/listinfo/pythonmac-sig >>>> unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG >>>> >>> >>> >>> _______________________________________________ >>> Pythonmac-SIG maillist - Pythonmac-SIG at python.org >>> http://mail.python.org/mailman/listinfo/pythonmac-sig >>> unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG >>> >>> > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG From chris.barker at noaa.gov Sun Apr 7 22:45:07 2013 From: chris.barker at noaa.gov (Chris Barker - NOAA Federal) Date: Sun, 7 Apr 2013 13:45:07 -0700 Subject: [Pythonmac-SIG] Good way for beginner to get started with Python? In-Reply-To: References: <20130406232207.GA500@cox.net> <20130407154302.GB500@cox.net> Message-ID: I'd second a couple others posting on this thread to set up the environment for your friend if need be. I think it's a much better idea to choose what tools, libraries, etc he should learn from by criteria other than "it comes with python out of the box". A couple specific suggestions: There have recently been published a couple different book that teach Python to kids. I haven't looked closely at any of them but they've been pretty well reviewed: Snake Wrangling for Kids Python for Kids - A Playful Introduction to Programming Hello World!: Computer Programming for Kids and Other Beginners If PyGame doesn't provide a nice complete binary installer for OS-X, that might be a great contribution to the community. As for IDE/Text editor -- definatly set him up with a real, python-aware programmers editor -- Not TextEdit! TextWrangler has less-than-idea python support, but it's a reasonable choice. SublimeText2 is very nice (though only a trial version is available for free) PyCharm has free "class room" and "Open Source" licenses that may be applicable here. -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 terry.simons at gmail.com Mon Apr 8 05:30:12 2013 From: terry.simons at gmail.com (Terry Simons) Date: Sun, 7 Apr 2013 20:30:12 -0700 Subject: [Pythonmac-SIG] Good way for beginner to get started with Python? In-Reply-To: References: <20130406232207.GA500@cox.net> <20130407154302.GB500@cox.net> Message-ID: Second this. Also, Processing + Arduino makes an interesting combination, since you can make really simple GUIs that can talk to hardware to turn LEDs on and off, etc... And since the Processing and Arduino IDEs are very similar (They share the same codebase, somehow) the learning curve is really small. On Sun, Apr 7, 2013 at 12:01 PM, Zachary Pincus wrote: > Consider also Processing (not python, but a learn-to-program environment > that feels a little like a modern LOGO), or the not-dissimilar Python-based > NodeBox environment. There's a lot less filesystem bother (etc.), and I > think that both have built-in IDEs, so both should be more lightweight than > jumping into a "real" python environment. > > Zach > > > On Apr 7, 2013, at 11:43 AM, John Velman wrote: > > > Thanks to both Chris and Matt. I've been thinking somewhat along the > lines > > Chris suggested, and will probably do that, or some kind of step by step. > > Even thinking of looking into PyGames myself (in line behind a bunch of > > other things -- it might come in front of learning OCaml). And thanks to > > Matt for the learnpython and codecademy links. > > > > Barry's reference to the Coursea course looks particularly good, but the > > timing may be bad, since it starts at the last month of the school year. > > > > Thanks again, > > > > John V. > > > > On Sun, Apr 07, 2013 at 06:34:05AM -0500, Matt Ambrogi wrote: > >> John, > >> I agree with Chris, some setup/installation is required basically > >> everywhere. To get down to zero of that, you might have to look at some > >> other online tools, as you might have seen when you were googling. Two > >> that could be worth a look are: http://www.learnpython.org/ and > >> http://www.codecademy.com/tracks/python as they seem to check at > least > >> one of your boxes (get learning fast). > >> > >> Offline, on my mac, the closest I get to your space (lightest weight, > least > >> setup/config, least ide learning required yet with some support) is a > >> download of the free TextWrangler ide. One can have it up and running > >> quickly and be off and coding python. It does nothing to help build > games. > >> > >> regards, -Matt > >> > >> > >> > >> > >> On Sat, Apr 6, 2013 at 7:13 PM, Chris Weisiger >wrote: > >> > >>> My recommendation would be to go with PyGame, but as you note this does > >>> require some installation work. Unfortunately as soon as you start > getting > >>> into being a software developer, the kid gloves come off and you have > to > >>> learn a lot about how software works. I'm not aware of any one-stop > >>> user-friendly installer that will get you up and running in Python > with an > >>> eye towards games. My best advice is to do the installation for him. > >>> > >>> -Chris > >>> > >>> > >>> On Sat, Apr 6, 2013 at 4:22 PM, John Velman wrote: > >>> > >>>> Reply-To: > >>>> > >>>> I'm looking for a way to get a bright (of course) high school student > >>>> started with Python. He has a recent iMac. He is pretty computer > >>>> literate, > >>>> and knows the names of some computer languages, but no experience in > >>>> programming, and little experience with text editing per se. He is > >>>> particularly interested in games. Is at a stage of trying to decide > what > >>>> he > >>>> is going to do in college, and was asking me about getting started > with > >>>> computer programming. > >>>> > >>>> I recommend Python as a good starting language. It would be nice if > there > >>>> was a simple IDE that works with python without a lot of setting up > >>>> options, moving things around in the file system, and so on. I don't > want > >>>> to throw him into Vim or Emacs. > >>>> > >>>> I'd like him to get to something interesting (GUI, very simple games) > >>>> soon. > >>>> I showed him some examples from Pythonista on my iPad, and he was > >>>> impressed > >>>> at what could be done in ~ 100 lines of Python. > >>>> > >>>> For now, it would be really nice if he could work with the Python > already > >>>> on his iMac, and minimal other setup. Maybe the TKInter that comes > with > >>>> the > >>>> iMac would also be a place to start GUI. It looks like installing > >>>> TextWrangler might be a good choice for an editor. Or just plain > >>>> TextEdit? > >>>> > >>>> I've looked at PyGames, and done a little other googling, and every > place > >>>> I've looked says install this, install that, use Home Brew, use Ports, > >>>> don't use Ports, be sure and set such and such an option, be sure and > get > >>>> a > >>>> version greater than x.y...Things that I might do, but I've been at > this, > >>>> at least part time, more or less forever. > >>>> > >>>> We need something than one can just do, and then learn while doing. > Well, > >>>> something Mac like. > >>>> > >>>> (I myself haven't used Python much for a while, am trying to develop > one > >>>> good app in Objective C on an hour or so a day. I use the Xcode IDE, > Vim > >>>> outside of Xcode. Am personally a dynasaur, am mailing this via Mutt.) > >>>> > >>>> Any suggestions will be greatly appreciated. > >>>> > >>>> John V. > >>>> _______________________________________________ > >>>> Pythonmac-SIG maillist - Pythonmac-SIG at python.org > >>>> http://mail.python.org/mailman/listinfo/pythonmac-sig > >>>> unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG > >>>> > >>> > >>> > >>> _______________________________________________ > >>> Pythonmac-SIG maillist - Pythonmac-SIG at python.org > >>> http://mail.python.org/mailman/listinfo/pythonmac-sig > >>> unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG > >>> > >>> > > _______________________________________________ > > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > > http://mail.python.org/mailman/listinfo/pythonmac-sig > > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG > -------------- next part -------------- An HTML attachment was scrubbed... URL: From velman at cox.net Wed Apr 10 01:45:43 2013 From: velman at cox.net (John Velman) Date: Tue, 9 Apr 2013 16:45:43 -0700 Subject: [Pythonmac-SIG] Good way for beginner to get started with Python? In-Reply-To: <20130406232207.GA500@cox.net> References: <20130406232207.GA500@cox.net> Message-ID: <20130409234543.GC37311@cox.net> Thanks to everybody for all the great suggestions. I'm still sorting them and passing them on bit by bit. I'll try to let you know how this all turns out. From the suggestions, there are a couple things I want to look further into myself. (Old dog wants new tricks). Best, John V. On Sat, Apr 06, 2013 at 04:22:07PM -0700, John Velman wrote: > Reply-To: > > I'm looking for a way to get a bright (of course) high school student > started with Python. He has a recent iMac. He is pretty computer literate, > and knows the names of some computer languages, but no experience in > programming, and little experience with text editing per se. He is > particularly interested in games. Is at a stage of trying to decide what he > is going to do in college, and was asking me about getting started with > computer programming. [snip] From chris.barker at noaa.gov Wed Apr 10 20:19:38 2013 From: chris.barker at noaa.gov (Chris Barker - NOAA Federal) Date: Wed, 10 Apr 2013 11:19:38 -0700 Subject: [Pythonmac-SIG] py2app questions.. Message-ID: First: Ronald, thanks for keeping py2app up to date! The good news: I just ran a recent py2app on an older app of mine, and it all worked out of the box. However, the resulting bundle is HUGE. A lot of this is inevitable, I'm using a universal build, and some big packages, but there seems to be some room for improvement: The app in question is using: wxPython numpy a tiny bit of scipy matplotlib So it's going to be big! Numpy, scipy and matplotlib all have a lot of intertwining modules, many of which get imported whether you need them or not, so probably the best one can do is include them all (more on that later) However, I'm getting a couple packages that I have no idea why: OpenGL email zmq hand-removing them from the bundle doesn't break anything. I'm wondering if their recipes are getting triggered by accident somehow -- how can I tell how/why a particular package got included? I'm also getting a number of *.so files that I don't understand -- some of the larger ones are: _bsddb.so _sqlite3.so _imaging.so (is that PIL?) there are a LOT more, but it's had to know what they are from just the names, and most are pretty small anyway (except the wx ones that I need and expect to be big...) I understand that it's a goal of py2app to work "out of the box" without needing to hand-tweak a lot to get it to work. This is a worthy goal, and the recipes approach works great. However, it would be nice if there was an alternate approach that made it easier to build a more optimized package. One idea: Py2app (and all the other stand-alone builders I've looked at) figure out want to include from source code analysis. however, as it's pretty common for packages to "import" stuff that may not be used a particular app, you can get a lot of stuff you dontt need. For instance, I'm pretty sure that PIL import tkInter. These imports are often wrapped in an if clause or inside a function that may never get called, but source code analysis isn't going to find all of those, so the same thing to do is include it all -- resulting in bloated packages. I propose an alternative -- analysis of the app at run-time: The user would run the app (maybe a test suite), then we'd take a look at sys.modules and see everything that was actually loaded. This would miss anything that wasn't exercised by the code you ran, but for most cases, a test suite would bring in everything (comprehensive test suites are hard to come by, but all it would need to do is test enough to import every package it might use -- that's not a heavy lift). This seems so easy -- am I missing something??? To support this, py2app would need a way to bypass the source code analysis, and instead load a data file with the list of modules that need to be included. Actually, as it sometimes takes a while to scan teh code, it would be nice of py2app could optinally dump the results of teh source code analysis, and be abel to re-load it later, rather than needed to re-run. 1) Am I missing something as to why the run-time analysis wouldn't work ? 2) how hard would it be to patch py2app to load a module list, rather than scan the source? Thoughts?? -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 Thu Apr 11 10:47:36 2013 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Thu, 11 Apr 2013 10:47:36 +0200 Subject: [Pythonmac-SIG] py2app questions.. In-Reply-To: References: Message-ID: <47E29426-A4E9-4AC9-8F65-D0466BF6B1E6@mac.com> On 10 Apr, 2013, at 20:19, Chris Barker - NOAA Federal wrote: > First: Ronald, thanks for keeping py2app up to date! > > The good news: I just ran a recent py2app on an older app of mine, and > it all worked out of the box. > > However, the resulting bundle is HUGE. A lot of this is inevitable, > I'm using a universal build, and some big packages, but there seems to > be some room for improvement: > > The app in question is using: > > wxPython > numpy > a tiny bit of scipy > matplotlib > > So it's going to be big! > > Numpy, scipy and matplotlib all have a lot of intertwining modules, > many of which get imported whether you need them or not, so probably > the best one can do is include them all (more on that later) > > However, I'm getting a couple packages that I have no idea why: > > OpenGL This I don't know. > email This will get better with py2app 0.8. In 0.7 the entire email package gets included when some module has a dependency on a module from the email package because email uses __import__ to provide compatibility aliases. In 0.8 I've taught modulegraph about those aliases and therefore only include the bits of the email package that are actually used. > zmq I'v seen other reports that zmq gets pulled in without being used (in the context of py2app build problems, some app wouldn't be packaged correctly until pyzmq got removed). I haven't had time yet to see why zmq confuses py2app. > > hand-removing them from the bundle doesn't break anything. Py2app detects dependencies by looking for import statements in the module bytecode. That doesn't mean the import is actually used (for example because it is optionally imported on some other platform). The --xref and --graph options for py2app can be used to emit a module dependency graph that might show what's going on here. > > I'm wondering if their recipes are getting triggered by accident > somehow -- how can I tell how/why a particular package got included? > > I'm also getting a number of *.so files that I don't understand -- > some of the larger ones are: > > _bsddb.so > _sqlite3.so > _imaging.so (is that PIL?) > > there are a LOT more, but it's had to know what they are from just the > names, and most are pretty small anyway (except the wx ones that I > need and expect to be big...) > > I understand that it's a goal of py2app to work "out of the box" > without needing to hand-tweak a lot to get it to work. This is a > worthy goal, and the recipes approach works great. However, it would > be nice if there was an alternate approach that made it easier to > build a more optimized package. One idea: > > Py2app (and all the other stand-alone builders I've looked at) figure > out want to include from source code analysis. however, as it's pretty > common for packages to "import" stuff that may not be used a > particular app, you can get a lot of stuff you dontt need. For > instance, I'm pretty sure that PIL import tkInter. These imports are > often wrapped in an if clause or inside a function that may never get > called, but source code analysis isn't going to find all of those, so > the same thing to do is include it all -- resulting in bloated > packages. That's basicly correct. The recipe system does make it possible to tweak the dependency graph, and that's (as an example) used in a recipe for pydoc to remove the import dependency from pydoc on Tkinter as you don't want to pull in Tkinter unless it is used by other parts of the app. > > I propose an alternative -- analysis of the app at run-time: The user > would run the app (maybe a test suite), then we'd take a look at > sys.modules and see everything that was actually loaded. This would > miss anything that wasn't exercised by the code you ran, but for most > cases, a test suite would bring in everything (comprehensive test > suites are hard to come by, but all it would need to do is test enough > to import every package it might use -- that's not a heavy lift). > > This seems so easy -- am I missing something??? Writing support code for this in py2app is easy enough, but that does require having a comprehensive enough test suite for apps and writing those is much harder (especially for GUI apps, which is where py2app is used the most) > > To support this, py2app would need a way to bypass the source code > analysis, and instead load a data file with the list of modules that > need to be included. Actually, as it sometimes takes a while to scan > teh code, it would be nice of py2app could optinally dump the results > of teh source code analysis, and be abel to re-load it later, rather > than needed to re-run. > > 1) Am I missing something as to why the run-time analysis wouldn't work ? > > 2) how hard would it be to patch py2app to load a module list, rather > than scan the source? Fairly easy, py2app uses modulegraph to build a module dependency graph and then extracts the list of modules and extensions from that. But, I'm not sure it that would be useful functionality. IMHO it would be much nicer to have a tool for inspecting and managing the module dependency graph (that is, use the --graph option of py2app to dump the dependency graph, then have a (GUI) tool for inspecting that and generating py2app configuration options that tweak the graph. I'd also like to see an improved and enhanced set of recipes that automate this for commonly used packages (for some definition of commonly used, adding recipes for popular bioinformatics packages would be fine, even if bioinformatics packages won't be commonly used in the larger Python community) My near term goals for py2app are: * get the next 0.7 release out * write some documentation, the current documentation is barely worth that description and offers little to no help on actually using py2app beyond the basics. * refactor the py2app code base to be less dependent on distutils, mostly to make it easier to create unittests but also to prepare for a future where distutils will be used less and less to package/build software. Ronald From chris.barker at noaa.gov Fri Apr 12 18:13:27 2013 From: chris.barker at noaa.gov (Chris Barker - NOAA Federal) Date: Fri, 12 Apr 2013 09:13:27 -0700 Subject: [Pythonmac-SIG] py2app questions.. In-Reply-To: <0F471E70-D7E4-4C2D-B144-26CC1765CF5F@mac.com> References: <47E29426-A4E9-4AC9-8F65-D0466BF6B1E6@mac.com> <0F471E70-D7E4-4C2D-B144-26CC1765CF5F@mac.com> Message-ID: On Thu, Apr 11, 2013 at 10:50 PM, Ronald Oussoren wrote: > On 11 Apr, 2013, at 23:50, Chris Barker - NOAA Federal wrote: >> *** using recipe: virtualenv *** >> *** using recipe: sip *** ... >> It looks like the recipes for ALL of the packages I have installed are >> being run -- a bug perhaps? > > That's not a bug, all recipes get called on every build and each one checks if it actually has to do something (mostly by checking for the presence of modules in the dependency graph). hmm -- maybe a re-write of that message to something like "checking recipe: something". But anyway, as far as I can tell, I'm getting all the packages there is a recipe for that I have installed. Or certainly a bunch of extras. I'll poke into the dependency graph and see if I can see what's going on. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov From chris.barker at noaa.gov Mon Apr 15 20:30:51 2013 From: chris.barker at noaa.gov (Chris Barker - NOAA Federal) Date: Mon, 15 Apr 2013 11:30:51 -0700 Subject: [Pythonmac-SIG] py2app questions.. In-Reply-To: References: Message-ID: Ronald et al, As matplotlib seems to be responsible for bringing eveything else in, I'm trying a different tack: 1) I've removed many of the recipes from my p2app distribution, notably teh matplotlib one. So now the only recipe getting run is wx. 2) I know that matplotlib isn't going to work right, as there are issues with matplotlib data, etc. So I've tried to remove it by adding it to "excludes". However, it's getting included anyway, in the site_packages zip file. (but doesn't work...) But moving on... I"ve added ['matplotlib'] to "packages". Now I get it included, in full, in Resources/lib/python2.7, and non longer in the site_packages zip, and the app works fine. the matplotlib package is 64MB though, so it would be nice to trim it down, but this isn't bad, and the total package is now 134MB, rather than the 210MB I did have. So I suggest that the matplotlib recipe should: - remove matplotlib from the site_packages zip - install the matplotlib package in it's entirety (though maybe strip out the *.py files...., and things like tests, etc.) - not run matplotlib through modulegraph -- whatever the user is actually using (numpy, etc) is probably imported elsewhere anyway. (though maybe including numpy would make some sense...) I hope this helps others in the future in any case. -Chris On Fri, Apr 12, 2013 at 1:47 PM, Chris Barker - NOAA Federal wrote: > OK, > > I've run py2app with --xref. I've enclosed the html output. > > Again, this app uses: > >> wxPython >> numpy >> matplotlib > > (and a few other stdlib packages...) > > I've learned a few things from this. > > 1) this is odd: > right near the top, I see: > prescript.py > imports: Image > that's the prescript for the PIL recipe -- I"m not using PIL, it > seems it's runnign nthe recipe, and using what the recipe imported -- > not good. > > > 2) do I need all of Carbon? > Carbon > imports: warnings > imported by: Carbon.AE Carbon.Appearance Carbon.AppleEvents > Carbon.CarbonEvents Carbon.ControlAccessor Carbon.Controls Carbon.Ctl > Carbon.Dialogs Carbon.Dlg Carbon.Dragconst Carbon.Events Carbon.Evt > Carbon.File Carbon.Files Carbon.Menu Carbon.Qd Carbon.QuickDraw > Carbon.Res Carbon.TextEdit Carbon.Win Carbon.Windows EasyDialogs > aepack aetools macostools macresource plistlib > > I'm guessing py2ap uses plistlib, or something... > > 3) Matplotlib has multipel back-ends -- that's why I'm getting TK > stuff (and from there, Carbon?): > FileDialog > imports: Dialog Tkinter fnmatch os > imported by: matplotlib.backends.backend_tkagg > > An idea how to tweak the MPL recipe to only pull in the backend we > need? is there a way to pass options to he recipes? > > 4) Ipython is getting pulled in my Matplotlib too: > > IPython > imports: > .... > IPython.zmq matplotlib.sphinxext.ipython_directive > > which explains the zmq.so > > ( and a lot of other stuff -- iPython pulls in a lot ) > > 5) It looks like Image is getting pulled in a couple places: > ... > docutils.parsers.rst.directives.images docutils.writers.html4css1 > prescript.py scipy.misc.pilutil > > docutils, prescript, and scipy (not sure why scipy is pulled in yet, I > removed that dependency...) > > 6)OpenGL > imported by: IPython.lib.inputhookglut .... > > so that's getting pulled in by IPython, which is pulled in by MPL... ( I think ) > (wow! OPenGL sure has a lot of modules!) > > 7) bsddb seems to be recusively importing itself... > > bsddb > imports: UserDict _bsddb bsddb.dbutils collections os warnings weakref > imported by: bsddb.db bsddb.dbutils dbhash > > bsddb.db > imports: _bsddb bsddb > imported by: bsddb.dbutils > > bsddb.dbutils > imports: bsddb bsddb.db time > imported by: bsddb > > .... > > OK, I'm getting bored. A lot of this is really caused by Matplotlib -- > which make some sense, it's been designed to be a developers tool (or > at least to be used interactively), with all sorts of options, > determined at run-time. > > Is there a way to turn off a recipe other than removing ot from my > py2app install? > > This is making me think that the MPL recipe should pull in the MPL > package, but not scan it for dependencies... > > Still not sure about PIL -- but I wouldn't be surprised if MPL is > involved somehow! > > -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 -- 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 poalman at gmail.com Wed Apr 24 19:07:31 2013 From: poalman at gmail.com (Paul Wiseman) Date: Wed, 24 Apr 2013 18:07:31 +0100 Subject: [Pythonmac-SIG] Environment variable issues running py2app application Message-ID: Hey, I've never seen this problem before but one user seems to be experiencing this issue and I'm at a bit of a loss as to what the cause could be One part of the app runs this: subprocess.Popen(['/usr/bin/env', 'system_profiler', 'SPUSBDataType', '-xml']) I've never seen a problem running this, however in one users logs it's returning: env: system_profiler: No such file or directory So I thought that maybe their PATH variable doesn't include path to the binary, I asked them to provide the output of '/usr/bin/env' and 'which system_profiler' 'which system profiler' returned '/usr/sbin/system_profiler' and '/usr/sbin' was in their PATH variable that returned from /usr/bin/env, so I don't really get what's going on. This also looks like it only happens if the user opens the .app directly, but if they open the binary directly in the .app/Contents/MacOS/ folder, it works and it can find these external binaries through subprocess. I'm really not sure what might be causing this? and I've never experienced it myself when testing, nor has it ever been reported before which makes me inclined to believe it's some external setting / config on the users machine which is causing this behaviour? Thanks! Paul -------------- next part -------------- An HTML attachment was scrubbed... URL: From nad at acm.org Wed Apr 24 20:29:53 2013 From: nad at acm.org (Ned Deily) Date: Wed, 24 Apr 2013 11:29:53 -0700 Subject: [Pythonmac-SIG] Environment variable issues running py2app application References: Message-ID: In article , Paul Wiseman wrote: > I've never seen this problem before but one user seems to be experiencing > this issue and I'm at a bit of a loss as to what the cause could be > > One part of the app runs this: subprocess.Popen(['/usr/bin/env', > 'system_profiler', 'SPUSBDataType', '-xml']) > > I've never seen a problem running this, however in one users logs it's > returning: env: system_profiler: No such file or directory > > So I thought that maybe their PATH variable doesn't include path to the > binary, I asked them to provide the output of '/usr/bin/env' and 'which > system_profiler' > > 'which system profiler' returned '/usr/sbin/system_profiler' and > '/usr/sbin' was in their PATH variable that returned from /usr/bin/env, so > I don't really get what's going on. > > This also looks like it only happens if the user opens the .app directly, > but if they open the binary directly in the .app/Contents/MacOS/ folder, it > works and it can find these external binaries through subprocess. > > I'm really not sure what might be causing this? and I've never experienced > it myself when testing, nor has it ever been reported before which makes me > inclined to believe it's some external setting / config on the users > machine which is causing this behaviour? Normally, a shell (like bash) is not involved in launching an OS X app bundle, like those produced by py2app, so the environment variables seen in an app's environment are not the same as what is seen from a terminal shell session. Thus, the output of `which` and of the user's shell $PATH aren't relevant. It used to be possible to influence to the user's GUI environment by supplying a ~/.MacOSX/environment.plist but I believe that is no longer supported on current OS X releases and, in any case, it's a bad idea to depend on it. It is possible to include app-specific environment variables in the app's plist. But, in your case, the simplest thing to do is use an absolute path to `system_profiler` and avoid use of `/usr/bin/env` within an app bundle. -- Ned Deily, nad at acm.org From poalman at gmail.com Thu Apr 25 10:41:04 2013 From: poalman at gmail.com (Paul Wiseman) Date: Thu, 25 Apr 2013 09:41:04 +0100 Subject: [Pythonmac-SIG] Environment variable issues running py2app application In-Reply-To: References: Message-ID: On 24 April 2013 19:29, Ned Deily wrote: > In article > , > Paul Wiseman wrote: > > I've never seen this problem before but one user seems to be experiencing > > this issue and I'm at a bit of a loss as to what the cause could be > > > > One part of the app runs this: subprocess.Popen(['/usr/bin/env', > > 'system_profiler', 'SPUSBDataType', '-xml']) > > > > I've never seen a problem running this, however in one users logs it's > > returning: env: system_profiler: No such file or directory > > > > So I thought that maybe their PATH variable doesn't include path to the > > binary, I asked them to provide the output of '/usr/bin/env' and 'which > > system_profiler' > > > > 'which system profiler' returned '/usr/sbin/system_profiler' and > > '/usr/sbin' was in their PATH variable that returned from /usr/bin/env, > so > > I don't really get what's going on. > > > > This also looks like it only happens if the user opens the .app directly, > > but if they open the binary directly in the .app/Contents/MacOS/ folder, > it > > works and it can find these external binaries through subprocess. > > > > I'm really not sure what might be causing this? and I've never > experienced > > it myself when testing, nor has it ever been reported before which makes > me > > inclined to believe it's some external setting / config on the users > > machine which is causing this behaviour? > > Normally, a shell (like bash) is not involved in launching an OS X app > bundle, like those produced by py2app, so the environment variables seen > in an app's environment are not the same as what is seen from a terminal > shell session. Thus, the output of `which` and of the user's shell > $PATH aren't relevant. It used to be possible to influence to the > user's GUI environment by supplying a ~/.MacOSX/environment.plist but I > believe that is no longer supported on current OS X releases and, in any > case, it's a bad idea to depend on it. It is possible to include > app-specific environment variables in the app's plist. But, in your > case, the simplest thing to do is use an absolute path to > `system_profiler` and avoid use of `/usr/bin/env` within an app bundle. > > Ah thanks, so why does it work normally then? You say the environment is not the same, what environment is used if I open an app? >From looking at https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/open.1.html it says both "The *open* command opens a file (or a directory or URL), just as if you had double-clicked the file's icon." and "Opened applications inherit environment variables just as if you had launched the application directly through its full path." which seems to suggest that apps do have the users environment? (but if I'm running /usr/bin/env as part of the command, wont that make sure the users PATH variable is used for the command?) I use a few different external binaries, and I'd rather not assume their location by using absolute paths, although maybe I could fallback to doing this if it fails - to be a bit safer. Presumably I could also just pass shell=True for the subprocess call to inherit the users environment? Although that has problems of its own. > -- > Ned Deily, > nad at acm.org > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ronaldoussoren at mac.com Thu Apr 25 14:08:38 2013 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Thu, 25 Apr 2013 14:08:38 +0200 Subject: [Pythonmac-SIG] Environment variable issues running py2app application In-Reply-To: References: Message-ID: <73338FCA-EB6A-4838-9198-C42BDCC7179C@mac.com> On 25 Apr, 2013, at 10:41, Paul Wiseman wrote: > On 24 April 2013 19:29, Ned Deily wrote: > In article > , > Paul Wiseman wrote: > > I've never seen this problem before but one user seems to be experiencing > > this issue and I'm at a bit of a loss as to what the cause could be > > > > One part of the app runs this: subprocess.Popen(['/usr/bin/env', > > 'system_profiler', 'SPUSBDataType', '-xml']) > > > > I've never seen a problem running this, however in one users logs it's > > returning: env: system_profiler: No such file or directory > > > > So I thought that maybe their PATH variable doesn't include path to the > > binary, I asked them to provide the output of '/usr/bin/env' and 'which > > system_profiler' > > > > 'which system profiler' returned '/usr/sbin/system_profiler' and > > '/usr/sbin' was in their PATH variable that returned from /usr/bin/env, so > > I don't really get what's going on. > > > > This also looks like it only happens if the user opens the .app directly, > > but if they open the binary directly in the .app/Contents/MacOS/ folder, it > > works and it can find these external binaries through subprocess. > > > > I'm really not sure what might be causing this? and I've never experienced > > it myself when testing, nor has it ever been reported before which makes me > > inclined to believe it's some external setting / config on the users > > machine which is causing this behaviour? > > Normally, a shell (like bash) is not involved in launching an OS X app > bundle, like those produced by py2app, so the environment variables seen > in an app's environment are not the same as what is seen from a terminal > shell session. Thus, the output of `which` and of the user's shell > $PATH aren't relevant. It used to be possible to influence to the > user's GUI environment by supplying a ~/.MacOSX/environment.plist but I > believe that is no longer supported on current OS X releases and, in any > case, it's a bad idea to depend on it. It is possible to include > app-specific environment variables in the app's plist. But, in your > case, the simplest thing to do is use an absolute path to > `system_profiler` and avoid use of `/usr/bin/env` within an app bundle. > > > Ah thanks, so why does it work normally then? You say the environment is not the same, what environment is used if I open an app? I don't know why it doesn't work on that particular machine, but what Ned wrote is correct: the Finder is started with a fairly minimal environment and does not proces shell profile files (such as .profile). AFAIK the default path should include /usr/bin and /usr/sbin. If you really want to have the same environment as in a shell session: py2app does have an option to emulate the shell environment. The implementation of this is fairly hacky and increases startup time because it needs to fork of a shell to set up the environment. BTW. I haven't checked if environment.plist still works, but using it shouldn't be used anyway. What's different about the non-functional machine? Which OSX version, machine architecture, is the user account special in any way (admin account or not, parental controls, ...)? Have you tried reporting os.environ in the application itself (and compare it with a machine that does work)? > > From looking at https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/open.1.html > > it says both "The open command opens a file (or a directory or URL), just as if you had double-clicked the file's icon." and "Opened applications inherit environment variables just as if you had launched the application directly through its full path." which seems to suggest that apps do have the users environment? (but if I'm running /usr/bin/env as part of the command, wont that make sure the users PATH variable is used for the command?) > > I use a few different external binaries, and I'd rather not assume their location by using absolute paths, although maybe I could fallback to doing this if it fails - to be a bit safer. Specifying the full path is saver anyway (IIRC we've had build issues in CPython when it didn't specify an absolute path for arch(1) because someone had an opensource arch command early on $PATH that wasn't compatible with the system one). Alternatively you could reset the PATH environment variable before starting the command. > > Presumably I could also just pass shell=True for the subprocess call to inherit the users environment? Although that has problems of its own. shell=True doesn't help for this, it uses /bin/sh to parse the command-line but that shell isn't started as a login shell and therefore doesn't read the shell profile Ronald From poalman at gmail.com Thu Apr 25 16:29:53 2013 From: poalman at gmail.com (Paul Wiseman) Date: Thu, 25 Apr 2013 15:29:53 +0100 Subject: [Pythonmac-SIG] Environment variable issues running py2app application In-Reply-To: <73338FCA-EB6A-4838-9198-C42BDCC7179C@mac.com> References: <73338FCA-EB6A-4838-9198-C42BDCC7179C@mac.com> Message-ID: On 25 April 2013 13:08, Ronald Oussoren wrote: > > On 25 Apr, 2013, at 10:41, Paul Wiseman wrote: > > > On 24 April 2013 19:29, Ned Deily wrote: > > In article > > , > > Paul Wiseman wrote: > > > I've never seen this problem before but one user seems to be > experiencing > > > this issue and I'm at a bit of a loss as to what the cause could be > > > > > > One part of the app runs this: subprocess.Popen(['/usr/bin/env', > > > 'system_profiler', 'SPUSBDataType', '-xml']) > > > > > > I've never seen a problem running this, however in one users logs it's > > > returning: env: system_profiler: No such file or directory > > > > > > So I thought that maybe their PATH variable doesn't include path to the > > > binary, I asked them to provide the output of '/usr/bin/env' and 'which > > > system_profiler' > > > > > > 'which system profiler' returned '/usr/sbin/system_profiler' and > > > '/usr/sbin' was in their PATH variable that returned from > /usr/bin/env, so > > > I don't really get what's going on. > > > > > > This also looks like it only happens if the user opens the .app > directly, > > > but if they open the binary directly in the .app/Contents/MacOS/ > folder, it > > > works and it can find these external binaries through subprocess. > > > > > > I'm really not sure what might be causing this? and I've never > experienced > > > it myself when testing, nor has it ever been reported before which > makes me > > > inclined to believe it's some external setting / config on the users > > > machine which is causing this behaviour? > > > > Normally, a shell (like bash) is not involved in launching an OS X app > > bundle, like those produced by py2app, so the environment variables seen > > in an app's environment are not the same as what is seen from a terminal > > shell session. Thus, the output of `which` and of the user's shell > > $PATH aren't relevant. It used to be possible to influence to the > > user's GUI environment by supplying a ~/.MacOSX/environment.plist but I > > believe that is no longer supported on current OS X releases and, in any > > case, it's a bad idea to depend on it. It is possible to include > > app-specific environment variables in the app's plist. But, in your > > case, the simplest thing to do is use an absolute path to > > `system_profiler` and avoid use of `/usr/bin/env` within an app bundle. > > > > > > Ah thanks, so why does it work normally then? You say the environment is > not the same, what environment is used if I open an app? > > I don't know why it doesn't work on that particular machine, but what Ned > wrote is correct: the Finder is started with a fairly minimal environment > and does not proces shell profile files (such as .profile). AFAIK the > default path should include /usr/bin and /usr/sbin. > > If you really want to have the same environment as in a shell session: > py2app does have an option to emulate the shell environment. The > implementation of this is fairly hacky and increases startup time because > it needs to fork of a shell to set up the environment. > > BTW. I haven't checked if environment.plist still works, but using it > shouldn't be used anyway. > > What's different about the non-functional machine? Which OSX version, > machine architecture, is the user account special in any way (admin account > or not, parental controls, ...)? Have you tried reporting os.environ in > the application itself (and compare it with a machine that does work)? > > I'm not sure what's different about this machine, it's running 10.8.3 but it works just fine on other 10.8.3 machines. I'm not too sure what the machine architecture is, I logged everything callable in the platform module (pasted below) from inside the app and I can see i386 and x86_64. I guess it's the latter though. I've asked the user to provide a bit of information about the account, parental controls etc, is there a way to get this info from python? I will add os.environ into the logging, so I'll have that information in future - that's a pretty good idea :) I'd forgotten all about it. _mac_ver_gestalt: ('10.8.3', ('', '', ''), 'i386') _mac_ver_xml: ('10.8.3', ('', '', ''), 'x86_64') _node: ###-MacBook-Pro.local _sys_version: ('CPython', '2.7.4', '', '', 'v2.7.4:026ee0057e2d', 'Apr 6 2013 10:15:50', 'GCC 4.0.1 (Apple Inc. build 5493)') _syscmd_ver: ('', '', '') architecture: ('32bit', '') dist: ('', '', '') java_ver: ('', '', ('', '', ''), ('', '', '')) libc_ver: ('', '') linux_distribution: ('', '', '') mac_ver: ('10.8.3', ('', '', ''), 'x86_64') machine: x86_64 node: ###-MacBook-Pro.local platform: Darwin-12.3.0-x86_64-32bit processor: python_branch: python_build: ('v2.7.4:026ee0057e2d', 'Apr 6 2013 10:15:50') python_compiler: GCC 4.0.1 (Apple Inc. build 5493) python_implementation: CPython python_revision: python_version: 2.7.4 python_version_tuple: ('2', '7', '4') release: 12.3.0 system: Darwin uname: ('Darwin', '###-MacBook-Pro.local', '12.3.0', 'Darwin Kernel Version 12.3.0: Sun Jan 6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64', 'x86_64', '') version: Darwin Kernel Version 12.3.0: Sun Jan 6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64 win32_ver: ('', '', '', '') > > > From looking at > https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/open.1.html > > > > it says both "The open command opens a file (or a directory or URL), > just as if you had double-clicked the file's icon." and "Opened > applications inherit environment variables just as if you had launched the > application directly through its full path." which seems to suggest that > apps do have the users environment? (but if I'm running /usr/bin/env as > part of the command, wont that make sure the users PATH variable is used > for the command?) > > > > I use a few different external binaries, and I'd rather not assume their > location by using absolute paths, although maybe I could fallback to doing > this if it fails - to be a bit safer. > > Specifying the full path is saver anyway (IIRC we've had build issues in > CPython when it didn't specify an absolute path for arch(1) because someone > had an opensource arch command early on $PATH that wasn't compatible with > the system one). Alternatively you could reset the PATH environment > variable before starting the command. > > Maybe I will just use absolute paths, I guess it's unlikely that someone would move the binaries somewhere else, that's still in the PATH. I guess these binaries have always been in the same place 10.4-10.8? as I'll be targeting all these users To reset the path, would I just update the PATH entry in the os.environ dict? Presumably I could just add /usr/bin:/usr/sbin to the start of PATH when the app starts up, then I should be ok? > > > > Presumably I could also just pass shell=True for the subprocess call to > inherit the users environment? Although that has problems of its own. > > shell=True doesn't help for this, it uses /bin/sh to parse the > command-line but that shell isn't started as a login shell and therefore > doesn't read the shell profile > > Ah thanks, I didn't realise that. I always presumed it was the same as running it in a terminal window or the like - guess I was wrong! > Ronald > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ronaldoussoren at mac.com Thu Apr 25 16:34:51 2013 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Thu, 25 Apr 2013 16:34:51 +0200 Subject: [Pythonmac-SIG] Environment variable issues running py2app application In-Reply-To: References: <73338FCA-EB6A-4838-9198-C42BDCC7179C@mac.com> Message-ID: On 25 Apr, 2013, at 16:29, Paul Wiseman wrote: > To reset the path, would I just update the PATH entry in the os.environ dict? Presumably I could just add /usr/bin:/usr/sbin to the start of PATH when the app starts up, then I should be ok? Yes, "os.environ['PATH'] = '/usr/bin:/usr/sbin:' + os.environ['PATH']" would work, and would ensure that system binaries are prefered over binaries in other locations regardless of the environment of the user. Ronald From g1powermac at yahoo.com Sat Apr 27 21:06:44 2013 From: g1powermac at yahoo.com (J Silverman) Date: Sat, 27 Apr 2013 12:06:44 -0700 (PDT) Subject: [Pythonmac-SIG] Py2App and PyQt4 Issues Message-ID: <1367089604.24183.YahooMailClassic@web122103.mail.ne1.yahoo.com> Hi All, I'm attempting to get py2app and PyQt4 to work on my Mac running OSX 10.6. I've tried multiple variations of Python (2.7.4, 3.2.4, 3.3.1, etc), and also tried both the premade binary of PyQtx and compiled my own of the most recent stable version of PyQt4 (4.10.1). Yet despite this, I get extremely similar results if I try building and running one of the example PyQt4 scripts included with Py2App. On using Py2App with some of the variations above I'll get a bunch of these error messages during the build: /usr/bin/strip: object: /Users/g1powermac/Desktop/py2app-0.7.3/examples/PyQt/hello_app/dist/hello.app/Contents/Resources/lib/python2.7/lib-dynload/PyQt4/QtCore.so malformed object (unknown load command 7) There is only one variation where I don't get that message and that is if I use my own compiled version of PyQt4 and Python 3.3.1. However, if I double click on the subsequent app, I get a screen that says "hello Error" with either an option to open the Console or Terminate. Upon opening the Console, I see these error messages: 4/27/13 2:11:05 PM [0x0-0x25025].org.pythonmac.unspecified.hello[9513] Traceback (most recent call last): 4/27/13 2:11:05 PM [0x0-0x25025].org.pythonmac.unspecified.hello[9513] File "/Users/g1powermac/Desktop/py2app-0.7.3/examples/PyQt/hello_app/dist/hello.app/Contents/Resources/__boot__.py", line 43, in 4/27/13 2:11:05 PM [0x0-0x25025].org.pythonmac.unspecified.hello[9513] _run() 4/27/13 2:11:05 PM [0x0-0x25025].org.pythonmac.unspecified.hello[9513] File "/Users/g1powermac/Desktop/py2app-0.7.3/examples/PyQt/hello_app/dist/hello.app/Contents/Resources/__boot__.py", line 38, in _run 4/27/13 2:11:05 PM [0x0-0x25025].org.pythonmac.unspecified.hello[9513] exec(compile(source, path, 'exec'), globals(), globals()) 4/27/13 2:11:05 PM [0x0-0x25025].org.pythonmac.unspecified.hello[9513] File "/Users/g1powermac/Desktop/py2app-0.7.3/examples/PyQt/hello_app/dist/hello.app/Contents/Resources/hello.py", line 5, in 4/27/13 2:11:05 PM [0x0-0x25025].org.pythonmac.unspecified.hello[9513] a = Qt.QApplication(sys.argv) 4/27/13 2:11:05 PM [0x0-0x25025].org.pythonmac.unspecified.hello[9513] AttributeError: 'module' object has no attribute 'QApplication' 4/27/13 2:11:05 PM hello[9513] hello Error 4/27/13 2:11:07 PM com.apple.launchd.peruser.501[252] ([0x0-0x25025].org.pythonmac.unspecified.hello[9513]) Exited with exit code: 255 By the way, this is using Qt 4.8.4 and I could run the hello.py directly with python so it seems PyQt4 is installed correctly. Does anyone know how to get this working? Thanks, J Silverman From randdvorak at gmail.com Mon Apr 29 01:13:43 2013 From: randdvorak at gmail.com (Rand Dvorak) Date: Sun, 28 Apr 2013 19:13:43 -0400 Subject: [Pythonmac-SIG] PyObjC and Quartz - CGContextShowGlyphsAtPoint Message-ID: <93BA5D52-11D5-4F73-9996-D7528508A8F7@gmail.com> Hello, I was wondering if any would could help with a issue I'm having with some PyObjC and Quartz. I have a class the creates a pdf contact sheet from a list of images. I have the need to include bar codes along with each image. On the sheet is text with the filename of each image and I need to add a barcoded filename along with it. To this end I downloaded some barcode fonts and am trying to use CGContextDrawTextAtPoint(...) to draw the barcode but am not having any luck. Through some research I determined that I need to call CGContextDrawGlyphsAtPoint(...) instead, but cannot figure how to get the glyphs to to draw. I tried just using the bare string, but am getting this error. CGContextShowGlyphsAtPoint(c, 5, 5, self.string.cStringUsingEncoding_(NSUTF8StringEncoding), len(self.string)) ValueError: depythonifying 'unsigned short', got 'str' Any ideas on how to achieve what I am trying to accomplish here? Any info would be much appreciated. Thanks, Rand -------------- next part -------------- An HTML attachment was scrubbed... URL: From randdvorak at gmail.com Mon Apr 29 03:57:59 2013 From: randdvorak at gmail.com (Rand Dvorak) Date: Sun, 28 Apr 2013 21:57:59 -0400 Subject: [Pythonmac-SIG] PyObjC and Quartz - CGContextDrawGlyphsAtPoint Message-ID: <14414E39-929E-4A94-BE39-CB28D89B3791@gmail.com> PyObjC on Snow Leopard and Xcode 3.2. I've been trying to draw some text into a PDF context with a custom barcode font. I've tried translating this source, found here to Python: http://www.gogo-robot.com/2009/06/07/two-awkward-things-about-iphone-development/ And here is the relevant code for drawing the barcode: class Barcode(Graphic): initialized = NO def __init__(self, rect, string, size): self.string = string self.font = None self.size = size if not self.initialized: fontpath = NSBundle.mainBundle().pathForResource_ofType_("FRE3OF9X", "TTF") datap = CGDataProviderCreateWithFilename(fontpath.UTF8String()) self.font = CGFontCreateWithDataProvider(datap) #CGDataProviderRelease(datap) self.initialized = YES Graphic.__init__(self, rect) def draw(self,c): length = len(self.string) glyphs = objc.allocateBuffer(length) chars = objc.allocateBuffer(length + 1) self.string.getCString_maxLength_encoding_(chars, length + 1, NSASCIIStringEncoding) for i in range(length): glyphs[i] = chr(ord(chars[i]) - 29) CGContextSaveGState(c) CGContextSetFont(c, self.font) CGContextSetFontSize(c, self.size) CGContextSetRGBFillColor(c, 0, 0, 0, 1) CGContextSetRGBStrokeColor (c, 0, 0, 0, 1) CGContextSetTextMatrix (c, self.xform) CGContextShowGlyphsAtPoint(c, 0, 0, glyphs, length) CGContextRestoreGState(c) Getting this error: CGContextShowGlyphsAtPoint(c, 0, 0, glyphs, length) ValueError: depythonifying 'unsigned short', got 'str' Can anybody point me in the right direction in how to properly prepare a data structure to pass to the CGContextShowGlyphsAtPoint(..) function. Can I use ctypes? Any help appreciated. Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ronaldoussoren at mac.com Mon Apr 29 08:50:25 2013 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Mon, 29 Apr 2013 08:50:25 +0200 Subject: [Pythonmac-SIG] PyObjC and Quartz - CGContextShowGlyphsAtPoint In-Reply-To: <93BA5D52-11D5-4F73-9996-D7528508A8F7@gmail.com> References: <93BA5D52-11D5-4F73-9996-D7528508A8F7@gmail.com> Message-ID: <85AC480C-92FC-40E1-83FD-8EBE13A184EF@mac.com> On 29 Apr, 2013, at 1:13, Rand Dvorak wrote: > > Hello, > > I was wondering if any would could help with a issue I'm having with some PyObjC and Quartz. I have a class the creates a pdf contact sheet from a list of images. I have the need to include bar codes along with each image. On the sheet is text with the filename of each image and I need to add a barcoded filename along with it. To this end I downloaded some barcode fonts and am trying to use CGContextDrawTextAtPoint(...) to draw the barcode but am not having any luck. Through some research I determined that I need to call CGContextDrawGlyphsAtPoint(...) instead, but cannot figure how to get the glyphs to to draw. I tried just using the bare string, but am getting this error. > > CGContextShowGlyphsAtPoint(c, 5, 5, self.string.cStringUsingEncoding_(NSUTF8StringEncoding), len(self.string)) > ValueError: depythonifying 'unsigned short', got 'str' > > Any ideas on how to achieve what I am trying to accomplish here? Any info would be much appreciated. A glyph array is different from a character array, you need to convert the string to a character array before calling CGContextShowGlyphsAtPoint. One of the examples in this stackoverflow question shows how to do this in Objective-C: http://stackoverflow.com/questions/4386367/drawing-text-with-core-graphics (look for CTFontGetGlyphsForCharacters). Ronald > > Thanks, > > Rand > > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG From randdvorak at gmail.com Mon Apr 29 16:15:03 2013 From: randdvorak at gmail.com (Rand Dvorak) Date: Mon, 29 Apr 2013 10:15:03 -0400 Subject: [Pythonmac-SIG] PyObjC and Quartz - CGContextShowGlyphsAtPoint Message-ID: <9BBACF76-9729-45C9-A743-1EC0F953C8D8@gmail.com> See the second message with more specifics and code, I was able to get it working by translating this objective-c code: http://www.gogo-robot.com/2009/06/07/two-awkward-things-about-iphone-development/ into this code: def draw(self,c): length = len(self.string) glyphs = objc.allocateBuffer(length) chars = objc.allocateBuffer(length + 1) self.string.getCString_maxLength_encoding_(chars, length + 1, NSASCIIStringEncoding) for i in range(length): glyphs[i] = chr(ord(chars[i]) - 29) CGContextSaveGState(c) CGContextSetFont(c, self.font) CGContextSetFontSize(c, self.size) CGContextSetRGBFillColor(c, 0, 0, 0, 1) CGContextSetRGBStrokeColor (c, 0, 0, 0, 1) CGContextSetTextMatrix (c, self.xform) CGContextShowGlyphsAtPoint(c, 0, 0, glyphs, length) CGContextRestoreGState(c) changing: CGContextShowGlyphsAtPoint(c, 0, 0, glyphs, length) to: CGContextShowGlyphsAtPoint(c, 0, 0, tuple(map(ord, glyphs)), length) Sadly, CTFontGetGlyphsForCharacters(...), doesn't seem to be in the bridgesupport on 10.6 and I still need to support it. A CGGlyph is apparently an unsigned short, so a char array returned by objc.allocateBuffer() seems to suffice. Thanks for your help. -------------- next part -------------- An HTML attachment was scrubbed... URL: From samueljohn.de at gmail.com Sun Apr 7 09:18:50 2013 From: samueljohn.de at gmail.com (Samuel John) Date: Sun, 07 Apr 2013 07:18:50 -0000 Subject: [Pythonmac-SIG] Good way for beginner to get started with Python? In-Reply-To: References: <20130406232207.GA500@cox.net> Message-ID: Hi Python is an excellent choice. More important than a good editor is ipython to interactively try out stuff and explore. My Editor is SublimeText (it's not free) but before that, I was happy with Text Wrangler. I hear that Text Mate 2 gets better. Some use IDLE for teaching, but I don't like the look. On 07.04.2013, at 02:13, Chris Weisiger wrote: > My recommendation would be to go with PyGame, but as you note this does require some installation work. Unfortunately as soon as you start getting into being a software developer, the kid gloves come off and you have to learn a lot about how software works. I'm not aware of any one-stop user-friendly installer that will get you up and running in Python with an eye towards games. My best advice is to do the installation for him. > > -Chris > > > On Sat, Apr 6, 2013 at 4:22 PM, John Velman wrote: > I've looked at PyGames, and done a little other googling, and every place > I've looked says install this, install that, use Home Brew, use Ports, > don't use Ports, be sure and set such and such an option, be sure and get a > version greater than x.y...Things that I might do, but I've been at this, > at least part time, more or less forever. I happen to be a homebrew core dev and additionally I maintain a [special set of python software](https://github.com/samueljohn/homebrew-python) that is otherwise hard to install because of the dependencies. Among other things I have PyGame in there. So if you give [homebrew](http://brew.sh) a chance: * Install as written on http://brew.sh: ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)" * brew tap samueljohn/python # making my python formulae available * brew install python * brew install gfortran * pip install nose # nose is not in Homebrew because its lightweight pure python * brew tap homebrew/headonly # needed for smpeg. Homebrew will * brew install pygame > We need something than one can just do, and then learn while doing. Well, > something Mac like. We hope to make homebrew as Mac like as a command line tool can get :-) Feel free to mail me personally or ping me on twitter if you encounter difficutlies in the install steps outlined above. cheers, Samuel From bcollier at mail.sdsu.edu Mon Apr 8 21:06:47 2013 From: bcollier at mail.sdsu.edu (Boyd Collier) Date: Mon, 08 Apr 2013 19:06:47 -0000 Subject: [Pythonmac-SIG] possible interaction between python Message-ID: <31DDE31C-2E16-4ED4-BC92-7E182883A089@mail.sdsu.edu> Hello All, In late February, I thought I'd give python a try, so I took steps to run it on my Mac. Unfortunately, I didn't keep a good record of what those steps were, but the installation seemed to be successful, in that I was able to run a few simple python programs. However, I now suspect that installing python may have messed up something needed to work with my objective-c programs with Xcode. The symptom of a problem in Xcode is that when I set an Xcode project to use LLDB as the debugger (this is the default debugger), Xcode immediately crashes when the run button in the project window is hit. However, projects run properly when I change the debugger to be used to GDB. At least initially, there was no indication that this problem had anything to do with python. I filed an Xcode bug report with Apple and have been following the steps suggested by Apple engineers to try to track down the problem. This morning, they asked me to run the command /Applications/Xcode.app/Contents/Developer/usr/bin/lldb /bin/ls from the terminal, which I did. Here is the result: > Macintosh:~ bcollier$ /Applications/Xcode.app/Contents/Developer/usr/bin/lldb /bin/ls > dyld: Library not loaded: /System/Library/Frameworks/Python.framework/Versions/2.7/Python > Referenced from: /Applications/Xcode.app/Contents/Developer/usr/bin/../../../SharedFrameworks/LLDB.framework/LLDB > Reason: image not found > Trace/BPT trap: 5 My (perhaps erroneous) recollection is that I installed python 3.3, and I see that what is not being loaded is 2.7. I've sent this result to Apple, but perhaps those of you who have been working with python on the Mac and using Xcode might have experienced a similar problem and might be able to suggest what is going on. I'm running OSX 10.7.5 and Xcode 4.6 (but first had the problem with Xcode 4.2). Thanks very much, Boyd Collier Prof. of Biology, Emeritus San Diego State University From chris.barker at noaa.gov Fri Apr 12 22:48:14 2013 From: chris.barker at noaa.gov (Chris Barker - NOAA Federal) Date: Fri, 12 Apr 2013 20:48:14 -0000 Subject: [Pythonmac-SIG] py2app questions.. In-Reply-To: References: Message-ID: OK, I've run py2app with --xref. I've enclosed the html output. Again, this app uses: > wxPython > numpy > matplotlib (and a few other stdlib packages...) I've learned a few things from this. 1) this is odd: right near the top, I see: prescript.py imports: Image that's the prescript for the PIL recipe -- I"m not using PIL, it seems it's runnign nthe recipe, and using what the recipe imported -- not good. 2) do I need all of Carbon? Carbon imports: warnings imported by: Carbon.AE Carbon.Appearance Carbon.AppleEvents Carbon.CarbonEvents Carbon.ControlAccessor Carbon.Controls Carbon.Ctl Carbon.Dialogs Carbon.Dlg Carbon.Dragconst Carbon.Events Carbon.Evt Carbon.File Carbon.Files Carbon.Menu Carbon.Qd Carbon.QuickDraw Carbon.Res Carbon.TextEdit Carbon.Win Carbon.Windows EasyDialogs aepack aetools macostools macresource plistlib I'm guessing py2ap uses plistlib, or something... 3) Matplotlib has multipel back-ends -- that's why I'm getting TK stuff (and from there, Carbon?): FileDialog imports: Dialog Tkinter fnmatch os imported by: matplotlib.backends.backend_tkagg An idea how to tweak the MPL recipe to only pull in the backend we need? is there a way to pass options to he recipes? 4) Ipython is getting pulled in my Matplotlib too: IPython imports: .... IPython.zmq matplotlib.sphinxext.ipython_directive which explains the zmq.so ( and a lot of other stuff -- iPython pulls in a lot ) 5) It looks like Image is getting pulled in a couple places: ... docutils.parsers.rst.directives.images docutils.writers.html4css1 prescript.py scipy.misc.pilutil docutils, prescript, and scipy (not sure why scipy is pulled in yet, I removed that dependency...) 6)OpenGL imported by: IPython.lib.inputhookglut .... so that's getting pulled in by IPython, which is pulled in by MPL... ( I think ) (wow! OPenGL sure has a lot of modules!) 7) bsddb seems to be recusively importing itself... bsddb imports: UserDict _bsddb bsddb.dbutils collections os warnings weakref imported by: bsddb.db bsddb.dbutils dbhash bsddb.db imports: _bsddb bsddb imported by: bsddb.dbutils bsddb.dbutils imports: bsddb bsddb.db time imported by: bsddb .... OK, I'm getting bored. A lot of this is really caused by Matplotlib -- which make some sense, it's been designed to be a developers tool (or at least to be used interactively), with all sorts of options, determined at run-time. Is there a way to turn off a recipe other than removing ot from my py2app install? This is making me think that the MPL recipe should pull in the MPL package, but not scan it for dependencies... Still not sure about PIL -- but I wouldn't be surprised if MPL is involved somehow! -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov -------------- next part -------------- A non-text attachment was scrubbed... Name: RiverDilution.html.zip Type: application/zip Size: 206316 bytes Desc: not available URL: