From brian.wichmann at totalise.co.uk Tue May 1 11:03:20 2007
From: brian.wichmann at totalise.co.uk (Brian Wichmann)
Date: Tue, 1 May 2007 10:03:20 +0100
Subject: [Pythonmac-SIG] Using Python for cgi
Message-ID: <7A19DF31-9CD1-4BEE-80F6-6AAE48164C5D@totalise.co.uk>
Dear all,
I have prototyped a system using MySql and Python which needs to be
adjusted to use the HTML form data via a web server. I am on 10.4.
Hence I have put the following:
#!/usr/bin/python
Useful test program (cgitest.py):
#!/usr/bin/python
#cgitest.py
import os, cgi, sys
sys.stderr = sys.stdout
print "Content-type: text/html\r\n"
print cgi.print_environ()
print '
'
print os.environ
in the directory /Library/WebServer/CGI-Executables/ and made it
executable.
When I activate it via my HTML form, the result is to display the
source text of cgitest.py rather than execute it! I hope I have
followed correctly all the points mentioned in the previous email on
this list at
http://mail.python.org/pipermail/pythonmac-sig/2002-December/006954.html
Brian Wichmann.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20070501/3603cc2c/attachment.html
From david.warde.farley at utoronto.ca Tue May 1 11:17:12 2007
From: david.warde.farley at utoronto.ca (David Warde-Farley)
Date: Tue, 1 May 2007 05:17:12 -0400
Subject: [Pythonmac-SIG] Using Python for cgi
In-Reply-To: <7A19DF31-9CD1-4BEE-80F6-6AAE48164C5D@totalise.co.uk>
References: <7A19DF31-9CD1-4BEE-80F6-6AAE48164C5D@totalise.co.uk>
Message-ID:
On 1-May-07, at 5:03 AM, Brian Wichmann wrote:
> Dear all,
>
> I have prototyped a system using MySql and Python which needs to be
> adjusted to use the HTML form data via a web server. I am on 10.4.
Chances are Apache isn't set up to handle a .py as an executable.
Make sure you've got lines like
AddHandler cgi-script .cgi
AddHandler cgi-script .py
in /etc/httpd/httpd.conf (you might have the first one but not the
second, I can't remember what comes stock in OS X's apache configs)
Make sure the "LoadModule cgi_module ..." line is uncommented as well
as the "AddModule mod_cgi.c" line (search for them).
Once you're sure all this is in place, "sudo apachectl graceful" at a
prompt.
Cheers,
David
From brian.wichmann at totalise.co.uk Tue May 1 12:06:44 2007
From: brian.wichmann at totalise.co.uk (Brian Wichmann)
Date: Tue, 1 May 2007 11:06:44 +0100
Subject: [Pythonmac-SIG] Using Python for cgi
In-Reply-To:
References: <7A19DF31-9CD1-4BEE-80F6-6AAE48164C5D@totalise.co.uk>
Message-ID: <30D80F16-1768-4B37-9CD3-7E49FACA84E7@totalise.co.uk>
Thanks, David,
The position is:
On 1 May 2007, at 10:17, David Warde-Farley wrote:
> Chances are Apache isn't set up to handle a .py as an executable.
> Make sure you've got lines like
>
> AddHandler cgi-script .cgi
> AddHandler cgi-script .py
>
> in /etc/httpd/httpd.conf (you might have the first one but not the
> second, I can't remember what comes stock in OS X's apache configs)
Both were already done.
>
> Make sure the "LoadModule cgi_module ..." line is uncommented as
> well as the "AddModule mod_cgi.c" line (search for them).
Both already done.
>
> Once you're sure all this is in place, "sudo apachectl graceful" at
> a prompt.
This told me that the command passenv was not recognised as per
previous mail message. Hence
I deleted the two lines:
passenv PYTHONPATH
setenv PYTHONBUFFERED 1
(See http://mail.python.org/pipermail/pythonmac-sig/2002-December/
006954.html )
Unfortunately, I get the same response: the file cgitest.py is copied
to the browser window rather than being executed.
The error log gave:
Processing config directory: /private/etc/httpd/users/*.conf
[Tue May 1 10:55:07 2007] [notice] Apache/1.3.33 (Darwin) configured
-- resuming normal operations
[Tue May 1 10:55:07 2007] [notice] Accept mutex: flock (Default: flock)
(Nothing in the access log)
Brian.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20070501/c4d1528c/attachment.htm
From brian.wichmann at totalise.co.uk Tue May 1 10:56:28 2007
From: brian.wichmann at totalise.co.uk (Brian Wichmann)
Date: Tue, 1 May 2007 09:56:28 +0100
Subject: [Pythonmac-SIG] Using Python for cgi
Message-ID: <89E75DC8-9F27-4E70-B434-CB5BDAE51A6E@totalise.co.uk>
Dear all,
I have prototyped a system using MySql and Python which needs to be
adjusted to use the HTML form data via a web server. I am on 10.4.
Hence I have put the following:
#!/usr/bin/python
Useful test program (cgitest.py):
#!/usr/bin/python
#cgitest.py
import os, cgi, sys
sys.stderr = sys.stdout
print "Content-type: text/html\r\n"
print cgi.print_environ()
print '
'
print os.environ
in the directory /Library/WebServer/CGI-Executables/ and made it
executable.
When I activate it via my HTML form, the result is to display the
source text of cgitest.py rather than execute it! I hope I have
followed correctly all the points mentioned in the previous email on
this list at
http://mail.python.org/pipermail/pythonmac-sig/2002-December/006954.html
Brian Wichmann.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20070501/f2a731d4/attachment.htm
From vivacarlie at gmail.com Thu May 3 06:15:50 2007
From: vivacarlie at gmail.com (Nehemiah Dacres)
Date: Wed, 2 May 2007 23:15:50 -0500
Subject: [Pythonmac-SIG] looking for a python Mac developer for
freelance work
In-Reply-To: <497700600DF6A54EB1E369218E6FB0E4762208@logia-mail.logiamobile.com>
References: <497700600DF6A54EB1E369218E6FB0E4762208@logia-mail.logiamobile.com>
Message-ID: <65fadfc30705022115k4a2c10d6s5adb73bb32ce1d9d@mail.gmail.com>
provided WxPy is installed on the user's mac, it should work fine. The
program can possibly install the appropriate dependancies for your
application as part of the installer. simply wrapping all the dependancies
(python version x.x, Wx version x.x other python dependancies) in a bundle
along with an applescript applet as a launcher and you're done.
On 4/25/07, Omri Reuter wrote:
>
> Hi,
>
>
>
> We have a very cool application written in python WX that we need ported
> to Macintosh. I'm looking for a freelance developer that has experience in
> Python on Mac and can take this projepuyct ASAP. I'm open to discuss any
> working model
>
> Regards,
>
>
>
> *Omri Reuter***
>
> * CTO** ***
>
> *EglooMedia*
>
> *omri at egloomedia.com*
>
> *+972-52-5556369***
>
> *+972-73-2525252***
>
>
>
> _______________________________________________
> Pythonmac-SIG maillist - Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
>
>
--
"lalalalala! it's not broken because I can use it"
http://linux.slashdot.org/comments.pl?sid=194281&threshold=1&commentsort=0&mode=thread&cid=15927703
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20070502/58a2520d/attachment.htm
From kent_quirk at cognitoy.com Thu May 3 06:48:14 2007
From: kent_quirk at cognitoy.com (Kent Quirk)
Date: Thu, 03 May 2007 00:48:14 -0400
Subject: [Pythonmac-SIG] looking for a python Mac developer
for freelance work
In-Reply-To: <65fadfc30705022115k4a2c10d6s5adb73bb32ce1d9d@mail.gmail.com>
References: <497700600DF6A54EB1E369218E6FB0E4762208@logia-mail.logiamobile.com>
<65fadfc30705022115k4a2c10d6s5adb73bb32ce1d9d@mail.gmail.com>
Message-ID: <4639698E.8090101@cognitoy.com>
Um...it's nice to think that way, and chances are the app largely works,
but porting isn't usually quite so sweet and easy.
Typically you have to deal with, to name just a few things:
* System defaults and where user files are stored
* Font, typeface, font size, layout tweaks
* Names and locations of some menu items
* Interaction with other apps on the system
* If you've built any custom modules, you have to make them build and work
* Building a deliverable package (py2app vs py2exe)
* Finding the full set of support modules and making them work
* Locating and storing the set of non-code assets (art, sound, etc)
* Installation / uninstallation
* Registration codes or whatever forms of DRM
If the original code was naive about platform issues, the task could be
... nontrivial.
Don't get me wrong, porting Python apps is hugely easier than porting
C/C++ apps. But even with WX, if you didn't code for portability it's
fairly easy to make something that needs effort to port properly.
Kent
Nehemiah Dacres wrote:
> provided WxPy is installed on the user's mac, it should work fine. The
> program can possibly install the appropriate dependancies for your
> application as part of the installer. simply wrapping all the
> dependancies (python version x.x, Wx version x.x other python
> dependancies) in a bundle along with an applescript applet as a
> launcher and you're done.
>
> On 4/25/07, *Omri Reuter* > wrote:
>
> Hi,
>
>
>
> We have a very cool application written in python WX that we need
> ported to Macintosh. I'm looking for a freelance developer that
> has experience in Python on Mac and can take this projepuyct ASAP.
> I'm open to discuss any working model
>
> Regards,
>
>
>
> */Omri Reuter/*/ /
>
> /*CTO*/*/ /**//*
>
> */EglooMedia/*
>
> /omri at egloomedia.com /
>
> /+972-52-5556369// /
>
> /+972-73-2525252// /
>
>
>
>
> _______________________________________________
> Pythonmac-SIG maillist - Pythonmac-SIG at python.org
>
> http://mail.python.org/mailman/listinfo/pythonmac-sig
>
>
>
>
> --
>
> "lalalalala! it's not broken because I can use it"
>
> http://linux.slashdot.org/comments.pl?sid=194281&threshold=1&commentsort=0&mode=thread&cid=15927703
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Pythonmac-SIG maillist - Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
>
--
------------------------------------------------------------
Kent Quirk I'm making a game about global warming.
Game Architect Track the progress at:
CogniToy http://www.cognitoy.com/meltingpoint
From ronaldoussoren at mac.com Thu May 3 10:59:58 2007
From: ronaldoussoren at mac.com (Ronald Oussoren)
Date: Thu, 3 May 2007 10:59:58 +0200
Subject: [Pythonmac-SIG] looking for a python Mac developer
for freelance work
In-Reply-To: <65fadfc30705022115k4a2c10d6s5adb73bb32ce1d9d@mail.gmail.com>
References: <497700600DF6A54EB1E369218E6FB0E4762208@logia-mail.logiamobile.com>
<65fadfc30705022115k4a2c10d6s5adb73bb32ce1d9d@mail.gmail.com>
Message-ID: <2E5CDF1B-C4C3-4B7C-AA36-918E7F6E777E@mac.com>
On 3 May, 2007, at 6:15, Nehemiah Dacres wrote:
> provided WxPy is installed on the user's mac, it should work fine.
> The program can possibly install the appropriate dependancies for
> your application as part of the installer. simply wrapping all the
> dependancies (python version x.x, Wx version x.x other python
> dependancies) in a bundle along with an applescript applet as a
> launcher and you're done.
There's more to proper porting than just running unaltered code,
you'll always have to do at least some tweaking to make the
application blend nicely with the platform.
But's not what I why I write this mail. The Righ Way (TM) to bundle
a python GUI application is by using py2app. This will build a
proper .app bundle that contains all resources that are needed for
running the application (Python code, C frameworks, images, ...).
Ronald
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3562 bytes
Desc: not available
Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20070503/f09e4343/attachment-0001.bin
From bejarar at sbcglobal.net Wed May 2 17:29:47 2007
From: bejarar at sbcglobal.net (Rafael Bejarano)
Date: Wed, 2 May 2007 10:29:47 -0500
Subject: [Pythonmac-SIG] Accessibility question
Message-ID: <8F6F58B4-C4E3-4E43-A7F6-A77BC50EDC06@sbcglobal.net>
Hello,
I am a blind Mac user, in the process of learning python on the Mac.
I use VoiceOver, a utility included with Tiger, to read, and to
interact with screen elements (e.g., icons, text boxes, etc.).
My reason for posting to this list is to ask if there is a native,
cocoa GUI toolkit written in python. VoiceOver cannot interact with
carbon applications,, so I don't think that I can use WXPython or
python card to build GUIs.
Cordially,
Rafael Bejarano
From delza at livingcode.org Thu May 3 22:29:10 2007
From: delza at livingcode.org (Dethe Elza)
Date: Thu, 3 May 2007 13:29:10 -0700
Subject: [Pythonmac-SIG] Accessibility question
In-Reply-To: <8F6F58B4-C4E3-4E43-A7F6-A77BC50EDC06@sbcglobal.net>
References: <8F6F58B4-C4E3-4E43-A7F6-A77BC50EDC06@sbcglobal.net>
Message-ID: <4C9321D9-3DA0-40E3-AF7C-808E32D63246@livingcode.org>
Hi Rafael,
> I am a blind Mac user, in the process of learning python on the Mac.
> I use VoiceOver, a utility included with Tiger, to read, and to
> interact with screen elements (e.g., icons, text boxes, etc.).
>
> My reason for posting to this list is to ask if there is a native,
> cocoa GUI toolkit written in python. VoiceOver cannot interact with
> carbon applications,, so I don't think that I can use WXPython or
> python card to build GUIs.
Yes indeed. The best way to create Mac applications is using the
PyObjC toolkit (http://pyobjc.sourceforge.net/) which lets you create
the interface using Interface Builder (which comes with the OS X
developer tools) and write the application code in Python, but still
interact with all of the Cocoa classes. There are tutorials on the
PyObjC website.
It is what I generally use for GUI applications. You can then build
them using py2app to get a standard Mac application and there is no
visible sign that your application is written in Python.
I hope that helps. If you have further questions about getting these
tools installed or set-up, or where to get started using them, don't
hesitate to ask.
Kind regards,
--Dethe
http://livingcode.org/
From gary.bernhardt at gmail.com Thu May 3 22:53:49 2007
From: gary.bernhardt at gmail.com (Gary Bernhardt)
Date: Thu, 3 May 2007 16:53:49 -0400
Subject: [Pythonmac-SIG] py2app's argv_emulation option breaks window
minimization
Message-ID: <9c34c72e0705031353m2320e139h9fc0b36010e23157@mail.gmail.com>
It seems that setting argv_emulation=True in the py2app options causes
minimized windows to break in the resulting app. When a window has been
minimized, it will never come back, and it won't respond to clicks in the
dock. This is very confusing: I don't see why argv emulation should break
window behavior, but it seems to.
I'm using py2app with PyObjC, so I'm not sure which, if either, is at
fault. My first guess would be py2app since it's a py2app option that
triggers the bug.
You can reproduce this with the PyObjC "creating your first application"
tutorial. Just add this to the setup() call in setup.py:
options={'py2app': {'argv_emulation': 1}},
Now, build the app, run it from Finder, minimize the window, and try to
restore it; it shouldn't work. However, if you run the binary
(dist/CurrencyConverter.app/Contents/MacOS/CurrencyConverter) directly,
minimizing WILL work.
Here are the relevant versions I'm using; all of them should be current:
OS X 10.4.9
Python 2.5
PyObjC 1.4
py2app 0.3.6
This bug isn't actually a problem for me now that I've figured out the
cause; I only had argv emulation enabled because my setup.py originally came
from an example. But it was quite tricky to track down, so hopefully this
will save someone else's time down the road. :)
--
Gary
http://blog.extracheese.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20070503/fe17f2be/attachment.htm
From boyle5 at llnl.gov Fri May 4 18:11:30 2007
From: boyle5 at llnl.gov (James Boyle)
Date: Fri, 4 May 2007 09:11:30 -0700
Subject: [Pythonmac-SIG] building extension problems on OS X python 2.5.1
Message-ID:
INTEL Mac OS X 10.4.9 Macpython 2.5.1
I am having trouble building extensions onto my MacPython 2.5.1.
The error for pynetcdf 0.7 is given below but I have had the same
error on two other packages.
It appears that the builds attempt to make a universal binary by
default and attempt to link to a library that I have built as i386
only.
The extent of my ignorance is that I would not even know how to build
a universal library if I wanted to.
These libraries HDF5 and netCDF4 have fairly complex build scripts.
I would like to be able to turn off the mechanism that is forcing a
universal build. The PPC part is a waste of space for me.
Of course, my interpretation of the error might be completely off base.
Appreciate any insight.
--Jim
[krait:~/Desktop/pynetcdf-0.7] boyle5% python setup.py build
running build
running config_fc
running build_src
building extension "pynetcdf._netcdf" sources
building data_files sources
running build_py
creating build
creating build/lib.macosx-10.3-fat-2.5
creating build/lib.macosx-10.3-fat-2.5/pynetcdf
copying ./__init__.py -> build/lib.macosx-10.3-fat-2.5/pynetcdf
copying ./NetCDF.py -> build/lib.macosx-10.3-fat-2.5/pynetcdf
copying ./netcdf_demo.py -> build/lib.macosx-10.3-fat-2.5/pynetcdf
running build_ext
customize UnixCCompiler
customize UnixCCompiler using build_ext
building 'pynetcdf._netcdf' extension
compiling C sources
C compiler: gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/
MacOSX10.4u.sdk -fno-strict-aliasing -Wno-long-double -no-cpp-precomp
-mno-fused-madd -fPIC -fno-common -dynamic -DNDEBUG -g -O3 -Wall -
Wstrict-prototypes
creating build/temp.macosx-10.3-fat-2.5
compile options: '-I/Users/boyle5/netcdf-3.6.2/include -I/Library/
Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/
numpy/core/include -I/Library/Frameworks/Python.framework/Versions/
2.5/include/python2.5 -c'
gcc: ./_netcdf.c
./_netcdf.c: In function 'PyNetCDFFile_Close':./_netcdf.c: In
function 'PyNetCDFFile_Close':
./_netcdf.c:965: warning: passing argument 2 of 'PyDict_Next' from
incompatible pointer type./_netcdf.c:965: warning: passing argument 2
of 'PyDict_Next' from incompatible pointer type
./_netcdf.c: In function 'PyNetCDFVariableObject_subscript':
./_netcdf.c:1822: warning: passing argument 3 of 'PySlice_GetIndices'
from incompatible pointer type
./_netcdf.c:1822: warning: passing argument 4 of 'PySlice_GetIndices'
from incompatible pointer type
./_netcdf.c:1822: warning: passing argument 5 of 'PySlice_GetIndices'
from incompatible pointer type
./_netcdf.c:1842: warning: passing argument 3 of 'PySlice_GetIndices'
from incompatible pointer type
./_netcdf.c:1842: warning: passing argument 4 of 'PySlice_GetIndices'
from incompatible pointer type
./_netcdf.c:1842: warning: passing argument 5 of 'PySlice_GetIndices'
from incompatible pointer type
./_netcdf.c: In function 'PyNetCDFVariableObject_subscript':
./_netcdf.c:1822: warning: passing argument 3 of 'PySlice_GetIndices'
from incompatible pointer type
./_netcdf.c:1822: warning: passing argument 4 of 'PySlice_GetIndices'
from incompatible pointer type
./_netcdf.c:1822: warning: passing argument 5 of 'PySlice_GetIndices'
from incompatible pointer type
./_netcdf.c:1842: warning: passing argument 3 of 'PySlice_GetIndices'
from incompatible pointer type
./_netcdf.c:1842: warning: passing argument 4 of 'PySlice_GetIndices'
from incompatible pointer type
./_netcdf.c:1842: warning: passing argument 5 of 'PySlice_GetIndices'
from incompatible pointer type
./_netcdf.c: In function 'PyNetCDFVariableObject_ass_subscript':
./_netcdf.c:1944: warning: passing argument 3 of 'PySlice_GetIndices'
from incompatible pointer type
./_netcdf.c:1944: warning: passing argument 4 of 'PySlice_GetIndices'
from incompatible pointer type
./_netcdf.c:1944: warning: passing argument 5 of 'PySlice_GetIndices'
from incompatible pointer type
./_netcdf.c:1964: warning: passing argument 3 of 'PySlice_GetIndices'
from incompatible pointer type
./_netcdf.c:1964: warning: passing argument 4 of 'PySlice_GetIndices'
from incompatible pointer type
./_netcdf.c:1964: warning: passing argument 5 of 'PySlice_GetIndices'
from incompatible pointer type
./_netcdf.c: In function 'PyNetCDFVariableObject_ass_subscript':
./_netcdf.c:1944: warning: passing argument 3 of 'PySlice_GetIndices'
from incompatible pointer type
./_netcdf.c:1944: warning: passing argument 4 of 'PySlice_GetIndices'
from incompatible pointer type
./_netcdf.c:1944: warning: passing argument 5 of 'PySlice_GetIndices'
from incompatible pointer type
./_netcdf.c:1964: warning: passing argument 3 of 'PySlice_GetIndices'
from incompatible pointer type
./_netcdf.c:1964: warning: passing argument 4 of 'PySlice_GetIndices'
from incompatible pointer type
./_netcdf.c:1964: warning: passing argument 5 of 'PySlice_GetIndices'
from incompatible pointer type
./_netcdf.c: At top level:
./_netcdf.c:2009: warning: initialization from incompatible pointer type
./_netcdf.c:2011: warning: 'intargfunc' is deprecated
./_netcdf.c:2011: warning: initialization from incompatible pointer type
./_netcdf.c:2012: warning: 'intargfunc' is deprecated
./_netcdf.c:2012: warning: initialization from incompatible pointer type
./_netcdf.c:2013: warning: 'intintargfunc' is deprecated
./_netcdf.c:2013: warning: initialization from incompatible pointer type
./_netcdf.c:2014: warning: initialization from incompatible pointer type
./_netcdf.c:2015: warning: initialization from incompatible pointer type
./_netcdf.c:2019: warning: initialization from incompatible pointer type
./_netcdf.c: At top level:
./_netcdf.c:2009: warning: initialization from incompatible pointer type
./_netcdf.c:2011: warning: 'intargfunc' is deprecated
./_netcdf.c:2011: warning: initialization from incompatible pointer type
./_netcdf.c:2012: warning: 'intargfunc' is deprecated
./_netcdf.c:2012: warning: initialization from incompatible pointer type
./_netcdf.c:2013: warning: 'intintargfunc' is deprecated
./_netcdf.c:2013: warning: initialization from incompatible pointer type
./_netcdf.c:2014: warning: initialization from incompatible pointer type
./_netcdf.c:2015: warning: initialization from incompatible pointer type
./_netcdf.c:2019: warning: initialization from incompatible pointer type
./_netcdf.c: In function 'PyNetCDFVariable_WriteArray':
./_netcdf.c:1626: warning: 'lastloop' may be used uninitialized in
this function
./_netcdf.c: In function 'PyNetCDFVariable_WriteArray':
./_netcdf.c:1626: warning: 'lastloop' may be used uninitialized in
this function
gcc -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -
bundle -undefined dynamic_lookup build/temp.macosx-10.3-fat-2.5/
_netcdf.o -L/Users/boyle5/netcdf-3.6.2/lib -lnetcdf -o build/
lib.macosx-10.3-fat-2.5/pynetcdf/_netcdf.so
/usr/bin/ld: for architecture ppc
/usr/bin/ld: warning /Users/boyle5/netcdf-3.6.2/lib/libnetcdf.a
archive's cputype (7, architecture i386) does not match cputype (18)
for specified -arch flag: ppc (can't load from it)
From Chris.Barker at noaa.gov Fri May 4 18:50:24 2007
From: Chris.Barker at noaa.gov (Christopher Barker)
Date: Fri, 04 May 2007 09:50:24 -0700
Subject: [Pythonmac-SIG] building extension problems on OS X python 2.5.1
In-Reply-To:
References:
Message-ID: <463B6450.3070409@noaa.gov>
James Boyle wrote:
> It appears that the builds attempt to make a universal binary by
> default and attempt to link to a library that I have built as i386
> only.
Yes, that does appear to be your problem.
The whole point of distutils is to make it easy to build extensions that
match the Python you're using, and you're using a Universal Python.
You have three choices:
1) Best (but maybe most difficult) option:
learn to build your libs as Universal -- then you can contribute these
packages to pythonmac.org for others to use.
2) figure how to force distutils to build only i386. I think this
requires messing with the Python Makefile. There was some discussion
here about this not too long ago, I think you'll find it if you search
the archives.
3) Build an i386 only Python, then use that to build your extensions. If
you're running only on your own machine, then there's no harm in this. I
think that was covered in the previous discussion as well.
> These libraries HDF5 and netCDF4 have fairly complex build scripts.
They do, but there are others that would love to see them ready-to-use
for Universal Python!
> I would like to be able to turn off the mechanism that is forcing a
> universal build. The PPC part is a waste of space for me.
Yes, but space is cheap -- that's why I called option 1 the best option.
-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 woklist at kyngchaos.com Fri May 4 19:13:46 2007
From: woklist at kyngchaos.com (William Kyngesburye)
Date: Fri, 4 May 2007 12:13:46 -0500
Subject: [Pythonmac-SIG] building extension problems on OS X python 2.5.1
In-Reply-To:
References:
Message-ID: <7DEF6E75-83D4-4619-9312-D9D9EFF5CFB9@kyngchaos.com>
I have built NetCDF and HDF5 (and HDF4) universal. Currently they're
built statically into my GDAL framework (which has python interface,
BTW). I have Xcode projects for these (though they're integrated
with my GDAL Xcode project), but I used to do them as configure-make-
install builds. I'll have to dig up my notes on this, unless you
prefer the Xcode projects.
Getting HDF5 to build universal from configure-make is very messy,
though there is one trick that can make it very easy.
let me know.
On May 4, 2007, at 11:11 AM, James Boyle wrote:
> INTEL Mac OS X 10.4.9 Macpython 2.5.1
>
> I am having trouble building extensions onto my MacPython 2.5.1.
> The error for pynetcdf 0.7 is given below but I have had the same
> error on two other packages.
>
> It appears that the builds attempt to make a universal binary by
> default and attempt to link to a library that I have built as i386
> only.
> The extent of my ignorance is that I would not even know how to build
> a universal library if I wanted to.
> These libraries HDF5 and netCDF4 have fairly complex build scripts.
>
> I would like to be able to turn off the mechanism that is forcing a
> universal build. The PPC part is a waste of space for me.
>
> Of course, my interpretation of the error might be completely off
> base.
>
> Appreciate any insight.
>
-----
William Kyngesburye
http://www.kyngchaos.com/
"Those people who most want to rule people are, ipso-facto, those
least suited to do it."
- A rule of the universe, from the HitchHiker's Guide to the Galaxy
From Chris.Barker at noaa.gov Fri May 4 19:47:03 2007
From: Chris.Barker at noaa.gov (Christopher Barker)
Date: Fri, 04 May 2007 10:47:03 -0700
Subject: [Pythonmac-SIG] building extension problems on OS X python 2.5.1
In-Reply-To: <7DEF6E75-83D4-4619-9312-D9D9EFF5CFB9@kyngchaos.com>
References:
<7DEF6E75-83D4-4619-9312-D9D9EFF5CFB9@kyngchaos.com>
Message-ID: <463B7197.7060501@noaa.gov>
William Kyngesburye wrote:
> Getting HDF5 to build universal from configure-make is very messy,
> though there is one trick that can make it very easy.
Do tell!
-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 woklist at kyngchaos.com Fri May 4 20:17:06 2007
From: woklist at kyngchaos.com (William Kyngesburye)
Date: Fri, 4 May 2007 13:17:06 -0500
Subject: [Pythonmac-SIG] building extension problems on OS X python 2.5.1
In-Reply-To: <463B7197.7060501@noaa.gov>
References:
<7DEF6E75-83D4-4619-9312-D9D9EFF5CFB9@kyngchaos.com>
<463B7197.7060501@noaa.gov>
Message-ID:
On May 4, 2007, at 12:47 PM, Christopher Barker wrote:
> William Kyngesburye wrote:
>> Getting HDF5 to build universal from configure-make is very messy,
>> though there is one trick that can make it very easy.
>
> Do tell!
>
The easy part is using this trick:
http://www.macosxhints.com/article.php?story=20061025213851279
I used a much messier method before I found this, but had also
switched to an Xcode project I made for it, so I haven't tried the
ccub trick with HDF5 or NetCDF yet.
The ccub trick depends on fixing some endian stuff in the HDF
source. There are a couple endian defines to conditionalize, and a
program to disable that is built and run during compilation.
I'll follow up with the full info when I have more time later.
-----
William Kyngesburye
http://www.kyngchaos.com/
Theory of the Universe
There is a theory which states that if ever anyone discovers exactly
what the universe is for and why it is here, it will instantly
disappear and be replaced by something even more bizarrely
inexplicable. There is another theory which states that this has
already happened.
-Hitchhiker's Guide to the Galaxy 2nd season intro
From ronaldoussoren at mac.com Fri May 4 19:49:01 2007
From: ronaldoussoren at mac.com (Ronald Oussoren)
Date: Fri, 4 May 2007 19:49:01 +0200
Subject: [Pythonmac-SIG] building extension problems on OS X python 2.5.1
In-Reply-To:
References:
Message-ID:
On 4 May, 2007, at 18:11, James Boyle wrote:
> INTEL Mac OS X 10.4.9 Macpython 2.5.1
>
> I am having trouble building extensions onto my MacPython 2.5.1.
> The error for pynetcdf 0.7 is given below but I have had the same
> error on two other packages.
>
> It appears that the builds attempt to make a universal binary by
> default and attempt to link to a library that I have built as i386
> only.
> The extent of my ignorance is that I would not even know how to build
> a universal library if I wanted to.
> These libraries HDF5 and netCDF4 have fairly complex build scripts.
>
> I would like to be able to turn off the mechanism that is forcing a
> universal build. The PPC part is a waste of space for me.
>
> Of course, my interpretation of the error might be completely off
> base.
>
> Appreciate any insight.
The easiest way to fix your problem is by patching setup.py and
adding the following two arguments to all Extension definitions:
extra_link_args=['-arch', 'i386'], extra_compile_args=['-arch',
'i386'],
This will tell distutils that you really want a i386 only extension
instead of a universal one.
As Christofer mentions as well the best solution in the long run is
teaching the libraries you're using to build as universal binaries. I
have no idea how hard that would be.
Ronald
>
> --Jim
>
> [krait:~/Desktop/pynetcdf-0.7] boyle5% python setup.py build
> running build
> running config_fc
> running build_src
> building extension "pynetcdf._netcdf" sources
> building data_files sources
> running build_py
> creating build
> creating build/lib.macosx-10.3-fat-2.5
> creating build/lib.macosx-10.3-fat-2.5/pynetcdf
> copying ./__init__.py -> build/lib.macosx-10.3-fat-2.5/pynetcdf
> copying ./NetCDF.py -> build/lib.macosx-10.3-fat-2.5/pynetcdf
> copying ./netcdf_demo.py -> build/lib.macosx-10.3-fat-2.5/pynetcdf
> running build_ext
> customize UnixCCompiler
> customize UnixCCompiler using build_ext
> building 'pynetcdf._netcdf' extension
> compiling C sources
> C compiler: gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/
> MacOSX10.4u.sdk -fno-strict-aliasing -Wno-long-double -no-cpp-precomp
> -mno-fused-madd -fPIC -fno-common -dynamic -DNDEBUG -g -O3 -Wall -
> Wstrict-prototypes
>
> creating build/temp.macosx-10.3-fat-2.5
> compile options: '-I/Users/boyle5/netcdf-3.6.2/include -I/Library/
> Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/
> numpy/core/include -I/Library/Frameworks/Python.framework/Versions/
> 2.5/include/python2.5 -c'
> gcc: ./_netcdf.c
> ./_netcdf.c: In function 'PyNetCDFFile_Close':./_netcdf.c: In
> function 'PyNetCDFFile_Close':
>
> ./_netcdf.c:965: warning: passing argument 2 of 'PyDict_Next' from
> incompatible pointer type./_netcdf.c:965: warning: passing argument 2
> of 'PyDict_Next' from incompatible pointer type
>
> ./_netcdf.c: In function 'PyNetCDFVariableObject_subscript':
> ./_netcdf.c:1822: warning: passing argument 3 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1822: warning: passing argument 4 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1822: warning: passing argument 5 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1842: warning: passing argument 3 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1842: warning: passing argument 4 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1842: warning: passing argument 5 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c: In function 'PyNetCDFVariableObject_subscript':
> ./_netcdf.c:1822: warning: passing argument 3 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1822: warning: passing argument 4 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1822: warning: passing argument 5 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1842: warning: passing argument 3 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1842: warning: passing argument 4 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1842: warning: passing argument 5 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c: In function 'PyNetCDFVariableObject_ass_subscript':
> ./_netcdf.c:1944: warning: passing argument 3 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1944: warning: passing argument 4 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1944: warning: passing argument 5 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1964: warning: passing argument 3 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1964: warning: passing argument 4 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1964: warning: passing argument 5 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c: In function 'PyNetCDFVariableObject_ass_subscript':
> ./_netcdf.c:1944: warning: passing argument 3 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1944: warning: passing argument 4 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1944: warning: passing argument 5 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1964: warning: passing argument 3 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1964: warning: passing argument 4 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1964: warning: passing argument 5 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c: At top level:
> ./_netcdf.c:2009: warning: initialization from incompatible pointer
> type
> ./_netcdf.c:2011: warning: 'intargfunc' is deprecated
> ./_netcdf.c:2011: warning: initialization from incompatible pointer
> type
> ./_netcdf.c:2012: warning: 'intargfunc' is deprecated
> ./_netcdf.c:2012: warning: initialization from incompatible pointer
> type
> ./_netcdf.c:2013: warning: 'intintargfunc' is deprecated
> ./_netcdf.c:2013: warning: initialization from incompatible pointer
> type
> ./_netcdf.c:2014: warning: initialization from incompatible pointer
> type
> ./_netcdf.c:2015: warning: initialization from incompatible pointer
> type
> ./_netcdf.c:2019: warning: initialization from incompatible pointer
> type
> ./_netcdf.c: At top level:
> ./_netcdf.c:2009: warning: initialization from incompatible pointer
> type
> ./_netcdf.c:2011: warning: 'intargfunc' is deprecated
> ./_netcdf.c:2011: warning: initialization from incompatible pointer
> type
> ./_netcdf.c:2012: warning: 'intargfunc' is deprecated
> ./_netcdf.c:2012: warning: initialization from incompatible pointer
> type
> ./_netcdf.c:2013: warning: 'intintargfunc' is deprecated
> ./_netcdf.c:2013: warning: initialization from incompatible pointer
> type
> ./_netcdf.c:2014: warning: initialization from incompatible pointer
> type
> ./_netcdf.c:2015: warning: initialization from incompatible pointer
> type
> ./_netcdf.c:2019: warning: initialization from incompatible pointer
> type
> ./_netcdf.c: In function 'PyNetCDFVariable_WriteArray':
> ./_netcdf.c:1626: warning: 'lastloop' may be used uninitialized in
> this function
> ./_netcdf.c: In function 'PyNetCDFVariable_WriteArray':
> ./_netcdf.c:1626: warning: 'lastloop' may be used uninitialized in
> this function
> gcc -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -
> bundle -undefined dynamic_lookup build/temp.macosx-10.3-fat-2.5/
> _netcdf.o -L/Users/boyle5/netcdf-3.6.2/lib -lnetcdf -o build/
> lib.macosx-10.3-fat-2.5/pynetcdf/_netcdf.so
> /usr/bin/ld: for architecture ppc
> /usr/bin/ld: warning /Users/boyle5/netcdf-3.6.2/lib/libnetcdf.a
> archive's cputype (7, architecture i386) does not match cputype (18)
> for specified -arch flag: ppc (can't load from it)
> _______________________________________________
> Pythonmac-SIG maillist - Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3562 bytes
Desc: not available
Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20070504/12017874/attachment-0001.bin
From boyle5 at llnl.gov Fri May 4 23:01:50 2007
From: boyle5 at llnl.gov (James Boyle)
Date: Fri, 4 May 2007 14:01:50 -0700
Subject: [Pythonmac-SIG] building extension problems on OS X python 2.5.1
In-Reply-To:
References:
Message-ID: <9124E689-08CA-41CD-8D36-DA675500AFF2@llnl.gov>
Thanks for the help.
Using your advice I augmented the Extension definitions in the
setup.py of pynetcdf and it worked OK.
BUT when I tried to modify a more complex installation
(cdat_lite-4.1.2-0.2.2). I got the same problem as before.
cdat-lite has a tree 3 layers deep and 8 setup.py files. I modified
every setup.py file but the result was the same as before - both ppc
and i386? I tried several times from scratch but it did not work as
it did for pynetcdf.
Is there any other place that I need to modify with more complex
situations ?
Perhaps, I need to set something else at the highest level - do
things get overridden as the build propagates down ?
--Jim
On May 4, 2007, at 10:49 AM, Ronald Oussoren wrote:
>
> On 4 May, 2007, at 18:11, James Boyle wrote:
>
>> INTEL Mac OS X 10.4.9 Macpython 2.5.1
>>
>> I am having trouble building extensions onto my MacPython 2.5.1.
>> The error for pynetcdf 0.7 is given below but I have had the same
>> error on two other packages.
>>
>> It appears that the builds attempt to make a universal binary by
>> default and attempt to link to a library that I have built as i386
>> only.
>> The extent of my ignorance is that I would not even know how to build
>> a universal library if I wanted to.
>> These libraries HDF5 and netCDF4 have fairly complex build scripts.
>>
>> I would like to be able to turn off the mechanism that is forcing a
>> universal build. The PPC part is a waste of space for me.
>>
>> Of course, my interpretation of the error might be completely off
>> base.
>>
>> Appreciate any insight.
>
> The easiest way to fix your problem is by patching setup.py and
> adding the following two arguments to all Extension definitions:
> extra_link_args=['-arch', 'i386'], extra_compile_args=['-arch',
> 'i386'],
>
> This will tell distutils that you really want a i386 only extension
> instead of a universal one.
>
> As Christofer mentions as well the best solution in the long run is
> teaching the libraries you're using to build as universal binaries.
> I have no idea how hard that would be.
>
> Ronald
>
From ronaldoussoren at mac.com Sat May 5 08:54:40 2007
From: ronaldoussoren at mac.com (Ronald Oussoren)
Date: Sat, 5 May 2007 08:54:40 +0200
Subject: [Pythonmac-SIG] Building a 64-bit version of python
In-Reply-To: <890C1F36-04BA-4F0E-B3F8-929D443B0832@mac.com>
References: <890C1F36-04BA-4F0E-B3F8-929D443B0832@mac.com>
Message-ID: <1D042D25-AC75-4B73-B5F7-D625D5CE42E4@mac.com>
On 26 Apr, 2007, at 15:50, Ronald Oussoren wrote:
> I know several people on this list are interested in a 64-bit build
> of python. The following procedure is a hack that gets you a basic 64-
> bit build of python.
>
>
> The build is universal, but for me only one of the two archictures
> actually worked: I did my build on an Intel system and the 64-bit
> build worked on that machine, but didn't work on a G5 mac. That's
> probably something shallow, but as that machine doesn't have the
> Xcode installed and is on the other side of a slow network connection
> I haven't tried to debug this yet.
I've installed Xcode on the PPC64 machine as well and have confirmed
that the procedure below builds a 64-bit binary there as well.
The crash for the cross-compiled version is probably caused
differences in pyconfig.h for the two architectures (specifically the
information related to the type of va_list), although I haven't tried
merging the two pyconfig.h files yet to determine if this really is
the cause for the crash.
I'm starting to think about a the design for a 4-way universal Python
build. My current ideas are as follows:
* The Python.framework and extensions are build 4-way universal
The extensions are build in 64-bit mode where feasable, Carbon
will need to stay 32-bit only
* The 'python' and 'python2.X' commands will be 32-bit only, users
will have to make an explicit decision
to use 64-bit code. The commands 'python-64' and 'python2.X-64'
will be 64-bit only.
There are two reasons for not letting 'python' be a 4-way
universal binary. The first is that 64-bit binaries
can only use unixy APIs on Tiger (or rather only libSystem, even
zlib is just 32-bit), which means they
are less useful than 32-bit binaries for most Mac users. The
second reason is that 64-bit binaries are
not necessarily the right choice even when the entire system is
64-bit capable due to additional overhead
from the larger datatypes.
* Distutils will build 2-way universal by default when using a 32-bit
python for building (that is,
'python setup.py build' will build 32-bit binaries only). A 64-bit
python will build 4-way universal by default.
IMHO this is the most DWIM solution for building extensions,
you'll only get 64-bit binaries when you explictly
ask for it. It is also the least likely to cause problems when
building extensions (a lot of build scripts would
need patches when we'd build 64-bit by default).
Actually getting there requires some work, I don't know when I'll
have time to work on this. I've only looked at a 64-bit build for
python to get some simple code working with a large dataset, that
code got reworked later on to use less memory and therefore we no
longer have a pressing need for a 64-bit build.
The patch for distutils should be fairly trivial, the hooks to do
the work should already be there as a result of the 2-way universal
build machinery.
The harder part is convincing the build machinery (the configure
script and Makefile's) to do the right thing.
Another non-trivial part is learning libffi about 64-bit code. That's
needed to get a working version of ctypes.
The build script for the binary installer also requires changes: it
would have to build the libraries it uses as 4-way universal
binaries, and several more libraries would have to be added to the
list if we want to have a normal stdlib for 64-bit builds.
Ronald
>
> 1) Edit the configure script, look for "-arch i386" and "-arch ppc"
> and change that those to "-arch ppc64" and "-arch x86_64". You'll
> have to make multiple changes to the configure file.
>
> 2) Build using:
>
> $ mkdir build
> $ cd build
> $ CFLAGS="-arch ppc64 -arch x86_64" ../configure --enable-
> universalsdk \
> --disable-toolbox-glue --prefix=/opt/python25-64bit
> $ make
> $ make install
>
> 3) Optionally: run "make testall" to run the unittests and check
> pyconfig.h to check the various SIZEOF definitions.
>
> You now have a 64-bit build of python in /opt/python25-64bit.
>
> Note that this is a quick hack and I haven't done extensive testing
> (and probably won't do so until I get around to working on a patch to
> add native support for 4-way universal builds to the python build
> process, which won't be any time soon).
>
> Also note that several extensions won't build in this setup because
> only libSystem is 64-bit at the moment. You will therefore not have
> ssl support, zlib, bz2 and hashlib. If you want those you'll have to
> build the needed libraries (openssl, zlib, bz2, ...) as 64-bit
> binaries by hand and install those in /usr/local.
>
> This copy of python says:
>
> ./python.exe
> Python 2.5.1 (r251:54863, Apr 26 2007, 15:09:03)
> [GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import sys
>>>> sys.maxint
> 9223372036854775807
>>>>
>
> Ronald
>
>
> _______________________________________________
> Pythonmac-SIG maillist - Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3562 bytes
Desc: not available
Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20070505/2a90d32e/attachment.bin
From evenprimes at gmail.com Sun May 6 01:48:09 2007
From: evenprimes at gmail.com (Chris Cioffi)
Date: Sat, 5 May 2007 19:48:09 -0400
Subject: [Pythonmac-SIG] Problems with PYTHONPATH using MacPorts Python 2.4
& 2.5
Message-ID:
Hello all,
I'm trying to get started with Python 2.5 on my Mac and for various
reasons would like to use th Python from MacPorts.
[http://www.macports.org/]
I've installed Python 2.5 and when I start it up I get the following:
"""
Could not find platform dependent libraries
Consider setting $PYTHONHOME to [:]
Python 2.5 (r25:51908, May 4 2007, 19:57:54)
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
"""
The only change I have from the default system is I have
.pydistutils.cfg with the following:
"""
[install]
install_lib = ~/Library/Python/$py_version_short/site-packages
install_scripts = ~/Applications/bin
install_data = ~/Library/Python/$py_version_short/share
"""
Does anyone have any idea on what I should set $PYTHONPATHHOME to? My
ports install is the default location, /opt/local.
Any help would be very much appreciated!
Chris
--
"A little government and a little luck are necessary in life, but only
a fool trusts either of them." -- P. J. O'Rourke
From woklist at kyngchaos.com Sat May 5 17:53:40 2007
From: woklist at kyngchaos.com (William Kyngesburye)
Date: Sat, 5 May 2007 10:53:40 -0500
Subject: [Pythonmac-SIG] building extension problems on OS X python 2.5.1
In-Reply-To: <463B7197.7060501@noaa.gov>
References:
<7DEF6E75-83D4-4619-9312-D9D9EFF5CFB9@kyngchaos.com>
<463B7197.7060501@noaa.gov>
Message-ID: <5665B516-8048-446E-9DD0-4A69FACC9371@kyngchaos.com>
Here's the rest of the details for a universal HDF5 and NetCDF.
These are just the endian bits, I'm assuming the ccub trick is used
to do the universal build itself, otherwise it's a lot more messy.
{Just a reminder - if you need to R/W NetCDF and HDF4 & 5 within
Python and it doesn't matter what you use (though it would probably
need some reprogramming), I have the whole GDAL package built
universal, including the Python interface. NetCDF and HDF support
included.}
The key to the endian stuff is conditionalizing any endian stuff on
the compiler macro __BIG_ENDIAN__ or __LITTLE_ENDIAN__.
? HDF5
- disable building H5detect.c, else you will get a single-endian
H5Tinit.c:
in src/makefile.in, comment everything within the H5Tinit.c target
(you may be able to comment or delete the whole target, but I think I
tried that once and it didn't work):
H5Tinit.c: H5detect
# LD_LIBRARY_PATH="$$LD_LIBRARY_PATH`echo $(LDFLAGS)
| \
# sed -e 's/-L/:/g' -e 's/ //g'`" \
# $(RUNSERIAL) ./H5detect > H5Tinit.c
|| \
# (test $$HDF5_Make_Ignore && echo "*** Error ignored")
|| \
# ($(RM) $@ ; exit 1)
and remove H5Tinit.c from MOSTLYCLEAN, so the custom H5Tinit.c is not
deleted when cleaning:
MOSTLYCLEAN=H5detect.o H5detect.lo H5detect H5Tinit.o H5Tinit.lo
and finally, drop this custom H5Tinit.c into src/ :
-------------- next part --------------
A non-text attachment was scrubbed...
Name: H5Tinit.c
Type: application/octet-stream
Size: 68687 bytes
Desc: not available
Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20070505/53f916ff/attachment-0001.obj
-------------- next part --------------
I spliced together one from building on both architectures,
conditionalized on the endian as above (originally, before I had
access to Intel, I guessed what the Intel version would be, and
guessed right). There may be issues on 64-bit builds, but we're not
quite there yet with Python on OSX.
- AFTER running configure, before make, some config'd endian stuff to
change. There might be a better way to do this, especially before
configure, but I never pursued that.
src/H5config.h: change the WORDS_BIGENDIAN define line to:
#ifdef __BIG_ENDIAN__
#define WORDS_BIGENDIAN 1
#else
#undef WORDS_BIGENDIAN
#endif
src/H5pubconf.h: change the H5_WORDS_BIGENDIAN define line to:
#ifdef __BIG_ENDIAN__
#define H5_WORDS_BIGENDIAN 1
#else
#undef H5_WORDS_BIGENDIAN
#endif
? NetCDF is simpler
After running configure, edit config.h and change the WORDS_BIGENDIAN
define line to:
#ifdef __BIG_ENDIAN__
#define WORDS_BIGENDIAN 1
#else
#undef WORDS_BIGENDIAN
#endif
-----
William Kyngesburye
http://www.kyngchaos.com/
"Those people who most want to rule people are, ipso-facto, those
least suited to do it."
- A rule of the universe, from the HitchHiker's Guide to the Galaxy
From Chris.Barker at noaa.gov Tue May 8 00:23:53 2007
From: Chris.Barker at noaa.gov (Christopher Barker)
Date: Mon, 07 May 2007 15:23:53 -0700
Subject: [Pythonmac-SIG] building extension problems on OS X python 2.5.1
In-Reply-To: <58E26788-1229-438E-93CB-1F95247C43D9@llnl.gov>
References:
<463B6450.3070409@noaa.gov>
<58E26788-1229-438E-93CB-1F95247C43D9@llnl.gov>
Message-ID: <463FA6F9.1010100@noaa.gov>
James Boyle wrote:
> Thanks a lot for the help. Your suggestion (2) was the one I finally
> used to get a build.
> As you indicate option (1) was probably the most useful, but in the
> press of time to get something done, this had to be put off until I
> have more time.
fair enough.
Could you please post a synopsis (or a link to one) of how you got
distutils to build just one architecture?
-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 j.m.h.thomas at dl.ac.uk Wed May 9 13:52:50 2007
From: j.m.h.thomas at dl.ac.uk (Jens Thomas)
Date: Wed, 09 May 2007 12:52:50 +0100
Subject: [Pythonmac-SIG] Problems building universal binary for Numeric
Python
Message-ID: <4641B612.5000205@dl.ac.uk>
Hi,
I'm having trouble building Numeric Python 24.2 as a universal binary. I
know that Numeric is deprecated, but for various reasons I still need to
use it.
I've edited the file customize.py to include the following:
extra_compile_args = ['-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch
i386 -arch ppc']
extra_link_args = ['-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk
-arch ppc -arch i386']
This is then read in by setup.py and sets the extra_compile_args for all
the extensions.
However, it fails when it tries to build as it can't find several
includes files as shown in the error message below:
building '_numpy' extension
creating build/temp.darwin-8.9.1-i386-2.3
creating build/temp.darwin-8.9.1-i386-2.3/Src
gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp
-mno-fused-madd -fno-common -dynamic -DNDEBUG -g -O3 -Wall
-Wstrict-prototypes -IInclude -IPackages/FFT/Include
-IPackages/RNG/Include
-I/System/Library/Frameworks/Python.framework/Versions/2.3/include/python2.3
-c Src/arrayobject.c -o
build/temp.darwin-8.9.1-i386-2.3/Src/arrayobject.o -isysroot
/Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc
In file included from Src/arrayobject.c:17:
/System/Library/Frameworks/Python.framework/Versions/2.3/include/python2.3/Python.h:19:20:
error: limits.h: No such file or directory
/System/Library/Frameworks/Python.framework/Versions/2.3/include/python2.3/Python.h:28:19:
error: stdio.h: No such file or directory
/System/Library/Frameworks/Python.framework/Versions/2.3/include/python2.3/Python.h:30:5:
error: #error "Python.h requires that stdio.h define NULL."
/System/Library/Frameworks/Python.framework/Versions/2.3/include/python2.3/Python.h:33:20:
error: string.h: No such file or directory
/System/Library/Frameworks/Python.framework/Versions/2.3/include/python2.3/Python.h:34:19:
error: errno.h: No such file or directory
However, if I cut and paste the make line:
gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp
-mno-fused-madd -fno-common -dynamic -DNDEBUG -g -O3 -Wall
-Wstrict-prototypes -IInclude -IPackages/FFT/Include
-IPackages/RNG/Include
-I/System/Library/Frameworks/Python.framework/Versions/2.3/include/python2.3
-c Src/arrayobject.c -o
build/temp.darwin-8.9.1-i386-2.3/Src/arrayobject.o -isysroot
/Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc
into the terminal, it appears to work fine. Adding other arguments
(e.g. -g) using the extra_compile_args flag works fine, so it's
something specific about the isysroot argument that's causing the
problem with it not finding the include files (hence my asking on this
list).
Does anyone have any suggestions as to how to debug this?
Best wishes,
Jens
From ronaldoussoren at mac.com Wed May 9 15:06:14 2007
From: ronaldoussoren at mac.com (Ronald Oussoren)
Date: Wed, 09 May 2007 06:06:14 -0700
Subject: [Pythonmac-SIG] Problems building universal binary for
NumericPython
In-Reply-To: <4641B612.5000205@dl.ac.uk>
References: <4641B612.5000205@dl.ac.uk>
Message-ID:
On Wednesday, May 09, 2007, at 02:19PM, "Jens Thomas" wrote:
>Hi,
>
>I'm having trouble building Numeric Python 24.2 as a universal binary. I
>know that Numeric is deprecated, but for various reasons I still need to
>use it.
>
>I've edited the file customize.py to include the following:
>
>extra_compile_args = ['-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch
>i386 -arch ppc']
>extra_link_args = ['-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk
>-arch ppc -arch i386']
All arguments should be separate elements in the list, instead of stuffing one string with several arguments in the list.
BTW. I'm not at al sure that this will work, pyconfig.h contains some byte-order specific values. The Python 2.4.4 and 2.5 distributions contain patches that make sure that C code sees the right values for those definitions, but I don't think this is present in Apple python2.3 build.
Ronald
From j.m.h.thomas at dl.ac.uk Wed May 9 15:43:31 2007
From: j.m.h.thomas at dl.ac.uk (Jens Thomas)
Date: Wed, 09 May 2007 14:43:31 +0100
Subject: [Pythonmac-SIG] Problems building universal binary for
NumericPython
In-Reply-To:
References: <4641B612.5000205@dl.ac.uk>
Message-ID: <4641D003.1060408@dl.ac.uk>
Hi Ronald,
Ronald Oussoren wrote:
>
> On Wednesday, May 09, 2007, at 02:19PM, "Jens Thomas" wrote:
>
>> Hi,
>>
>> I'm having trouble building Numeric Python 24.2 as a universal binary. I
>> know that Numeric is deprecated, but for various reasons I still need to
>> use it.
>>
>> I've edited the file customize.py to include the following:
>>
>> extra_compile_args = ['-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch
>> i386 -arch ppc']
>> extra_link_args = ['-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk
>> -arch ppc -arch i386']
>>
>
> All arguments should be separate elements in the list, instead of stuffing one string with several arguments in the list.
>
> BTW. I'm not at al sure that this will work, pyconfig.h contains some byte-order specific values. The Python 2.4.4 and 2.5 distributions contain patches that make sure that C code sees the right values for those definitions, but I don't think this is present in Apple python2.3 build.
>
Many thanks for that - it's exactly what I needed - and not quite as
mind-numbingly boring as cutting and pasting the make invocation for
each object into the terminal as I was previously... :-)
I'm using my own python 2.5 universal binary build, so hopefully I won't
hit the problems you mention.
Thanks again,
Jens
From ronaldoussoren at mac.com Wed May 9 16:40:57 2007
From: ronaldoussoren at mac.com (Ronald Oussoren)
Date: Wed, 09 May 2007 07:40:57 -0700
Subject: [Pythonmac-SIG] Problems building universal binary for
NumericPython
In-Reply-To: <4641D003.1060408@dl.ac.uk>
References: <4641B612.5000205@dl.ac.uk>
<4641D003.1060408@dl.ac.uk>
Message-ID:
On Wednesday, May 09, 2007, at 03:47PM, "Jens Thomas" wrote:
>Hi Ronald,
>
>Ronald Oussoren wrote:
>>
>> On Wednesday, May 09, 2007, at 02:19PM, "Jens Thomas" wrote:
>>
>>> Hi,
>>>
>>> I'm having trouble building Numeric Python 24.2 as a universal binary. I
>>> know that Numeric is deprecated, but for various reasons I still need to
>>> use it.
>>>
>>> I've edited the file customize.py to include the following:
>>>
>>> extra_compile_args = ['-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch
>>> i386 -arch ppc']
>>> extra_link_args = ['-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk
>>> -arch ppc -arch i386']
>>>
>>
>> All arguments should be separate elements in the list, instead of stuffing one string with several arguments in the list.
>>
>> BTW. I'm not at al sure that this will work, pyconfig.h contains some byte-order specific values. The Python 2.4.4 and 2.5 distributions contain patches that make sure that C code sees the right values for those definitions, but I don't think this is present in Apple python2.3 build.
>>
>Many thanks for that - it's exactly what I needed - and not quite as
>mind-numbingly boring as cutting and pasting the make invocation for
>each object into the terminal as I was previously... :-)
>
>I'm using my own python 2.5 universal binary build, so hopefully I won't
>hit the problems you mention.
The trace in your previous message is for python2.3, that may be a problem with your shell environment ;-)
If you're using the builtin universal binary support in python 2.5 you don't have to modify the Numeric setup file, distutils will build universal by default. You can enable this by using the configure flag --enable-universalsdk. This flag can be used with framework builds and plain unix builds.
Ronald
>
>Thanks again,
>
>Jens
>
>
From jujulj at gmail.com Wed May 9 19:16:20 2007
From: jujulj at gmail.com (julien ricard)
Date: Wed, 9 May 2007 19:16:20 +0200
Subject: [Pythonmac-SIG] signal from itunes when song changes?
Message-ID: <9e3f58c50705091016n1a26f4ebo7b342d54d350dfb4@mail.gmail.com>
hi,
I'm building a kind of plugin for itunes using python and qt. In order
to practice a bit, I've started with a very simple one: display the
song currently played (no 'update' button). The problem is that I
don't know how to get the signal from itunes when the song changes in
order to update the song
information in my qt app. I've done a loop checking when the name
change, but it doesn't look very optimal... Anybody could help?
thanks!
jul
From vivacarlie at gmail.com Wed May 9 22:50:20 2007
From: vivacarlie at gmail.com (Nehemiah Dacres)
Date: Wed, 9 May 2007 15:50:20 -0500
Subject: [Pythonmac-SIG] Problems with PYTHONPATH using MacPorts Python
2.4 & 2.5
In-Reply-To:
References:
Message-ID: <65fadfc30705091350p545f189cl59af2d86a8d4b194@mail.gmail.com>
Site packages is where the platform dependant libraries of Mac python
reside. they should be in /Library/Python/site-packages/ and thats where
platform specific libraries are installed. Python home im not sure of,
PYTHONPATH is where the python interpreter lives, it is specific to the
particular version of python so each version [2.3, 2.4, 2.5] can possibly
print a different response when you put the following commands in your
python interpreter:
>> import sys
>> print sys.path
you shall get a list of paths, these are the paths to all the directories
(folders) that the python interpreter will look in for libraries.
On 5/5/07, Chris Cioffi wrote:
>
> Hello all,
>
> I'm trying to get started with Python 2.5 on my Mac and for various
> reasons would like to use th Python from MacPorts.
> [http://www.macports.org/]
>
> I've installed Python 2.5 and when I start it up I get the following:
>
> """
> Could not find platform dependent libraries
> Consider setting $PYTHONHOME to [:]
> Python 2.5 (r25:51908, May 4 2007, 19:57:54)
> [GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>>
> """
>
> The only change I have from the default system is I have
> .pydistutils.cfg with the following:
> """
> [install]
> install_lib = ~/Library/Python/$py_version_short/site-packages
> install_scripts = ~/Applications/bin
> install_data = ~/Library/Python/$py_version_short/share
> """
>
> Does anyone have any idea on what I should set $PYTHONPATHHOME to? My
> ports install is the default location, /opt/local.
>
> Any help would be very much appreciated!
>
> Chris
> --
> "A little government and a little luck are necessary in life, but only
> a fool trusts either of them." -- P. J. O'Rourke
> _______________________________________________
> Pythonmac-SIG maillist - Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
>
--
"lalalalala! it's not broken because I can use it"
http://linux.slashdot.org/comments.pl?sid=194281&threshold=1&commentsort=0&mode=thread&cid=15927703
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20070509/5bc2defa/attachment.htm
From daniellord at mac.com Wed May 9 23:49:20 2007
From: daniellord at mac.com (Daniel Lord)
Date: Wed, 9 May 2007 14:49:20 -0700
Subject: [Pythonmac-SIG] Fwd: signal from itunes when song changes?
References: <53DEE818-2F74-46B1-8852-FB77251F5D8D@mac.com>
Message-ID: <8A8F456A-7342-4A4B-8F81-D3EAA93D2F5D@mac.com>
I forgot to copy the list ;-)
Begin forwarded message:
> From: Daniel Lord
> Date: May 9, 2007 10:30:41 PDT
> To: julien ricard
> Subject: Re: [Pythonmac-SIG] signal from itunes when song changes?
>
> Growl does it, so there must be a way to register for state change
> notifications as a listener (I am speculating).
> Maybe check the Growl SDK and find out how their iTunes Growler works.
> Google for Growl and then access the developer information to get
> the SDK which should have the source code for the iTunes module.
> Someone better versed in this may chime in as well.
>
> Daniel
>
> On May 9, 2007, at 10:16, julien ricard wrote:
>
>> hi,
>>
>> I'm building a kind of plugin for itunes using python and qt. In
>> order
>> to practice a bit, I've started with a very simple one: display the
>> song currently played (no 'update' button). The problem is that I
>> don't know how to get the signal from itunes when the song changes in
>> order to update the song
>> information in my qt app. I've done a loop checking when the name
>> change, but it doesn't look very optimal... Anybody could help?
>>
>> thanks!
>>
>> jul
>> _______________________________________________
>> Pythonmac-SIG maillist - Pythonmac-SIG at python.org
>> http://mail.python.org/mailman/listinfo/pythonmac-sig
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20070509/98047a51/attachment-0001.html
From lou_boog2000 at yahoo.com Thu May 10 15:57:27 2007
From: lou_boog2000 at yahoo.com (Lou Pecora)
Date: Thu, 10 May 2007 06:57:27 -0700 (PDT)
Subject: [Pythonmac-SIG] Problems with PYTHONPATH using MacPorts Python
2.4 & 2.5
In-Reply-To: <65fadfc30705091350p545f189cl59af2d86a8d4b194@mail.gmail.com>
Message-ID: <120288.34367.qm@web34403.mail.mud.yahoo.com>
--- Nehemiah Dacres wrote:
> Site packages is where the platform dependant
> libraries of Mac python
> reside. they should be in
> /Library/Python/site-packages/ and thats where
> platform specific libraries are installed. Python
> home im not sure of,
> PYTHONPATH is where the python interpreter lives, it
> is specific to the
[cut]
I don't think that's quite right. My site packages on
Mac OS X 10.4.9 are in the directory,
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/
I believe all Python installs beyond the
Apple-supplied 2.3 are in the Frameworks directory.
Then in my bash-shell .profile_login the lines were
automatically added when I installed Python 2.4.4,
PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}"
export PATH
which causes the latest (Current) Python version to be
launched rather than the Apple-supplied 2.3 one.
By the way if you have any modules of your own that
you would like to be automatically on the sys.path so
you can just import them in your scripts, you only
need to put a text file in the site-packages directory
(see above) which contains on each line the full path
to each of your modules' directories. You can name
the file anything, but it must have the extension
.pth . When you launch Python it will automatically
add your paths to the sys.path and you can just say
import mymodule # Import your file mymodule.py
Hope that helps.
-- Lou Pecora, my views are my own.
---------------
Great spirits have always encountered violent opposition from mediocre minds.
-Albert Einstein
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
From j.m.h.thomas at dl.ac.uk Thu May 10 16:01:16 2007
From: j.m.h.thomas at dl.ac.uk (Jens Thomas)
Date: Thu, 10 May 2007 15:01:16 +0100
Subject: [Pythonmac-SIG] Problems with finding standard python modules when
using py2app
Message-ID: <464325AC.9080505@dl.ac.uk>
Hi,
I'm trying to building an app using py2app for my Python application and
have managed to fall at the first hurdle.
I added the following to my setup.py file (which works fine with py2exe
and so should be in reasonably good shape):
from setuptools import setup
app=["viewer/main.py"],
setup_requires=["py2app"],
options={'py2app': {'argv_emulation': True}}
I created the bundle with "python setup.py py2app" and then tried
running it from the finder and got:
'import site' failed; use -v for traceback
Traceback (most recent call last):
File "/tmp/ccp1gui.app/Contents/Resources/__boot__.py", line 103, in ?
_argv_emulation()
File "/tmp/ccp1gui.app/Contents/Resources/__boot__.py", line 101, in
_argv_emulation
_get_argvemulator().mainloop()
File "/tmp/ccp1gui.app/Contents/Resources/__boot__.py", line 7, in
_get_argvemulator
import traceback
ImportError: No module named traceback
2007-05-10 14:18:18.089 ccp1gui[16632] ccp1gui Error
2007-05-10 14:18:18.090 ccp1gui[16632] ccp1gui Error
An unexpected error has occurred during execution of the main script
ImportError: No module named traceback
I tried removing the line:
options={'py2app': {'argv_emulation': True}}
from setup.py, but this this time the program failed with:
'import site' failed; use -v for traceback
Traceback (most recent call last):
File "/tmp/ccp1gui.app/Contents/Resources/__boot__.py", line 4, in ?
_chdir_resource()
File "/tmp/ccp1gui.app/Contents/Resources/__boot__.py", line 2, in
_chdir_resource
import os
ImportError: No module named os
2007-05-10 14:38:14.717 ccp1gui[17411] ccp1gui Error
2007-05-10 14:38:14.717 ccp1gui[17411] ccp1gui Error
An unexpected error has occurred during execution of the main script
ImportError: No module named os
Is there anything daft that I'm doing that's causing it to go wrong
before it's even got out of the blocks?
For info I'm running under Darwin 8.9.1 on an Intel Mac, using
setuptools 0.6c5 and the standard framework python (2.3).
I notice that there was a similar bug mentioned on the mailing list, but
that was for programs started from a directory containing a colon,
whereas this is run from /tmp
Best wishes,
Jens
From ronaldoussoren at mac.com Fri May 11 09:44:52 2007
From: ronaldoussoren at mac.com (Ronald Oussoren)
Date: Fri, 11 May 2007 09:44:52 +0200
Subject: [Pythonmac-SIG] Problems with PYTHONPATH using MacPorts
Python 2.4 & 2.5
In-Reply-To: <65fadfc30705091350p545f189cl59af2d86a8d4b194@mail.gmail.com>
References:
<65fadfc30705091350p545f189cl59af2d86a8d4b194@mail.gmail.com>
Message-ID: <6A50B7A9-3FA0-4CEC-A044-BD0102770A8F@mac.com>
On 9 May, 2007, at 22:50, Nehemiah Dacres wrote:
> Site packages is where the platform dependant libraries of Mac
> python reside. they should be in /Library/Python/site-packages/ and
> thats where platform specific libraries are installed. Python home
> im not sure of, PYTHONPATH is where the python interpreter lives,
> it is specific to the particular version of python so each version
> [ 2.3, 2.4, 2.5] can possibly print a different response when you
> put the following commands in your python interpreter:
All of this is not quite true. In general the site-packages directory
is not in the /Library/Python tree, that's just for Apple's build of
Python. You can have ~/Library/Python/2.5/site-packages for your own
private additions to the library (separate from other users, the same
mechanism also works for other versions of python).
The actual system-wide site-packages directory is hidden in the
Python.framework (again, unless you're using Apple's build of Python).
PYTHONPATH is another way to add items to sys.path, the value of the
environment variable is split on colons and all elements are added to
the path. IMHO one shouldn't use this mechanism in general. Either
install packages in one of the site-packages locations or make add
code to your scripts to set up the right environment.
PYTHONHOME is the location where python is installed. You basicly
never have to set this unless you have some very special needs, a
normal python installation is not one of them.
None of this is relevant for the original problem though...
>
> >> import sys
> >> print sys.path
>
> you shall get a list of paths, these are the paths to all the
> directories (folders) that the python interpreter will look in for
> libraries.
>
>
> On 5/5/07, Chris Cioffi wrote:
> Hello all,
>
> I'm trying to get started with Python 2.5 on my Mac and for various
> reasons would like to use th Python from MacPorts.
> [http://www.macports.org/]
>
> I've installed Python 2.5 and when I start it up I get the following:
>
> """
> Could not find platform dependent libraries
> Consider setting $PYTHONHOME to [:]
> Python 2.5 (r25:51908, May 4 2007, 19:57:54)
> [GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>>
> """
What happens when you temporarily remove .pydistutils.cfg? What is
the value of sys.executable (import sys;print sys.executable)?
This looks like a broken installation. You may want to ask on the
macports list about this. Another alternative is trying to reinstall
(port uninstall python25; port install python25), as a bonus you'll
get python 2.5.1 instead of 2.5 ;-)
As an aside: why do you want to use the MacPorts build of python
instead of the python.org one? This is just curiousity on my part,
AFAIK both the python.org build and the MacPorts one should work just
fine.
>
> The only change I have from the default system is I have
> .pydistutils.cfg with the following:
> """
> [install]
> install_lib = ~/Library/Python/$py_version_short/site-packages
> install_scripts = ~/Applications/bin
> install_data = ~/Library/Python/$py_version_short/share
> """
>
> Does anyone have any idea on what I should set $PYTHONPATHHOME to? My
> ports install is the default location, /opt/local.
You shouldn't have to set PYTHONHOME (sic) at all.
Ronald
>
> Any help would be very much appreciated!
>
> Chris
> --
> "A little government and a little luck are necessary in life, but only
> a fool trusts either of them." -- P. J. O'Rourke
> _______________________________________________
> Pythonmac-SIG maillist - Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
>
>
>
> --
>
> "lalalalala! it's not broken because I can use it"
>
> http://linux.slashdot.org/comments.pl?
> sid=194281&threshold=1&commentsort=0&mode=thread&cid=15927703
> _______________________________________________
> Pythonmac-SIG maillist - Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20070511/92cd9753/attachment.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3562 bytes
Desc: not available
Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20070511/92cd9753/attachment.bin
From jujulj at gmail.com Fri May 11 15:26:34 2007
From: jujulj at gmail.com (julien ricard)
Date: Fri, 11 May 2007 15:26:34 +0200
Subject: [Pythonmac-SIG] pyobjc install
Message-ID: <9e3f58c50705110626q41c26108gec18f26e428b54c3@mail.gmail.com>
hi,
I'm trying to install pyobjc by generating a mpkg with python 2.5 using:
python setup.py bdist_mpkg --open
at some point I get the error shown below. I guess it has something to
do with my installation of pyqt... Anybody could help?
thanks
creating Users/jul/pyobjc-1.4/b-/uild/py2app/bdist.macosx-10.3-fat/tools/PackageInstaller/python2.5-semi_standalone/app/Frameworks
Traceback (most recent call last):
File "setup.py", line 709, in
download_url = 'http://pyobjc.sourceforge.net/software/index.php',
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/core.py",
line 151, in setup
dist.run_commands()
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/dist.py",
line 974, in run_commands
self.run_command(cmd)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/dist.py",
line 994, in run_command
cmd_obj.run()
File "/Users/jul/pyobjc-1.4/source-deps/py2app-source/src/bdist_mpkg/cmd_bdist_mpkg.py",
line 398, in run
self.run_subprojects()
File "/Users/jul/pyobjc-1.4/source-deps/py2app-source/src/bdist_mpkg/cmd_bdist_mpkg.py",
line 197, in run_subprojects
self.run_subproject(scheme, setupfile)
File "/Users/jul/pyobjc-1.4/source-deps/py2app-source/src/bdist_mpkg/cmd_bdist_mpkg.py",
line 207, in run_subproject
pkg = self.sub_setup(setupfile,
args).get_command_obj('bdist_mpkg').metapackagename
File "/Users/jul/pyobjc-1.4/source-deps/py2app-source/src/bdist_mpkg/cmd_bdist_mpkg.py",
line 219, in sub_setup
return tools.run_setup(setupfile, args)
File "/Users/jul/pyobjc-1.4/source-deps/py2app-source/src/bdist_mpkg/tools.py",
line 28, in run_setup
return distutils.core.run_setup(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/core.py",
line 220, in run_setup
execfile(script_name, g, l)
File "/Users/jul/pyobjc-1.4/source-deps/py2app-source/setup.py",
line 82, in
'lib/postjaguar/English.lproj/InstallationCheck.strings',
File "/Users/jul/pyobjc-1.4/source-deps/py2app-source/setup-lib/setuptools/__init__.py",
line 51, in setup
return distutils.core.setup(**attrs)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/core.py",
line 151, in setup
dist.run_commands()
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/dist.py",
line 974, in run_commands
self.run_command(cmd)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/dist.py",
line 994, in run_command
cmd_obj.run()
File "/Users/jul/pyobjc-1.4/source-deps/py2app-source/src/bdist_mpkg/cmd_bdist_mpkg.py",
line 400, in run
self.run_extra()
File "/Users/jul/pyobjc-1.4/source-deps/py2app-source/setup-lib/py2app_mpkg.py",
line 26, in run_extra
self.py2app_tools()
File "/Users/jul/pyobjc-1.4/source-deps/py2app-source/setup-lib/py2app_mpkg.py",
line 46, in py2app_tools
self.sub_setup(setupfile, args)
File "/Users/jul/pyobjc-1.4/source-deps/py2app-source/src/bdist_mpkg/cmd_bdist_mpkg.py",
line 219, in sub_setup
return tools.run_setup(setupfile, args)
File "/Users/jul/pyobjc-1.4/source-deps/py2app-source/src/bdist_mpkg/tools.py",
line 28, in run_setup
return distutils.core.run_setup(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/core.py",
line 220, in run_setup
execfile(script_name, g, l)
File "/Users/jul/pyobjc-1.4/source-deps/py2app-source/tools/PackageInstaller/setup.py",
line 10, in
site_packages=True,
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/core.py",
line 151, in setup
dist.run_commands()
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/dist.py",
line 974, in run_commands
self.run_command(cmd)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/dist.py",
line 994, in run_command
cmd_obj.run()
File "/Users/jul/pyobjc-1.4/source-deps/py2app-source/src/py2app/build_app.py",
line 389, in run
self._run()
File "/Users/jul/pyobjc-1.4/source-deps/py2app-source/src/py2app/build_app.py",
line 510, in _run
self.run_normal()
File "/Users/jul/pyobjc-1.4/source-deps/py2app-source/src/py2app/build_app.py",
line 557, in run_normal
self.process_recipes(mf, filters, flatpackages, loader_files)
File "/Users/jul/pyobjc-1.4/source-deps/py2app-source/src/py2app/build_app.py",
line 480, in process_recipes
rval = check(self, mf)
File "/Users/jul/pyobjc-1.4/source-deps/py2app-source/src/py2app/recipes/sip.py",
line 40, in check
packages = self.config()
File "/Users/jul/pyobjc-1.4/source-deps/py2app-source/src/py2app/recipes/sip.py",
line 17, in config
qtdir = cfg.qt_lib_dir
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/sipconfig.py",
line 183, in __getattr__
raise AttributeError, "\"%s\" is not a valid configuration value
or user option" % name
AttributeError: "qt_lib_dir" is not a valid configuration value or user option
From evenprimes at gmail.com Sat May 12 04:01:10 2007
From: evenprimes at gmail.com (Chris Cioffi)
Date: Fri, 11 May 2007 22:01:10 -0400
Subject: [Pythonmac-SIG] Problems with PYTHONPATH using MacPorts Python
2.4 & 2.5
In-Reply-To: <6A50B7A9-3FA0-4CEC-A044-BD0102770A8F@mac.com>
References:
<65fadfc30705091350p545f189cl59af2d86a8d4b194@mail.gmail.com>
<6A50B7A9-3FA0-4CEC-A044-BD0102770A8F@mac.com>
Message-ID:
On 5/11/07, Ronald Oussoren wrote:
>
>
> On 9 May, 2007, at 22:50, Nehemiah Dacres wrote:
[snip]
> >> import sys
> >> print sys.path
>
> you shall get a list of paths, these are the paths to all the directories
> (folders) that the python interpreter will look in for libraries.
Here's what I get from sys.path:
>>> print sys.path
['', '/Users/Chris/Library/Python/2.4/site-packages/setuptools-0.6c3-py2.4.egg',
'/Users/Chris/Library/Python/2.4/site-packages/nose-0.9.0-py2.4.egg',
'/Users/Chris/Library/Python/2.4/site-packages/configobj-4.3.2-py2.4.egg',
'/Users/Chris/Library/Python/2.4/site-packages/cElementTree-1.0.5_20051216-py2.4-macosx-10.4-fat.egg',
'/Users/Chris/Library/Python/2.4/site-packages/PasteScript-0.9.7-py2.4.egg',
'/Users/Chris/Library/Python/2.4/site-packages/elementtree-1.2.6-py2.4.egg',
'/Users/Chris/Library/Python/2.4/site-packages/simplejson-1.3-py2.4.egg',
'/Users/Chris/Library/Python/2.4/site-packages/SQLObject-0.7.1dev_r1860-py2.4.egg',
'/Users/Chris/Library/Python/2.4/site-packages/CherryPy-2.2.1-py2.4.egg',
'/Users/Chris/Library/Python/2.4/site-packages/TurboCheetah-0.9.5-py2.4.egg',
'/Users/Chris/Library/Python/2.4/site-packages/TurboJson-0.9.9-py2.4.egg',
'/Users/Chris/Library/Python/2.4/site-packages/PyProtocols-1.0a0-py2.4-macosx-10.4-fat.egg',
'/Users/Chris/Library/Python/2.4/site-packages/Cheetah-1.0-py2.4-macosx-10.4-fat.egg',
'/Users/Chris/Library/Python/2.4/site-packages/PasteDeploy-0.9.6-py2.4.egg',
'/Users/Chris/Library/Python/2.4/site-packages/Paste-0.9.7-py2.4.egg',
'/Users/Chris/Library/Python/2.4/site-packages/checkboxtable-0.80-py2.4.egg',
'/Users/Chris/Library/Python/2.4/site-packages/Genshi-0.4-py2.4.egg',
'/Users/Chris/Library/Python/2.4/site-packages/gsquickstart-1.0Beta2-py2.4.egg',
'/Users/Chris/Library/Python/2.4/site-packages/registration-0.3-py2.4.egg',
'/Users/Chris/Library/Python/2.4/site-packages/Trac-0.11dev_r5253-py2.4.egg',
'/Users/Chris/Library/Python/2.4/site-packages/TurboGears-1.0.2.2-py2.4.egg',
'/Users/Chris/Library/Python/2.4/site-packages/DecoratorTools-1.4-py2.4.egg',
'/Users/Chris/Library/Python/2.4/site-packages/RuleDispatch-0.5a0.dev_r2306-py2.4-macosx-10.4-fat.egg',
'/Users/Chris/Library/Python/2.4/site-packages/FormEncode-0.7.1-py2.4.egg',
'/Users/Chris/Library/Python/2.4/site-packages/TurboKid-1.0.1-py2.4.egg',
'/Users/Chris/Library/Python/2.4/site-packages/kid-0.9.5-py2.4.egg',
'/Users/Chris/Library/Python/2.4/site-packages/SQLAlchemy-0.3.7-py2.4.egg',
'/Users/Chris/Library/Python/2.4/site-packages/pysqlite-2.3.3-py2.4-macosx-10.3-fat.egg',
'/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python24.zip',
'/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4',
'/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/plat-darwin',
'/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/plat-mac',
'/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/plat-mac/lib-scriptpackages',
'/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/lib-tk',
'/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/lib-dynload',
'/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages',
'/Users/Chris/Library/Python/2.4/site-packages',
'/Users/Chris/Library/Python/2.4/site-packages/PIL']
>>>
>
> On 5/5/07, Chris Cioffi wrote:
> > Hello all,
> >
> > I'm trying to get started with Python 2.5 on my Mac and for various
> > reasons would like to use th Python from MacPorts.
> > [http://www.macports.org/]
> >
> > I've installed Python 2.5 and when I start it up I get the following:
> >
> > """
> > Could not find platform dependent libraries
> > Consider setting $PYTHONHOME to [:]
> > Python 2.5 (r25:51908, May 4 2007, 19:57:54)
> > [GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
> > Type "help", "copyright", "credits" or "license" for more information.
> > >>>
> > """
> >
>
> What happens when you temporarily remove .pydistutils.cfg? What is the
> value of sys.executable (import sys;print sys.executable)?
>
> This looks like a broken installation. You may want to ask on the macports
> list about this. Another alternative is trying to reinstall (port uninstall
> python25; port install python25), as a bonus you'll get python 2.5.1 instead
> of 2.5 ;-)
>
> As an aside: why do you want to use the MacPorts build of python instead of
> the python.org one? This is just curiousity on my part, AFAIK both the
> python.org build and the MacPorts one should work just fine.
>
>
>
> >
> > The only change I have from the default system is I have
> > .pydistutils.cfg with the following:
> > """
> > [install]
> > install_lib =
> ~/Library/Python/$py_version_short/site-packages
> > install_scripts = ~/Applications/bin
> > install_data = ~/Library/Python/$py_version_short/share
> > """
> >
> > Does anyone have any idea on what I should set $PYTHONPATHHOME to? My
> > ports install is the default location, /opt/local.
> >
>
> You shouldn't have to set PYTHONHOME (sic) at all.
>
> Ronald
>
> >
> > Any help would be very much appreciated!
> >
> > Chris
> > --
> > "A little government and a little luck are necessary in life, but only
> > a fool trusts either of them." -- P. J. O'Rourke
> > _______________________________________________
> > Pythonmac-SIG maillist - Pythonmac-SIG at python.org
> > http://mail.python.org/mailman/listinfo/pythonmac-sig
> >
>
>
>
> --
>
> "lalalalala! it's not broken because I can use it"
>
> http://linux.slashdot.org/comments.pl?sid=194281&threshold=1&commentsort=0&mode=thread&cid=15927703
> _______________________________________________
> Pythonmac-SIG maillist - Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
>
>
--
"A little government and a little luck are necessary in life, but only
a fool trusts either of them." -- P. J. O'Rourke
From evenprimes at gmail.com Sat May 12 04:11:12 2007
From: evenprimes at gmail.com (Chris Cioffi)
Date: Fri, 11 May 2007 22:11:12 -0400
Subject: [Pythonmac-SIG] Problems with PYTHONPATH using MacPorts Python
2.4 & 2.5
In-Reply-To:
References:
<65fadfc30705091350p545f189cl59af2d86a8d4b194@mail.gmail.com>
<6A50B7A9-3FA0-4CEC-A044-BD0102770A8F@mac.com>
Message-ID:
Sorry about the dupe, I accidently hit send before I was ready...
On 5/11/07, Chris Cioffi wrote:
> On 5/11/07, Ronald Oussoren wrote:
> >
> >
> > On 9 May, 2007, at 22:50, Nehemiah Dacres wrote:
> [snip]
> > >> import sys
> > >> print sys.path
> >
> > you shall get a list of paths, these are the paths to all the directories
> > (folders) that the python interpreter will look in for libraries.
>
>
>
> >
> > On 5/5/07, Chris Cioffi wrote:
> > > Hello all,
> > >
> > > I'm trying to get started with Python 2.5 on my Mac and for various
> > > reasons would like to use th Python from MacPorts.
> > > [http://www.macports.org/]
> > >
> > > I've installed Python 2.5 and when I start it up I get the following:
> > >
> > > """
> > > Could not find platform dependent libraries
> > > Consider setting $PYTHONHOME to [:]
> > > Python 2.5 (r25:51908, May 4 2007, 19:57:54)
> > > [GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
> > > Type "help", "copyright", "credits" or "license" for more information.
> > > >>>
> > > """
> > >
> >
> > What happens when you temporarily remove .pydistutils.cfg? What is the
> > value of sys.executable (import sys;print sys.executable)?
Chris at ridcullys-computer:Chris$ python2.5
Python 2.5.1 (r251:54863, May 11 2007, 21:53:05)
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print sys.path
['', '/opt/local/lib/python25.zip', '/opt/local/lib/python2.5',
'/opt/local/lib/python2.5/plat-darwin',
'/opt/local/lib/python2.5/plat-mac',
'/opt/local/lib/python2.5/plat-mac/lib-scriptpackages',
'/opt/local/lib/python2.5/lib-tk',
'/opt/local/lib/python2.5/lib-dynload',
'/opt/local/lib/python2.5/site-packages']
>>> print sys.executable
/opt/local/bin/python2.5
> > This looks like a broken installation. You may want to ask on the macports
> > list about this. Another alternative is trying to reinstall (port uninstall
> > python25; port install python25), as a bonus you'll get python 2.5.1 instead
> > of 2.5 ;-)
I did this and now I don't get the warning about PYTHONHOME, however,
the library seems to be missing...pointing to a broken install. I'll
follow up to the MacPorts list.
> > As an aside: why do you want to use the MacPorts build of python instead of
> > the python.org one? This is just curiousity on my part, AFAIK both the
> > python.org build and the MacPorts one should work just fine.
> >
The short answer: because.
The longer answer: I'm using MacPorts for a fair number other
packages and would like to use it for trac as well...which requires
the Python from MacPorts...since I need the MacPorts Python I figured
that I'd just use it as the "default" python since that would just be
so much simpler! (Uh, yeah...)
The problem *may* stem from a prior install of MacPython from
python.org, I don't know.
Oh well...thanks!
Chris
--
"A little government and a little luck are necessary in life, but only
a fool trusts either of them." -- P. J. O'Rourke
From tsmaster at gmail.com Sat May 12 15:40:45 2007
From: tsmaster at gmail.com (Dave LeCompte)
Date: Sat, 12 May 2007 06:40:45 -0700
Subject: [Pythonmac-SIG] p2app OpenGL (egg?) difficulties
Message-ID:
I'm trying to use py2app on a script that uses OpenGL. I've been able to
make a py2exe wrapper of the script, which works fine. I don't know my way
around the mac environment quite as well, however.
When I try to run my binary, I get an error, saying
ImportError: No module named OpenGL.GL
looking at the output of my py2app invocation, I see that it notices I'm
using PyGame, because there's a line "*** using recipe: pygame ***", but I
don't see any reference to OpenGL.
I'm running on a PowerPC Mac, OSX 10.4.9
Python 2.5
OpenGL 3.0.0a6
pyapp 0.3.6
pygame 1.7.1release
I made a simple test case zip file that illustrates my problem here:
http://www.bigdicegames.com/Code/Samples/py2appTest.zip
I notice that the documentation mentions that py2app will try to make a
universal binary by default, and I think I turned that off with the
LSPrefersPPC flag.
I'm unclear if the documentation is trying to tell me that eggs are
unsupported - my OpenGL module is PyOpenGL-3.0.0a6-py2.5.egg, which is a
zip file. I installed that using easy_install, but I also tried
removing that and
building from source, which also created an egg. Should I avoid installing
zipped eggs? Is there a clean way to convert a directory full of
zipped eggs into
non-zipped installations?
I showed an acquaintance the original project (not the simple test case),
and he was able to use py2app on his intel Mac just fine, creating an app
from my program that seems to work for non-python users.
Any assistance will be appreciated.
-Dave LeCompte
From evenprimes at gmail.com Sun May 13 05:31:28 2007
From: evenprimes at gmail.com (Chris Cioffi)
Date: Sat, 12 May 2007 23:31:28 -0400
Subject: [Pythonmac-SIG] Problems with PYTHONPATH using MacPorts Python
2.4 & 2.5 - RESOLVED
Message-ID:
Problem: I was getting:
Could not find platform dependent libraries
Consider setting $PYTHONHOME to [:]
when I started Python that had been installed from MacPorts.
(Versions 2.4 and 2.5)
Solution:
I first uninstalled both Python2.4 and Python2.5 from MacPorts and
went through and also removed all traces of MacPython from Python.org.
I had missed some files before.
After doing this and re-installing the MacPorts Python everything
seems to be working as expected.
Chris
--
"A little government and a little luck are necessary in life, but only
a fool trusts either of them." -- P. J. O'Rourke
From Benjamin.A.Smith at warwick.ac.uk Mon May 14 13:58:54 2007
From: Benjamin.A.Smith at warwick.ac.uk (Benjamin.A.Smith at warwick.ac.uk)
Date: Mon, 14 May 2007 12:58:54 +0100 (BST)
Subject: [Pythonmac-SIG] "Wrong Architecture" problem with Xcode and PyObjC
Message-ID: <49737.86.20.228.10.1179143934.squirrel@smail.warwick.ac.uk>
Hi,
I'm a newbie to Python, so sorry if this is a little simple. I searched
around for a few hours and tried variations solutions but to no avail.
Hopefully somebody here might be able to point out what I've missed or
where I've gone wrong!
I recently decided to have a go at making a fairly simple Cocoa
application using the PyObjC bridge. I'm using a new Macbook with an Intel
processor.
Following the Apple tutorial to using Cocoa with Python (found at
http://developer.apple.com/cocoa/pyobjc.html) I installed the the PyObjC
1.3.7 installer package for Python 2.3 on Mac OS X 10.4 package.
I then went ahead and created a Python project in Xcode and, without
making any changes, tried to build it. I got the following error:
Tool:0: Command /usr/bin/env failed with exit code 1
Tool:0:
/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/PyObjC/objc/_objc.so:
mach-o, but wrong architecture
Tool:0: ImportError:
dlopen(/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/PyObjC/objc/_objc.so,
2): no suitable image found. Did find:
This suggested to me that I was using a PPC build of Python or of PyObjC.
I went ahead and installed Python 2.4.4 and as well as PyObjC 1.4 for
(Universal) Python 2.4 on Mac OS X 10.4.
The Python installation works fine, and I have run a number of scripts
using it without any errors. I ran the PyObjC installer mpkg and the
installation appeared to go smoothly, giving me no problems whatsoever.
I reopened Xcode and started another new Python application. However,
building it whilst empty gave exactly the same error code as before! This
suggests to me that Xcode is trying to use the same older files and is
ignoring the newer, universal installations. However, I have no idea about
how to change this, or indeed if this is actually the problem.
I would really like to be able to use Xcode and Interface Designer with
Python. My googling and various attempts to fix the problem or at least
work out exactly what is the going on have been to no avail. If anyone has
any ideas on how I might be able to get things rolling I would really,
really appreciate it.
Sincerely,
Benjamin Smith
From ronaldoussoren at mac.com Mon May 14 15:42:31 2007
From: ronaldoussoren at mac.com (Ronald Oussoren)
Date: Mon, 14 May 2007 06:42:31 -0700
Subject: [Pythonmac-SIG] "Wrong Architecture" problem with Xcode and
PyObjC
In-Reply-To: <49737.86.20.228.10.1179143934.squirrel@smail.warwick.ac.uk>
References: <49737.86.20.228.10.1179143934.squirrel@smail.warwick.ac.uk>
Message-ID:
On Monday, May 14, 2007, at 02:18PM, wrote:
>Hi,
>
>I'm a newbie to Python, so sorry if this is a little simple. I searched
>around for a few hours and tried variations solutions but to no avail.
>Hopefully somebody here might be able to point out what I've missed or
>where I've gone wrong!
>
>I recently decided to have a go at making a fairly simple Cocoa
>application using the PyObjC bridge. I'm using a new Macbook with an Intel
>processor.
>
>Following the Apple tutorial to using Cocoa with Python (found at
>http://developer.apple.com/cocoa/pyobjc.html) I installed the the PyObjC
>1.3.7 installer package for Python 2.3 on Mac OS X 10.4 package.
>
>I then went ahead and created a Python project in Xcode and, without
>making any changes, tried to build it. I got the following error:
>
>Tool:0: Command /usr/bin/env failed with exit code 1
>Tool:0:
> /System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/PyObjC/objc/_objc.so:
>mach-o, but wrong architecture
>Tool:0: ImportError:
>dlopen(/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/PyObjC/objc/_objc.so,
>2): no suitable image found. Did find:
>
>
>This suggested to me that I was using a PPC build of Python or of PyObjC.
>I went ahead and installed Python 2.4.4 and as well as PyObjC 1.4 for
>(Universal) Python 2.4 on Mac OS X 10.4.
>
>The Python installation works fine, and I have run a number of scripts
>using it without any errors. I ran the PyObjC installer mpkg and the
>installation appeared to go smoothly, giving me no problems whatsoever.
>
>I reopened Xcode and started another new Python application. However,
>building it whilst empty gave exactly the same error code as before! This
>suggests to me that Xcode is trying to use the same older files and is
>ignoring the newer, universal installations. However, I have no idea about
>how to change this, or indeed if this is actually the problem.
The short answer is that you have to update setup.py: the first line mentions the python interpreter that's used to build the application, change that to /usr/local/bin/python.
>
>I would really like to be able to use Xcode and Interface Designer with
>Python. My googling and various attempts to fix the problem or at least
>work out exactly what is the going on have been to no avail. If anyone has
>any ideas on how I might be able to get things rolling I would really,
>really appreciate it.
You don't have to use Xcode to use Interface Builder, although you may as well do so when you are comfortable with Xcode. IMHO Xcode isn't worth the trouble when you're only using it for Python programming, something like TextMate or even command-line editors would be a much better match.
Ronald
>
>Sincerely,
>Benjamin Smith
>
>
>
>_______________________________________________
>Pythonmac-SIG maillist - Pythonmac-SIG at python.org
>http://mail.python.org/mailman/listinfo/pythonmac-sig
>
>
From ronaldoussoren at mac.com Mon May 14 19:20:07 2007
From: ronaldoussoren at mac.com (Ronald Oussoren)
Date: Mon, 14 May 2007 19:20:07 +0200
Subject: [Pythonmac-SIG] p2app OpenGL (egg?) difficulties
In-Reply-To:
References:
Message-ID:
On 12 May, 2007, at 15:40, Dave LeCompte wrote:
> I'm trying to use py2app on a script that uses OpenGL. I've been
> able to
> make a py2exe wrapper of the script, which works fine. I don't know
> my way
> around the mac environment quite as well, however.
>
> When I try to run my binary, I get an error, saying
> ImportError: No module named OpenGL.GL
>
> looking at the output of my py2app invocation, I see that it
> notices I'm
> using PyGame, because there's a line "*** using recipe: pygame
> ***", but I
> don't see any reference to OpenGL.
>
> I'm running on a PowerPC Mac, OSX 10.4.9
> Python 2.5
> OpenGL 3.0.0a6
> pyapp 0.3.6
> pygame 1.7.1release
>
> I made a simple test case zip file that illustrates my problem here:
> http://www.bigdicegames.com/Code/Samples/py2appTest.zip
>
> I notice that the documentation mentions that py2app will try to
> make a
> universal binary by default, and I think I turned that off with the
> LSPrefersPPC flag.
>
> I'm unclear if the documentation is trying to tell me that eggs are
> unsupported - my OpenGL module is PyOpenGL-3.0.0a6-py2.5.egg, which
> is a
> zip file. I installed that using easy_install, but I also tried
> removing that and
> building from source, which also created an egg. Should I avoid
> installing
> zipped eggs? Is there a clean way to convert a directory full of
> zipped eggs into
> non-zipped installations?
The current release of py2app doesn't support zipped eggs. AFAIK
there is no easy solution for converting zipped eggs into unzipped
eggs. The easiest one is probably to move all zipped eggs to a
temporary directory and then easy_install them again using
``easy_install -Z somepackage.egg``.
I have a version of py2app that can extract dependencies from zipped
archives, but haven't had time to merge that into the repository yet.
In the longer run I'd like to teach py2app about eggs: it should
probably include entire eggs instead of just subsets.
Ronald
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3562 bytes
Desc: not available
Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20070514/fc0433d7/attachment.bin
From ronaldoussoren at mac.com Mon May 14 19:22:27 2007
From: ronaldoussoren at mac.com (Ronald Oussoren)
Date: Mon, 14 May 2007 19:22:27 +0200
Subject: [Pythonmac-SIG] Problems with PYTHONPATH using MacPorts
Python 2.4 & 2.5 - RESOLVED
In-Reply-To:
References:
Message-ID:
On 13 May, 2007, at 5:31, Chris Cioffi wrote:
> Problem: I was getting:
> Could not find platform dependent libraries
> Consider setting $PYTHONHOME to [:]
>
> when I started Python that had been installed from MacPorts.
> (Versions 2.4 and 2.5)
>
>
> Solution:
Thanks for telling us about the solution! I can't count the number of
times I've ran into problems an just found e-mails from folks running
into a simular issue without any hint of a solution. The worst are e-
mail threads where the original poster mentions that he's solved the
problem without mentioning the solution :-)
Ronald
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3562 bytes
Desc: not available
Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20070514/180731ae/attachment.bin
From jujulj at gmail.com Tue May 15 17:31:51 2007
From: jujulj at gmail.com (julien ricard)
Date: Tue, 15 May 2007 17:31:51 +0200
Subject: [Pythonmac-SIG] pyobjc class
Message-ID: <9e3f58c50705150831i26131d67jef675ffd6d96ab5e@mail.gmail.com>
hi,
I'm trying to convert the objective-c class iTunesConnection.h shown
below to a pyobjc class. What I've done so far is shown in
iTunesConnection.py.
The following line
nc.addObserver_selector_name_object_(self, selector(updateNow),
u"com.apple.iTunes.playerInfo",None)
returns an error: "global name 'selector' is not defined"
I'm very new to objc and pyobjc, and I'm investigating what's wrong
here, but if anybody could help...
thanks!
Julien
*************************iTunesConnection.h****************************************
#import
#import
#import
@interface iTunesConnection : NSObject
- (id) init;
@end
@implementation iTunesConnection
- (id) init {
NSDistributedNotificationCenter *nc =
[NSDistributedNotificationCenter defaultCenter];
[nc addObserver:self
selector:@selector(updateNow:)
name:@"com.apple.iTunes.playerInfo"
object:nil];
return self;
}
- (void) updateNow:(NSNotification *)notification {
NSString *updateScript = [NSString stringWithFormat:@"tell
application \nend tell"];
NSAppleScript *as = [[[NSAppleScript alloc]
initWithSource:updateScript] autorelease];
[as executeAndReturnError:nil];
}
@end
*****************************************************************
*************************iTunesConnection.py****************************************
from Foundation import *
class iTunesConnection(NSObject):
def init(self):
self = super(iTunesConnection, self).init()
nc = NSDistributedNotificationCenter.defaultCenter()
nc.addObserver_selector_name_object_(self,
selector(updateNow), u"com.apple.iTunes.playerInfo",None)
return self
def updateNow(???):
????
******************************************************************
From vivacarlie at gmail.com Tue May 15 20:17:19 2007
From: vivacarlie at gmail.com (Nehemiah Dacres)
Date: Tue, 15 May 2007 13:17:19 -0500
Subject: [Pythonmac-SIG] Fwd: pyobjc class
In-Reply-To: <65fadfc30705151116t57f808dfi1eae8930ac65fec@mail.gmail.com>
References: <9e3f58c50705150831i26131d67jef675ffd6d96ab5e@mail.gmail.com>
<65fadfc30705151116t57f808dfi1eae8930ac65fec@mail.gmail.com>
Message-ID: <65fadfc30705151117s72cef652ma3beb9407b0b34be@mail.gmail.com>
---------- Forwarded message ----------
From: Nehemiah Dacres
Date: May 15, 2007 1:16 PM
Subject: Re: [Pythonmac-SIG] pyobjc class
To: julien ricard
that @ symbol means that the term is a compiler directive, in other words,
its a reserved word in the Objective-C language thats how you get the method
selector of a given method. find the python or pyobjc equivalent of that and
use that method instead.
On 5/15/07, julien ricard wrote:
>
> hi,
>
> I'm trying to convert the objective-c class iTunesConnection.h shown
> below to a pyobjc class. What I've done so far is shown in
> iTunesConnection.py.
> The following line
>
> nc.addObserver_selector_name_object _(self, selector(updateNow),
> u"com.apple.iTunes.playerInfo",None)
>
> returns an error: "global name 'selector' is not defined"
>
> I'm very new to objc and pyobjc, and I'm investigating what's wrong
> here, but if anybody could help...
>
> thanks!
> Julien
>
>
>
>
> *************************
> iTunesConnection.h****************************************
>
>
> #import
> #import
> #import
>
> @interface iTunesConnection : NSObject
> - (id) init;
> @end
>
> @implementation iTunesConnection
> - (id) init {
> NSDistributedNotificationCenter *nc =
> [NSDistributedNotificationCenter defaultCenter];
> [nc addObserver:self
> selector:@selector(updateNow:)
> name:@"com.apple.iTunes.playerInfo "
> object:nil];
>
> return self;
> }
>
> - (void) updateNow:(NSNotification *)notification {
> NSString *updateScript = [NSString stringWithFormat:@"tell
> application \nend tell"];
> NSAppleScript *as = [[[NSAppleScript alloc]
> initWithSource:updateScript] autorelease];
> [as executeAndReturnError:nil];
> }
> @end
>
> *****************************************************************
>
>
> *************************
> iTunesConnection.py****************************************
>
> from Foundation import *
>
> class iTunesConnection(NSObject):
>
> def init(self):
>
> self = super(iTunesConnection, self).init()
>
> nc = NSDistributedNotificationCenter.defaultCenter()
> nc.addObserver_selector_name_object_(self,
> selector(updateNow), u"com.apple.iTunes.playerInfo",None)
>
> return self
>
> def updateNow(???):
> ????
> ******************************************************************
> _______________________________________________
> Pythonmac-SIG maillist - Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
>
--
"lalalalala! it's not broken because I can use it"
http://linux.slashdot.org/comments.pl?sid=194281&threshold=1&commentsort=0&mode=thread&cid=15927703
--
"lalalalala! it's not broken because I can use it"
http://linux.slashdot.org/comments.pl?sid=194281&threshold=1&commentsort=0&mode=thread&cid=15927703
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20070515/15d73683/attachment.htm
From stephenlists at gmail.com Thu May 17 18:50:38 2007
From: stephenlists at gmail.com (Stephen Uhlhorn)
Date: Thu, 17 May 2007 12:50:38 -0400
Subject: [Pythonmac-SIG] PIL 1.1.6 for OS X
Message-ID:
Hello-
Are there binaries of PIL 1.1.6 available for OS X? The most recent
versions on pythonmac.org are 1.1.5 and I would like to use the new
fromarray() method in version 1.1.6.
Are there plans to put an updated version on teh site?
Thanks-
-stephen
From kw at codebykevin.com Fri May 18 16:15:09 2007
From: kw at codebykevin.com (Kevin Walzer)
Date: Fri, 18 May 2007 10:15:09 -0400
Subject: [Pythonmac-SIG] PIL 1.1.6 for OS X
In-Reply-To:
References:
Message-ID: <464DB4ED.4040203@codebykevin.com>
Building PIL from source is trivially easy. Assuming you have the latest
universal MacPython installed, and the latest developer tools, it's as
simple as "sudo python setup.py install."
Stephen Uhlhorn wrote:
> Hello-
>
> Are there binaries of PIL 1.1.6 available for OS X? The most recent
> versions on pythonmac.org are 1.1.5 and I would like to use the new
> fromarray() method in version 1.1.6.
>
> Are there plans to put an updated version on teh site?
>
> Thanks-
> -stephen
> _______________________________________________
> Pythonmac-SIG maillist - Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
>
>
--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
From ronaldoussoren at mac.com Fri May 18 17:48:19 2007
From: ronaldoussoren at mac.com (Ronald Oussoren)
Date: Fri, 18 May 2007 08:48:19 -0700
Subject: [Pythonmac-SIG] PIL 1.1.6 for OS X
In-Reply-To: <464DB4ED.4040203@codebykevin.com>
References:
<464DB4ED.4040203@codebykevin.com>
Message-ID: <999A4897-0112-1000-A15B-702A8657D20B-Webmail-10024@mac.com>
On Friday, May 18, 2007, at 04:19PM, "Kevin Walzer" wrote:
>Building PIL from source is trivially easy. Assuming you have the latest
>universal MacPython installed, and the latest developer tools, it's as
>simple as "sudo python setup.py install."
Not quite, you also have to install libjpeg to get jpeg support.
That said, installing is still pretty easy. That said, I have no plans to upload new binaries in the short term.
Ronald
>
>Stephen Uhlhorn wrote:
>> Hello-
>>
>> Are there binaries of PIL 1.1.6 available for OS X? The most recent
>> versions on pythonmac.org are 1.1.5 and I would like to use the new
>> fromarray() method in version 1.1.6.
>>
>> Are there plans to put an updated version on teh site?
>>
>> Thanks-
>> -stephen
>> _______________________________________________
>> Pythonmac-SIG maillist - Pythonmac-SIG at python.org
>> http://mail.python.org/mailman/listinfo/pythonmac-sig
>>
>>
>
>
>--
>Kevin Walzer
>Code by Kevin
>http://www.codebykevin.com
>_______________________________________________
>Pythonmac-SIG maillist - Pythonmac-SIG at python.org
>http://mail.python.org/mailman/listinfo/pythonmac-sig
>
>
From Chris.Barker at noaa.gov Fri May 18 17:56:39 2007
From: Chris.Barker at noaa.gov (Christopher Barker)
Date: Fri, 18 May 2007 08:56:39 -0700
Subject: [Pythonmac-SIG] PIL 1.1.6 for OS X
In-Reply-To: <999A4897-0112-1000-A15B-702A8657D20B-Webmail-10024@mac.com>
References:
<464DB4ED.4040203@codebykevin.com>
<999A4897-0112-1000-A15B-702A8657D20B-Webmail-10024@mac.com>
Message-ID: <464DCCB7.1070509@noaa.gov>
Ronald Oussoren wrote:
> Not quite, you also have to install libjpeg to get jpeg support.
And the tricky thing about that is that you need a Universal libjpeg.
Maybe this page will help:
http://wiki.python.org/moin/MacPython/UniversalLibrariesAndExtensions
From there, it looks like you might need freetype too. However, I think
recent versions of OS-X (10.4.8+ ?) may have a usable libfreetype, at
least if you have X11 installed.
If someone gets it built, you can make a mpkg out of it with bdist_mpkg
(which comes with py2app, I think). Then you can contribute it to
pythonmac by sending it to Bob Ipollito.
Note that modules contributed to pythonmac should be statically linked
against all non-apple provided libs, they will "just work" for everyone.
-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 rowen at cesmail.net Fri May 18 22:13:34 2007
From: rowen at cesmail.net (Russell E. Owen)
Date: Fri, 18 May 2007 13:13:34 -0700
Subject: [Pythonmac-SIG] PIL 1.1.6 for OS X
Message-ID:
I built a binary installer for PIL 1.1.6 and submitted it to Bob
Ippolito for pythonmac.org. If Bob has time it should show up in a day
or two.
-- Russell
From ccoal.mail at gmail.com Sat May 19 23:46:55 2007
From: ccoal.mail at gmail.com (Calder Coalson)
Date: Sat, 19 May 2007 16:46:55 -0500
Subject: [Pythonmac-SIG] Stupid question
Message-ID: <17403E94-D6F1-4D08-9215-9B4DF2E5D776@gmail.com>
This probably has the simplest solution ever, but how do you run a
python file from another python program? I've tried import, but that
doesn't work because the thing has to be completely independent. All
I want to do is split up my file into multiple files, but I can't
find a command just to RUN it anywhere!
Thanks for any help...
From hraban at fiee.net Sun May 20 07:04:40 2007
From: hraban at fiee.net (Henning Hraban Ramm)
Date: Sun, 20 May 2007 07:04:40 +0200
Subject: [Pythonmac-SIG] Stupid question
In-Reply-To: <17403E94-D6F1-4D08-9215-9B4DF2E5D776@gmail.com>
References: <17403E94-D6F1-4D08-9215-9B4DF2E5D776@gmail.com>
Message-ID: <4A8ACABE-440F-4E33-9DD3-CAE7609794D4@fiee.net>
Am 2007-05-19 um 23:46 schrieb Calder Coalson:
> This probably has the simplest solution ever, but how do you run a
> python file from another python program? I've tried import, but that
> doesn't work because the thing has to be completely independent. All
> I want to do is split up my file into multiple files, but I can't
> find a command just to RUN it anywhere!
The Perl people would say: TMTOWTDI
- It depends if the different apps use any GUI and/or async/event/
server framework
- os.system('python yourapp.py') # not preferrable
- via the subprocess module
- I write completeley independents apps whose important classes I can
import and instance in another app anyway. (A matter of clean design.)
You should specify what you really want to do.
Greetlings from Lake Constance!
Hraban
---
http://www.fiee.net
https://www.cacert.org (I'm an assurer)
From ronaldoussoren at mac.com Sun May 20 09:57:48 2007
From: ronaldoussoren at mac.com (Ronald Oussoren)
Date: Sun, 20 May 2007 00:57:48 -0700
Subject: [Pythonmac-SIG] Stupid question
In-Reply-To: <17403E94-D6F1-4D08-9215-9B4DF2E5D776@gmail.com>
References: <17403E94-D6F1-4D08-9215-9B4DF2E5D776@gmail.com>
Message-ID: <999A4897-0112-1000-B82A-702A8657D20B-Webmail-10024@mac.com>
On Saturday, May 19, 2007, at 11:48PM, "Calder Coalson" wrote:
>This probably has the simplest solution ever, but how do you run a
>python file from another python program? I've tried import, but that
>doesn't work because the thing has to be completely independent. All
>I want to do is split up my file into multiple files, but I can't
>find a command just to RUN it anywhere!
Subprocess should be your friend here: http://docs.python.org/lib/module-subprocess.html
Ronald
>
>Thanks for any help...
>_______________________________________________
>Pythonmac-SIG maillist - Pythonmac-SIG at python.org
>http://mail.python.org/mailman/listinfo/pythonmac-sig
>
>
From kent37 at tds.net Sun May 20 13:37:51 2007
From: kent37 at tds.net (Kent Johnson)
Date: Sun, 20 May 2007 07:37:51 -0400
Subject: [Pythonmac-SIG] Stupid question
In-Reply-To: <17403E94-D6F1-4D08-9215-9B4DF2E5D776@gmail.com>
References: <17403E94-D6F1-4D08-9215-9B4DF2E5D776@gmail.com>
Message-ID: <4650330F.6020201@tds.net>
Calder Coalson wrote:
> I've tried import, but that
> doesn't work because the thing has to be completely independent. All
> I want to do is split up my file into multiple files,
These requirements seem a bit contradictory. If you have one program
that you want to split into multiple modules, import is the usual
mechanism for doing that. What kind of independence are you looking for?
If you truly need the programs to run in separate processes then the
other answers are on the right track. Otherwise I'm not so sure what it
is you need.
Kent
From kent37 at tds.net Sun May 20 15:22:47 2007
From: kent37 at tds.net (Kent Johnson)
Date: Sun, 20 May 2007 09:22:47 -0400
Subject: [Pythonmac-SIG] Stupid question
In-Reply-To:
References: <17403E94-D6F1-4D08-9215-9B4DF2E5D776@gmail.com>
<4650330F.6020201@tds.net>
Message-ID: <46504BA7.1020708@tds.net>
Calder Coalson wrote:
> Ok, I have a program with multiple different states, but it does, (to
> some extent) run linearly. All I want to do, is to be able to take
> chunks of the program and put it in separate files so I don't have to
> scroll through a couple thousand lines of stuff every time I want to
> find the right part of the code. I guess I could just right a master
> program that takes all of the text files and smashes them together and
> then runs it. But is there any other way to do it?
That is exactly what modules and imports let you do.
It sounds like maybe your program might not be very well organized.
Maybe you need to break up your program into functions or classes. Then
some of these functions or classes could be put into separate modules.
>
> The problem with modules is that they run in their own Python shell.
No, they run in the same process as the module that imports them.
> Libraries I've imported in the main program and variables I've
> defined there aren't accessible in the module. What I really need is
> just a
> run_file("/Users/calderco/Pygame/T-Board/thefile.py")
Right, modules do have their own namespace. You can import the modules
you need. Variables you need access to can be passed as parameters to
functions defined in a module.
A tutorial on modules:
http://www.freenetpages.co.uk/hp/alan.gauld/ (Modules and Functions section)
Kent
>
> I guess the assimilator program shouldn't take that long, but it
> really seems like there should be an easy way to do this.
>
> Thanks for the help,
> -Calder
>
>
> On May 20, 2007, at 6:37 AM, Kent Johnson wrote:
>
>> Calder Coalson wrote:
>>> I've tried import, but that doesn't work because the thing has to
>>> be completely independent. All I want to do is split up my file
>>> into multiple files,
>>
>> These requirements seem a bit contradictory. If you have one program
>> that you want to split into multiple modules, import is the usual
>> mechanism for doing that. What kind of independence are you looking
>> for? If you truly need the programs to run in separate processes then
>> the other answers are on the right track. Otherwise I'm not so sure
>> what it is you need.
>>
>> Kent
>
>
From tom.and at tiscalinet.it Mon May 21 13:24:29 2007
From: tom.and at tiscalinet.it (Andrea Tomadin)
Date: Mon, 21 May 2007 13:24:29 +0200
Subject: [Pythonmac-SIG] Stupid question
Message-ID: <26517152-CF6B-4B89-9981-A8267173BF68@tiscalinet.it>
Calder Coalson wrote:
> All I want to do is split up my file into multiple files,
Why not a simple execfile("otherprogram.py")?
All the code in otherprogram.py is executed as if it was typed into
the main program.
No namespace issues or import problems. (Not OOP either, in fact!)
Hope this helps,
Andrea
From kent37 at tds.net Mon May 21 13:56:29 2007
From: kent37 at tds.net (Kent Johnson)
Date: Mon, 21 May 2007 07:56:29 -0400
Subject: [Pythonmac-SIG] Stupid question
In-Reply-To: <030C6AF0-3851-4E90-B85B-506FE0B9E375@gmail.com>
References: <17403E94-D6F1-4D08-9215-9B4DF2E5D776@gmail.com>
<4650330F.6020201@tds.net>
<46504BA7.1020708@tds.net>
<030C6AF0-3851-4E90-B85B-506FE0B9E375@gmail.com>
Message-ID: <465188ED.5060600@tds.net>
Calder Coalson wrote:
>> That is exactly what modules and imports let you do.
> It really doesn't seem to be doing that, because I import a bunch of
> stuff and define it in my main file, then I import another file and it
> can't use the global variables and the modules imported in the main file.
Right. Each module has its own namespace. That is not the same as having
its own interpreter. Any modules and variables you want to use in a
module have to be imported or otherwise made available to that module.
Python "global" variables are not really global, they have module scope
- they are only available in the module in which they are defined (or
imported, which is a way of defining something).
>> It sounds like maybe your program might not be very well organized.
> Probably true, :D Anyway, what I've done is right a small program to
> lop all the code together. Here:
>
> import os
>
> final = ""
> def load(name):
> new = open(os.path.join("Components", name))
> globals()["final"] = globals()["final"]+new.read()+"\n\n\n\n"
>
> load("StartCode.py")
> # load more loops here
> load("StartLoop.py")
>
> program = open(os.path.join("Compiled.py"), "w")
> program.write(final)
>
> import Compiled
> os.remove(os.path.join("Compiled.py"))
> os.remove(os.path.join("Compiled.pyc"))
>
> That seems to do the trick.
Well if you're happy maybe I should leave well enough alone but this
sure looks ugly to me. I strongly recommend that you learn how to use
the tools Python gives you to solve this problem. Misunderstanding the
tool and saying "it doesn't work" and kludging up your own way to solve
the problem is like trying to use a hammer the wrong way around, finding
it doesn't work, and using a rock instead. You will be better off in the
long run learning the right way to use a hammer.
>> Maybe you need to break up your program into functions or classes.
>> Then some of these functions or classes could be put into separate
>> modules.
> I'll try to do that in the future, but I'm relatively new to Python, and
> I'm still learning how I can effectively take advantages of classes and
> stuff.
Start with functions. My guess is that you could find some bits of
functionality that could be broken out into functions. Some of the
functions would probably be related and could go into separate modules.
You might want to join the python-tutor list:
http://mail.python.org/mailman/listinfo/tutor
Kent
From khorton01 at rogers.com Tue May 22 00:49:20 2007
From: khorton01 at rogers.com (Kevin Horton)
Date: Mon, 21 May 2007 18:49:20 -0400
Subject: [Pythonmac-SIG] Testing applications with console input?
Message-ID: <6299DD72-22B7-4FF6-864B-81886303F85C@rogers.com>
I'm working on a small application that will respond to user input
via the console. It is a very simple interface, with user input via
"raw_input()", and the application produces result via "print"
statements. I'm using python 2.5.1 on OS X, installed via Fink, but
I'll also use the application with Movable Python 2.4.3 on Windows.
I've got unit tests for many of the discrete units, but I still need
to write some tests for the user interface, to help catch problems
when refactoring code, etc. I've searched the web, but I can't find
any description of how to write tests for such a user interface. Any
advice would be appreciated.
Kevin Horton
Ottawa, Canada
From gary.bernhardt at gmail.com Tue May 22 01:27:37 2007
From: gary.bernhardt at gmail.com (Gary Bernhardt)
Date: Mon, 21 May 2007 19:27:37 -0400
Subject: [Pythonmac-SIG] Testing applications with console input?
In-Reply-To: <6299DD72-22B7-4FF6-864B-81886303F85C@rogers.com>
References: <6299DD72-22B7-4FF6-864B-81886303F85C@rogers.com>
Message-ID: <9c34c72e0705211627q6b87058aya17fca33cea6251e@mail.gmail.com>
On 5/21/07, Kevin Horton wrote:
> I'm working on a small application that will respond to user input
> via the console. It is a very simple interface, with user input via
> "raw_input()", and the application produces result via "print"
> statements. I'm using python 2.5.1 on OS X, installed via Fink, but
> I'll also use the application with Movable Python 2.4.3 on Windows.
>
> I've got unit tests for many of the discrete units, but I still need
> to write some tests for the user interface, to help catch problems
> when refactoring code, etc. I've searched the web, but I can't find
> any description of how to write tests for such a user interface. Any
> advice would be appreciated.
Two methods come to mind:
1. popen your program from the test and interact with it that way.
This is pretty easy with the subprocess module.
2. Modify your program to use a slightly more abstract IO interface.
This can be as simple as a class that has input() and output()
functions. Under normal conditions, it just passes the calls on to
'raw_input' and 'print'. To test it, you can monkey patch the program
to use an alternative IO class that puts the test in control. Or if
you're feeling fancy, you can use dependency injection to achieve the
same effect.
These are just off the top of my head, so there may be pitfalls. :)
I'd probably favor #2 because spawning processes can bloat your tests
up and slow them down. Then again, it sounds like you're looking for
a system test, not a unit test, so maybe spawning a process is the
right thing to do.
By the way, there's a pretty new testing-in-python list that's quite
good for this kind of question:
http://lists.idyll.org/listinfo/testing-in-python
--
Gary
http://blog.extracheese.org
From khorton01 at rogers.com Tue May 22 02:48:34 2007
From: khorton01 at rogers.com (Kevin Horton)
Date: Mon, 21 May 2007 20:48:34 -0400
Subject: [Pythonmac-SIG] Testing applications with console input?
In-Reply-To: <9c34c72e0705211627q6b87058aya17fca33cea6251e@mail.gmail.com>
References: <6299DD72-22B7-4FF6-864B-81886303F85C@rogers.com>
<9c34c72e0705211627q6b87058aya17fca33cea6251e@mail.gmail.com>
Message-ID:
On 21 May 2007, at 19:27, Gary Bernhardt wrote:
> On 5/21/07, Kevin Horton wrote:
>> I'm working on a small application that will respond to user input
>> via the console. It is a very simple interface, with user input via
>> "raw_input()", and the application produces result via "print"
>> statements. I'm using python 2.5.1 on OS X, installed via Fink, but
>> I'll also use the application with Movable Python 2.4.3 on Windows.
>>
>> I've got unit tests for many of the discrete units, but I still need
>> to write some tests for the user interface, to help catch problems
>> when refactoring code, etc. I've searched the web, but I can't find
>> any description of how to write tests for such a user interface. Any
>> advice would be appreciated.
>
> Two methods come to mind:
>
> 1. popen your program from the test and interact with it that way.
> This is pretty easy with the subprocess module.
subprocess looks interesting. I played a bit in iPython, and managed
to get a response from my program, so this might work.
> 2. Modify your program to use a slightly more abstract IO interface.
> This can be as simple as a class that has input() and output()
> functions. Under normal conditions, it just passes the calls on to
> 'raw_input' and 'print'. To test it, you can monkey patch the program
> to use an alternative IO class that puts the test in control. Or if
> you're feeling fancy, you can use dependency injection to achieve the
> same effect.
I'm a python newbie, so this approach looks a bit daunting at the
moment. But, it might be a good way to learn a lot of useful stuff.
> These are just off the top of my head, so there may be pitfalls. :)
> I'd probably favor #2 because spawning processes can bloat your tests
> up and slow them down. Then again, it sounds like you're looking for
> a system test, not a unit test, so maybe spawning a process is the
> right thing to do.
Yes, I really am doing full system tests, so I want to simulate "real
world" user interaction with my program as closely as possible.
Speed is not a huge issue, within reason.
> By the way, there's a pretty new testing-in-python list that's quite
> good for this kind of question:
> http://lists.idyll.org/listinfo/testing-in-python
I had seen mention of this on someone's python blog, but had
forgotten about it. Thanks for the reminder. I'll have a look at
the list archives, and probably dare a newbie question.
Thanks,
Kevin Horton
Ottawa, Canada
From afrojas at gmail.com Mon May 28 02:04:25 2007
From: afrojas at gmail.com (Andres Francisco Rojas)
Date: Sun, 27 May 2007 17:04:25 -0700
Subject: [Pythonmac-SIG] CGI + appscript newbie question/problem
Message-ID:
Hey everyone. So I'm more or less new to Python, just wanted to say that
right up front so please excuse any silly questions.
Generally what I'm trying to do is control a Mac OS X application through a
website via Python and appscript. I have successfully got Apache running and
configured to run Python scripts, basic modules like os and cgi work and I
can do silly form processing and stuff like that, so I know Python itself is
good to go, along with the web server. I can execute AppleScript commands,
and control applications, successfully using appscript when using Python via
Terminal (and following along with the examples), but when I try to import
appscript into the script run as cgi I get an 500 Internal Server Error. I
know it's the import call because I can comment it out and the script runs,
but I can't do any AppleScripting (obviously).
Is there a limitation to running appscript when in cgi on Apache? Is there
an Apache setting I'm missing? Everything is local, by the way, running off
the machine I'm writing this message on. Below is the code that Apache runs:
#!/usr/bin/python
import cgi
from appscript import *
print "Content-Type: text/html\n\n"
# Define function to generate HTML form.
def generate_form():
print "\n"
print "\n"
print "\tInfo Form\n"
print "\n"
print "\n"
print "\t