Re: [Pythonmac-SIG] py2app not including /Library/Python/2.6/site-packages
Am 2011-01-24 um 02:53 schrieb michael ferraro: how about I do a sys.path.append (/Library/Python/2.6/site-packages) in my main? How should such an absolute path help in a py2app packaged app? Greetlings from Lake Constance! Hraban --- http://www.fiee.net https://www.cacert.org (I'm an assurer) ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] py2app not including /Library/Python/2.6/site-packages
it wont deploy without an installer but at least it runs! m On Jan 24, 2011, at 3:30 AM, Henning Hraban Ramm wrote: Am 2011-01-24 um 02:53 schrieb michael ferraro: how about I do a sys.path.append (/Library/Python/2.6/site-packages) in my main? How should such an absolute path help in a py2app packaged app? Greetlings from Lake Constance! Hraban --- http://www.fiee.net https://www.cacert.org (I'm an assurer) ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] My first Python Program
Your main issue here wasn't with Python, but with Terminal; you didn't know how to use it to navigate your operating system and run files. You should check out Massimo's links for more information on that stuff. Terminal is basically like another version of the Finder: it can do everything the graphical interface can do, but it does it by typing commands into the command line instead of through the mouse and some keyboard shortcuts. Some tasks are easier with the Finder; others are easier with the commandline. It pays to be able to use both effectively. (Terminal gives you a Unix-style command prompt, by the way, so the syntax and many programs are the same if you're on OSX or Linux or Unix or BSD, etc.) -Chris On Sat, Jan 22, 2011 at 2:02 PM, John Parker park...@gmail.com wrote: Thanks to all for your help. I was able to successfully run my first program all be it was very simple. I have ordered a Python for Dummies book from Amazon but it hasn't arrived yet. I think that will help initially until I get familiar with this environment. Thank you all for your information and empowering me to run my program. Happy Python Programming to All!! Aloha, John On 1/22/11 11:47 AM, Massimo Di Stefano massimodisa...@gmail.com wrote: Hi John, to run a python (.py) file, from the shell type : python /path/to/your/file.py (just drug'n'drop the file inside the terminal shell) to know the directory where your shell is running type the command : pwd it will show you the path. to go inside the directory type : cd /path/to/the/directory this [1] is a simple list of the bash commands in osx : [1] http://ss64.com/osx/ and this [2] the standard python tutorial : [2] http://docs.python.org/tutorial/ you can also try to buy a book about python that will help you to get started there are a large number of book dedicated to python programming. Il giorno 22/gen/2011, alle ore 15.56, John Parker ha scritto: Hello All, I'm a complete novice to Python and I just created my first program for an assignment in a Python class that I'm taking at the local community college. The instructor didn't give us a book so, I'm trying to figure out one important item. How to run my program. I know this is so basic for everyone but I just started this class and this is my first exposure ever to this type of environment. I have an iMac, running python V2.6.1 My program is located in this directory: File location: /Users/parkjv1/Birth_Month.py When I open the terminal: I'm presented with this info: cpe-66-75-97-27: ~parkjv1$ Is this my /users/parkjv1 directory? When I type my file name Birth_Month.py I get an error indicating that command not found. So, where do I call my program so that it will run? Thanks, John ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG On 1/21/11 8:40 AM, Bill Janssen jans...@parc.com wrote: Charles Hartman co...@conncoll.edu wrote: it would seem to be short-sighted for anyone interested in Python on the Mac not to support py2app as fully as possible. You calling me short-sighted, Charles? That's OK -- it's true, you know; I've been wearing thick glasses since I was a kid :-). But I don't know that it has much to do with py2app. I think py2app is great, and I believe I even used it, once -- wanted to make a Preference Pane with Python, and couldn't figure out how to do it otherwise. But in general I've not needed it -- I just use Xcode and the system Python, and there's no need to bundle another Python with that approach. I should probably figure out how to use py2app with that approach, though; it might be more bullet-proof. Bill ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] py2app not including /Library/Python/2.6/site-packages
Michael, I'm not sure what problem you are reporting? But some of those paths on sys.path look suspicious to me: /usr/Extras/lib/python, for instance. Might want to look into how those got on your sys.path. Also, in last week's discussion, we didn't really cover setuptools and easy_install, as they're not Mac-specific. But, after years of fighting with setuptools (easy_install is a part of that), trying to get it to do what I need done, my advice would be to steer clear of using it, as well. It's not clear how it will interact with the other package control systems you mention, such as MacPorts and pypm. Bill michael ferraro mich...@possibleworlds.com wrote: I have seen various posts regarding this problem over the years but I flummoxed by how I got here and what to do now that I am. I am running MacOS X 10.6.6 I started out using the system python 2.6. I built the 3d extensions (PyQt, numpy, PyOpenGL c) and they are installed in /Library/Python/2.6/site-packages As I expected. My app runs fine when invoked directly from the Terminal. Poor internet search results trying to locate and install py2app resulted in the installation of ActiveStates pypm and Macports hg along with some variants of easy_install. These missteps seem to have installed another version of python 2.6 in the path of /Library/Frameworks/Python.framework chain with it own site-packages folder. As a result my installed 3d party extension were no longer found when starting the app from the Terminal. Once I removed this framework. and the .local folder created in my home folder. I also removed the .profile file that was modified (created) by one of the previous installs. I discovered some installed put a python in /usr/local/bin and removed it. I tested my app from the Terminal and all was good again. The sys.path variable prints the expected site-packages. ['/Users/mef/Development/-Applications-/Teatro', '/Library/Python/2.6/site-packages/setuptools-0.6c12dev_r88124-py2.6.egg', '/Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg', '/Library/Python/2.6/site-packages/macholib-1.3-py2.6.egg', '/Library/Python/2.6/site-packages/modulegraph-0.8-py2.6.egg', '/Library/Python/2.6/site-packages/altgraph-0.7.0-py2.6.egg', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python26.zip', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload', '/Library/Python/2.6/site-packages', '/Library/Python/2.6/site-packages/PIL', '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/PyObjC', '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/wx-2.8-mac-unicode'] After I run python setup.py py2app I run dist/Teatro.app and the sys.path contents printed to the console looks like this: 1/23/11 1:07:09 PMcom.apple.launchd.peruser.501[420] ([0x0-0xec0ec].org.pythonmac.unspecified.Teatro[25180]) Exited with exit code: 255 1/23/11 1:07:23 PM[0x0-0xf20f2].org.pythonmac.unspecified.Teatro[25233] ['/Users/mef/Development/-Applications-/Teatro', 1/23/11 1:07:23 PM[0x0-0xf20f2].org.pythonmac.unspecified.Teatro[25233] '/Users/mef/Development/-Applications-/Teatro/dist/Teatro.app/Contents/Resources', 1/23/11 1:07:23 PM[0x0-0xf20f2].org.pythonmac.unspecified.Teatro[25233] '/Users/mef/Development/-Applications-/Teatro/dist/Teatro.app/Contents/Resources', 1/23/11 1:07:23 PM[0x0-0xf20f2].org.pythonmac.unspecified.Teatro[25233] '/usr/lib/python26.zip', 1/23/11 1:07:23 PM[0x0-0xf20f2].org.pythonmac.unspecified.Teatro[25233] '/usr/lib/python2.6', 1/23/11 1:07:23 PM[0x0-0xf20f2].org.pythonmac.unspecified.Teatro[25233] '/usr/lib/python2.6/plat-darwin', 1/23/11 1:07:23 PM[0x0-0xf20f2].org.pythonmac.unspecified.Teatro[25233] '/usr/lib/python2.6/plat-mac', 1/23/11 1:07:23 PM[0x0-0xf20f2].org.pythonmac.unspecified.Teatro[25233] '/usr/lib/python2.6/plat-mac/lib-scriptpackages', 1/23/11 1:07:23 PM[0x0-0xf20f2].org.pythonmac.unspecified.Teatro[25233] '/usr/Extras/lib/python', 1/23/11 1:07:23 PM[0x0-0xf20f2].org.pythonmac.unspecified.Teatro[25233] '/usr/lib/python2.6/lib-tk', 1/23/11 1:07:23 PM[0x0-0xf20f2].org.pythonmac.unspecified.Teatro[25233]
Re: [Pythonmac-SIG] My first Python Program
I'm a complete novice to Python and I just created my first program for an assignment in a Python class that I'm taking at the local community college. Hi John, Welcome the user group! I'm presented with this info: cpe-66-75-97-27: ~parkjv1$ Is this my /users/parkjv1 directory? Yes it is. When I type my file name Birth_Month.py I get an error indicating that command not found. There are many different ways to do this, but for now I think the best idea would be to type $ python Birth_Month.py To tell the terminal that you want Python to run your program. I hope that helps, after the initial learning curve I think you'll find learning python and programming hugely rewarding! Good luck and stay in touch. Dan Daniel O'Donovan dan.odono...@gmail.com ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
[Pythonmac-SIG] How to get a Mac OS X version of Tcl/Tk rather than X11 version.
I have an installation of Python 2.6.4 on my MacBook Pro (OS X 10.6) that by default uses X11 windows and dialogs rather than the Mac version of those GUI items. In my googling and exchanges on other support groups I've come down to the problem may be with the Tcl/Tk installation using the generic X11 GUI rather than the Mac version. Does anyone know how I can change that in the Tk part of the python framework? I think this problem came up in the iPython email list, but I didn't get enough info from the messages there. More Info: The python framework is part of the SAGE package which I installed from source. I did this on my Mac Pro (system 10.4) and it works well with Mac windows for matplotlib and Mac open/save dialogs for Tk calls. But on my MacBook Pro I get X11 windows and dialogs. I want the Mac versions. Even more info: If you're interested, below is the original message I put up on the SAGE support group and was told it's a problem with the type of Tcl/Tk installed. -- Lou Pecora, my views are my own. -- I have an installation of SAGE (from source) on my Mac laptop in which using the tcl/tk library to plot (using TKAgg backend) or call tk file open/save dialogs calls the X11 versions and not the native Mac versions of dialogs and windows. I want to get the Mac versions. I posted about this on this list recently and now after a response here and much googling I have the sense that the problem is that I have a SAGE package with an X11 version of the tk library rather than the Mac one. I compiled SAGE from source on my Mac laptop. That went perfectly. I don't know how I got the X11 version since I also compiled SAGE from source on my Mac desktop where the plotting and file dialogs are the correct Mac versions, not X11. The only difference is that the laptop is Mac OS X 10.6 and the desktop is 10.4. If that matters, I don't know. Does anyone know how to get the Mac version installed in the SAGE source-compile installation? I have not found an answer to this elsewhere. I'm hoping someone here knows how this is done with the source installation. Thanks for any help or pointers. -- Lou Pecora ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
[Pythonmac-SIG] Determining if I need an import
I've inherited a large codebase that is practically the definition of legacy, with all that entails. I've spent a lot of time removing unused code, renaming variables, creating classes, moving global variables to locals (let's stuff all our program state into a single module and then just import that whenever we want to access it!), and so on, and now I want to start cleaning up the dependency chains between different modules. There's several places where I've had to move an import statement from being at the top of the module to being inside a function right before it's used, to prevent circular dependencies from causing imports to fail at program start. I wouldn't be surprised if I've rendered many of these imports moot, but short of a fair amount of painful grepping across ~20k lines of Python, I don't know of an easy way to find them. Is there a tool that examines your actual and apparent dependencies? I know there are programs that will generate dependency graphs, but for those there's little difference between a tight coupling and a single import statement that isn't actually needed. (Though if you'd care to recommend a dependency graph generator, I'd like to hear about that too) -Chris ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] My first Python Program
Thanks for the info Chris. Yes, I have a lot to learn. Happy Python Programming! Aloha, John On 1/24/11 6:13 AM, Chris Weisiger cweisi...@msg.ucsf.edu wrote: Your main issue here wasn't with Python, but with Terminal; you didn't know how to use it to navigate your operating system and run files. You should check out Massimo's links for more information on that stuff. Terminal is basically like another version of the Finder: it can do everything the graphical interface can do, but it does it by typing commands into the command line instead of through the mouse and some keyboard shortcuts. Some tasks are easier with the Finder; others are easier with the commandline. It pays to be able to use both effectively. (Terminal gives you a Unix-style command prompt, by the way, so the syntax and many programs are the same if you're on OSX or Linux or Unix or BSD, etc.) -Chris On Sat, Jan 22, 2011 at 2:02 PM, John Parker park...@gmail.com wrote: Thanks to all for your help. I was able to successfully run my first program all be it was very simple. I have ordered a Python for Dummies book from Amazon but it hasn't arrived yet. I think that will help initially until I get familiar with this environment. Thank you all for your information and empowering me to run my program. Happy Python Programming to All!! Aloha, John On 1/22/11 11:47 AM, Massimo Di Stefano massimodisa...@gmail.com wrote: Hi John, to run a python (.py) file, from the shell type : python /path/to/your/file.py (just drug'n'drop the file inside the terminal shell) to know the directory where your shell is running type the command : pwd it will show you the path. to go inside the directory type : cd /path/to/the/directory this [1] is a simple list of the bash commands in osx : [1] http://ss64.com/osx/ and this [2] the standard python tutorial : [2] http://docs.python.org/tutorial/ you can also try to buy a book about python that will help you to get started there are a large number of book dedicated to python programming. Il giorno 22/gen/2011, alle ore 15.56, John Parker ha scritto: Hello All, I'm a complete novice to Python and I just created my first program for an assignment in a Python class that I'm taking at the local community college. The instructor didn't give us a book so, I'm trying to figure out one important item. How to run my program. I know this is so basic for everyone but I just started this class and this is my first exposure ever to this type of environment. I have an iMac, running python V2.6.1 My program is located in this directory: File location: /Users/parkjv1/Birth_Month.py When I open the terminal: I'm presented with this info: cpe-66-75-97-27: ~parkjv1$ Is this my /users/parkjv1 directory? When I type my file name Birth_Month.py I get an error indicating that command not found. So, where do I call my program so that it will run? Thanks, John ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG On 1/21/11 8:40 AM, Bill Janssen jans...@parc.com wrote: Charles Hartman co...@conncoll.edu wrote: it would seem to be short-sighted for anyone interested in Python on the Mac not to support py2app as fully as possible. You calling me short-sighted, Charles? That's OK -- it's true, you know; I've been wearing thick glasses since I was a kid :-). But I don't know that it has much to do with py2app. I think py2app is great, and I believe I even used it, once -- wanted to make a Preference Pane with Python, and couldn't figure out how to do it otherwise. But in general I've not needed it -- I just use Xcode and the system Python, and there's no need to bundle another Python with that approach. I should probably figure out how to use py2app with that approach, though; it might be more bullet-proof. Bill ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org
Re: [Pythonmac-SIG] py2app not including /Library/Python/2.6/site-packages
Thank you all for your attention to this matter. I should clarify- My apps are used in intense live animation production applications. Having an app the runs like an app, can be executed from the dock and in all aspects seems like a real Mac- app, for me, makes it possible to experiment with new models of media production. This is my stock-and-trade. While --I --can run the app as a python script and deal with the strange python menu that shows up. Not everyone can. In the heat of production having an bundled app w/ icons c., makes our situation much less stressful and much less prone to error. So,...py2app. It looks like an app, smells like app and, most importantly acts like an app. It may be a small quality in an app. but it is a very important quality in an app for what I do. Adding insult to injury, I am constantly in development. So ... I am never ready to commit (no pun intended). I need to fix things at a crucial moment. I need to add a featur that no one anticipated. I can't be rigid and orthodox here py2app is 99.9 percent exactly what I need. It it excellent and has been a terrific help to me a and to the the community. I just got lost and frustrated in the morass of development. Using Apple's installed python means one less install and, one less opportunity for problem. It is probably shortsighted. Given everything, installing a python.org version of python might make things more consistent and easier. thans again -- m On Jan 24, 2011, at 11:55 AM, Christopher Barker wrote: On 1/24/11 6:10 AM, michael ferraro wrote: it wont deploy without an installer but at least it runs! I suppose so -- but what's the point? If you want to have a program run only with a python install like yours, you don't need py2app... It's still unclear to me what py2app is expected to be able to do with Apple's Python. but in practice, we generally use it with the python.org installer, as that gets you a fully independent app bundle. In theory, you can build an app this way on 10.6, and it can run on 10.3.9 and above. In practice, all your user-installed packages have to be built for 10.3.9 and above, too, and that is a bit tricky. However, most folks building binaries are trying to support that, so it certainly can work. I don't know bout QT, though -- I don't use it. If you want to continue with Apple's python, you might try: 1) adding the extra stuff in as required packages in your setup.py or 2) writing some post-flight code into your setup.py that copies what you need into the app bundle --it's just a well-structured directory, after all. good luck! -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/ORR(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception chris.bar...@noaa.gov ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG