Re: [Pythonmac-SIG] LXML with py2app
On Thu, Aug 7, 2008 at 11:18 PM, Christopher Barker <[EMAIL PROTECTED]> wrote: > Kenneth Miller wrote: >> >>How can I build python to link to the OS X Tkinter libraries? That's >> the ONLY reason I'm using the system python. I usually use the python built >> by macports. > > I'm pretty sure the build you get from python.org works fine with Tkinter -- > it is well integerated with OS-X, rather than separate and "unixy" like > macports and fink. i used the python.org build for exactly this (a script using Tkinter) and it worked great. cheers, Mike ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Yet another problem with path
Thank you! This solved it for me. I knew it had to be something as ridiculously n00bish as keeping "python" in the script call. On 07/08/2008, at 9:58 PM, Mike Covill wrote: You should be able to execute your script by typing just your script name from anywhere, leave out "python": Administrator:~ pascal$ test.py in this case test.py is the 'executable', and your system will look for it using your PATH setting. ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] LXML with py2app
Kenneth Miller wrote: How can I build python to link to the OS X Tkinter libraries? That's the ONLY reason I'm using the system python. I usually use the python built by macports. I'm pretty sure the build you get from python.org works fine with Tkinter -- it is well integerated with OS-X, rather than separate and "unixy" like macports and fink. -Chris ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] LXML with py2app
Chris, How can I build python to link to the OS X Tkinter libraries? That's the ONLY reason I'm using the system python. I usually use the python built by macports. Regards, Ken On Aug 7, 2008, at 3:59 PM, Chris Barker wrote: Kenneth Miller wrote: This is what I'm encountering. Here i printed the sys.path, why does this include modules local to the machine? I want it to be independent of any local resources? '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/ python2.5', This is Apple's installed python. by default, if you run py2app with Apple's system python, it will link to that, rather than embedding all of python with it. I don't know if you can override that, but if you want your app bundle to run on pre 10.5 machines, you need to install the python.org python, and use that. py2app will embed the whole thing in your app bundle, and it should run on any max, OS-X 10.3.9 and above. I don't know if there are any special issues with LXML, but I'd get a simple app with only the standard library working first, and then try your full app. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [EMAIL PROTECTED] ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] LXML with py2app
Kenneth Miller wrote: This is what I'm encountering. Here i printed the sys.path, why does this include modules local to the machine? I want it to be independent of any local resources? '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5', This is Apple's installed python. by default, if you run py2app with Apple's system python, it will link to that, rather than embedding all of python with it. I don't know if you can override that, but if you want your app bundle to run on pre 10.5 machines, you need to install the python.org python, and use that. py2app will embed the whole thing in your app bundle, and it should run on any max, OS-X 10.3.9 and above. I don't know if there are any special issues with LXML, but I'd get a simple app with only the standard library working first, and then try your full app. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [EMAIL PROTECTED] ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
[Pythonmac-SIG] pragma mark with python in xcode?
Anybody know how to make #pragma mark work with python in xcode? dan ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
[Pythonmac-SIG] LXML with py2app
Has anyone had success with this? This is what I'm encountering. Here i printed the sys.path, why does this include modules local to the machine? I want it to be independent of any local resources? 8/7/08 2:22:55 PM ['/Users/xkenneth/work/mwdconfig/tkpyro/dist/ MWDConfig.app/Contents/Resources', '/Users/xkenneth/work/mwdconfig/ tkpyro/dist/MWDConfig.app/Contents/Resources', '/System/Library/ Frameworks/Python.framework/Versions/2.5/lib/python25.zip', '/System/ Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5', '/ System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/ 2.5/lib/python2.5/plat-mac', '/System/Library/Frameworks/ Python.framework/Versions/2.5/lib/python2.5/plat-mac/lib- scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/ 2.5/Extras/lib/python', '/System/Library/Frameworks/Python.framework/ Versions/2.5/lib/python2.5/lib-tk', '/System/Library/Frameworks/ Python.framework/Versions/2.5/lib/python2.5/lib-dynload', '/Users/ xkenneth/work/mwdconfig/tkpyro/dist/MWDConfig.app/Contents/Resources/ lib/python2.5/site-packages.zip', '/Users/xkenneth/work/mwdconfig/ tkpyro/dist/MWDConfig.app/Contents/Resources/Python/site-packages'] [0x0-0x59059].org.pythonmac.unspecified.MWDConfig[1483] Here's the traceback of the error. 8/7/08 2:22:55 PM Traceback (most recent call last): [0x0-0x59059].org.pythonmac.unspecified.MWDConfig[1483] 8/7/08 2:22:55 PM File "/Users/xkenneth/work/mwdconfig/tkpyro/dist/ MWDConfig.app/Contents/Resources/__boot__.py", line 31, in [0x0-0x59059].org.pythonmac.unspecified.MWDConfig[1483] 8/7/08 2:22:55 PM _run('main.py') [0x0-0x59059].org.pythonmac.unspecified.MWDConfig[1483] 8/7/08 2:22:55 PM File "/Users/xkenneth/work/mwdconfig/tkpyro/dist/ MWDConfig.app/Contents/Resources/__boot__.py", line 28, in _run [0x0-0x59059].org.pythonmac.unspecified.MWDConfig[1483] 8/7/08 2:22:55 PM execfile(path, globals(), globals()) [0x0-0x59059].org.pythonmac.unspecified.MWDConfig[1483] 8/7/08 2:22:55 PM File "/Users/xkenneth/work/mwdconfig/tkpyro/dist/ MWDConfig.app/Contents/Resources/main.py", line 3, in [0x0-0x59059].org.pythonmac.unspecified.MWDConfig[1483] 8/7/08 2:22:55 PM from tkpyro import run [0x0-0x59059].org.pythonmac.unspecified.MWDConfig[1483] 8/7/08 2:22:55 PM File "tkpyro/__init__.pyc", line 2, in [0x0-0x59059].org.pythonmac.unspecified.MWDConfig[1483] 8/7/08 2:22:55 PM File "lxml/etree.pyc", line 18, in [0x0-0x59059].org.pythonmac.unspecified.MWDConfig[1483] 8/7/08 2:22:55 PM File "lxml/etree.pyc", line 15, in __load [0x0-0x59059].org.pythonmac.unspecified.MWDConfig[1483] 8/7/08 2:22:55 PM ImportError: '/System/Library/Frameworks/ Python.framework/Versions/2.5/lib/python2.5/lib-dynload/lxml/etree.so' not found [0x0-0x59059].org.pythonmac.unspecified.MWDConfig[1483] 8/7/08 2:22:55 PM MWDConfig Error MWDConfig[1483] 8/7/08 2:22:55 PM MWDConfig Error An unexpected error has occurred during execution of the main script ImportError: '/System/Library/Frameworks/Python.framework/Versions/2.5/ lib/python2.5/lib-dynload/lxml/etree.so' not found MWDConfig[1483] So it's looking for etree.so here: /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ lib-dynload/lxml/etree.so But it exists here in the app: ./Contents/Resources/lib/python2.5/lib-dynload/lxml Note: I'm using __import__ in certain sections of my code, but it's choking before it gets to this. Anyone have any ideas? Regards, Ken ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
[Pythonmac-SIG] python 2.6 trunk
Hi, I'm trying to rebuild my 4-way universal framework build of python 2.6 using the latest revision in the trunk. I got a compile error due to a redefinition of FSIORefNum in some of the Mac/Modules files (see svn diff output at end of email). After changing that, I still get a problem running 'make test' at 'test_array'. My machine starts grinding away and the resident memory of the python process goes through the roof. I went ahead and tried 'make install' anyway, and got the problem below, which looks like a simple error in a config file. Has anybody seen these problems or have any suggestions? I may just need to roll it back to Ronald's revision (63955), but I thought I would try a more recent version. Thanks, Chris python-trunk/build: arch -386 -ppc ../python.exe ../../Mac/scripts/ cachersrc.py -v /Library/Frameworks/Python64.framework/Versions/2.6/ lib/python2.6/plat-mac /Library/Frameworks/Python64.framework/Versions/ 2.6/Mac/Tools arch: Unknown architecture: 386 Index: Mac/Modules/MacOS.c === --- Mac/Modules/MacOS.c (revision 65574) +++ Mac/Modules/MacOS.c (working copy) @@ -30,10 +30,6 @@ #include #include -#ifndef HAVE_MACOS105_SDK -typedef SInt16 FSIORefNum; -#endif - static PyObject *MacOS_Error; /* Exception MacOS.Error */ #define PATHNAMELEN 1024 Index: Mac/Modules/file/_Filemodule.c === --- Mac/Modules/file/_Filemodule.c (revision 65574) +++ Mac/Modules/file/_Filemodule.c (working copy) @@ -7,10 +7,6 @@ #include "pymactoolbox.h" -#ifndef HAVE_MACOS105_SDK -typedef SInt16 FSIORefNum; -#endif - /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ PyErr_SetString(PyExc_NotImplementedError, \ ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Yet another problem with path
On Thu, Aug 7, 2008 at 9:48 AM, Chris Barker <[EMAIL PROTECTED]> wrote: > Timothy Grant wrote: > >> While command lines can be made to lie, it concerns me that it looks >> like you're using and Administrator account to do all this work. >> Administrators have far to much power and can do far too much damage >> far too quickly. > > very true. However, OS-X be default does not allow anyone to log in as root. > An "Administrator" is someone that is allowed to use sudo to do > administrative tasks, so he's probably safe. > > Do be careful with sudo though! > > -Chris Wow Chris, I've been using this PowerBook for nigh-unto four years now, vast quantities of that time at the command prompt and I didn't know that (I thought they were synonymous). Thank you for teaching me something new. -- Stand Fast, tjg. [Timothy Grant] ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Yet another problem with path
Timothy Grant wrote: While command lines can be made to lie, it concerns me that it looks like you're using and Administrator account to do all this work. Administrators have far to much power and can do far too much damage far too quickly. very true. However, OS-X be default does not allow anyone to log in as root. An "Administrator" is someone that is allowed to use sudo to do administrative tasks, so he's probably safe. Do be careful with sudo though! -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [EMAIL PROTECTED] ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Yet another problem with path
On Thu, Aug 7, 2008 at 6:58 AM, Mike Covill <[EMAIL PROTECTED]> wrote: > > On 7-Aug-08, at 9:45 AM, Mike Covill wrote: > >> On 7-Aug-08, at 9:34 AM, Pascal Bompard wrote: >> >>> Returning to this 3 week old chestnut, (apologies for delay - my second >>> child was born in the interim), and thanks to all who attempted to help, but >>> I am still struggling with this issue. >>> Christopher Barker wrote: If you have scripts you want to run from anywhere, make them executable: >>> >>> This is exactly what I need to occur with this particular script >>> chmod a+x MyScript.py >>> >>> permissions are set to 755 (i.e. full permissions) >>> and put: #!usr/bin/env python at the top. >>> >>> yes, that is in place >>> Then either: put them in a standard place that should be on your PATH, like: /usr/local/bin or put the path to your scripts in your PATH -- often people use: ~/bin >>> >>> I actually have this in my PATH, >>> /Users/pascal/Documents/Python/Dev/myapp >>> >>> and with all the above I get: >>> >>> Administrator:~ pascal$ python test.py >>> >>> /System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python: >>> can't open file 'test.py': [Errno 2] No such file or directory >>> >>> whereas calling the script from within it's parent directory does work. >>> >>> What could I possibly be doing wrong here? >> >> Your PATH is only used to find the executable (python), not the document >> (test.py). The document must include either the relative path from where >> you are, or the absolute path. > > You should be able to execute your script by typing just your script name > from anywhere, leave out "python": > > Administrator:~ pascal$ test.py > > in this case test.py is the 'executable', and your system will look for it > using your PATH setting. > > Mike > >> >>> >>> do buy a book or surf the web for info about using the terminal on OS-X -- it's a great skill to have. >>> >>> You're right. I have recently acquired a great book called "From Bash to >>> Z-Shell", but it's tough to retain all the tricks when I use the terminal so >>> seldom. While command lines can be made to lie, it concerns me that it looks like you're using and Administrator account to do all this work. Administrators have far to much power and can do far too much damage far too quickly. Especially if you're writing code that might manipulate any files, I would strongly encourage you to use a regular user account for doing your real work and only log in as an administrator when required. Of course if the command line was lying about the type of account you're using completely ignore the previous paragraph. -- Stand Fast, tjg. [Timothy Grant] ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] module 'New' no in MacPython?
Bill Janssen wrote: There is a Python standard library module called "new", and the Mac filesystem is case-insensitive... Try doing % touch new % touch New % ls case-insensitive, yet case-preserving -- weird. apparently the case preserving does effect *nix apps like python. You can: import new but not: import New but if it's called "new" on other systems, why was the OP having problems? Matthew O'Meara wrote: Thanks for your quick response, It seems like the issue is due to running python in an X11 terminal. It seems to run fine through Terminal. I don't know if I'll dig into the problem, but that at least gives me somewhere to look first. Are you sure you're running the same python from the X11 terminal as from Terminal? is your PATH the same? Have you installed fink, macports, or some other python? -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [EMAIL PROTECTED] ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Yet another problem with path
On 7-Aug-08, at 9:45 AM, Mike Covill wrote: On 7-Aug-08, at 9:34 AM, Pascal Bompard wrote: Returning to this 3 week old chestnut, (apologies for delay - my second child was born in the interim), and thanks to all who attempted to help, but I am still struggling with this issue. Christopher Barker wrote: If you have scripts you want to run from anywhere, make them executable: This is exactly what I need to occur with this particular script chmod a+x MyScript.py permissions are set to 755 (i.e. full permissions) and put: #!usr/bin/env python at the top. yes, that is in place Then either: put them in a standard place that should be on your PATH, like: /usr/local/bin or put the path to your scripts in your PATH -- often people use: ~/bin I actually have this in my PATH, /Users/pascal/Documents/Python/Dev/myapp and with all the above I get: Administrator:~ pascal$ python test.py /System/Library/Frameworks/Python.framework/Versions/2.5/Resources/ Python.app/Contents/MacOS/Python: can't open file 'test.py': [Errno 2] No such file or directory whereas calling the script from within it's parent directory does work. What could I possibly be doing wrong here? Your PATH is only used to find the executable (python), not the document (test.py). The document must include either the relative path from where you are, or the absolute path. You should be able to execute your script by typing just your script name from anywhere, leave out "python": Administrator:~ pascal$ test.py in this case test.py is the 'executable', and your system will look for it using your PATH setting. Mike do buy a book or surf the web for info about using the terminal on OS-X -- it's a great skill to have. You're right. I have recently acquired a great book called "From Bash to Z-Shell", but it's tough to retain all the tricks when I use the terminal so seldom. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [EMAIL PROTECTED] ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Yet another problem with path
On 7-Aug-08, at 9:34 AM, Pascal Bompard wrote: Returning to this 3 week old chestnut, (apologies for delay - my second child was born in the interim), and thanks to all who attempted to help, but I am still struggling with this issue. Christopher Barker wrote: If you have scripts you want to run from anywhere, make them executable: This is exactly what I need to occur with this particular script chmod a+x MyScript.py permissions are set to 755 (i.e. full permissions) and put: #!usr/bin/env python at the top. yes, that is in place Then either: put them in a standard place that should be on your PATH, like: /usr/local/bin or put the path to your scripts in your PATH -- often people use: ~/bin I actually have this in my PATH, /Users/pascal/Documents/Python/Dev/myapp and with all the above I get: Administrator:~ pascal$ python test.py /System/Library/Frameworks/Python.framework/Versions/2.5/Resources/ Python.app/Contents/MacOS/Python: can't open file 'test.py': [Errno 2] No such file or directory whereas calling the script from within it's parent directory does work. What could I possibly be doing wrong here? Your PATH is only used to find the executable (python), not the document (test.py). The document must include either the relative path from where you are, or the absolute path. Mike do buy a book or surf the web for info about using the terminal on OS-X -- it's a great skill to have. You're right. I have recently acquired a great book called "From Bash to Z-Shell", but it's tough to retain all the tricks when I use the terminal so seldom. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [EMAIL PROTECTED] ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Yet another problem with path
Returning to this 3 week old chestnut, (apologies for delay - my second child was born in the interim), and thanks to all who attempted to help, but I am still struggling with this issue. Christopher Barker wrote: If you have scripts you want to run from anywhere, make them executable: This is exactly what I need to occur with this particular script chmod a+x MyScript.py permissions are set to 755 (i.e. full permissions) and put: #!usr/bin/env python at the top. yes, that is in place Then either: put them in a standard place that should be on your PATH, like: /usr/local/bin or put the path to your scripts in your PATH -- often people use: ~/bin I actually have this in my PATH, /Users/pascal/Documents/Python/Dev/myapp and with all the above I get: Administrator:~ pascal$ python test.py /System/Library/Frameworks/Python.framework/Versions/2.5/Resources/ Python.app/Contents/MacOS/Python: can't open file 'test.py': [Errno 2] No such file or directory whereas calling the script from within it's parent directory does work. What could I possibly be doing wrong here? do buy a book or surf the web for info about using the terminal on OS-X -- it's a great skill to have. You're right. I have recently acquired a great book called "From Bash to Z-Shell", but it's tough to retain all the tricks when I use the terminal so seldom. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [EMAIL PROTECTED] ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig