pyobjc-dev Mailing List for PyObjC (Page 23)
Brought to you by:
ronaldoussoren
You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(9) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(1) |
Feb
(2) |
Mar
(3) |
Apr
(30) |
May
(18) |
Jun
|
Jul
(4) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2002 |
Jan
(7) |
Feb
(2) |
Mar
(1) |
Apr
|
May
|
Jun
(3) |
Jul
(13) |
Aug
|
Sep
(23) |
Oct
(180) |
Nov
(291) |
Dec
(95) |
2003 |
Jan
(338) |
Feb
(352) |
Mar
(97) |
Apr
(46) |
May
(226) |
Jun
(184) |
Jul
(145) |
Aug
(141) |
Sep
(69) |
Oct
(161) |
Nov
(96) |
Dec
(90) |
2004 |
Jan
(66) |
Feb
(87) |
Mar
(98) |
Apr
(132) |
May
(115) |
Jun
(68) |
Jul
(150) |
Aug
(92) |
Sep
(59) |
Oct
(52) |
Nov
(17) |
Dec
(75) |
2005 |
Jan
(84) |
Feb
(191) |
Mar
(133) |
Apr
(114) |
May
(158) |
Jun
(185) |
Jul
(62) |
Aug
(28) |
Sep
(36) |
Oct
(88) |
Nov
(65) |
Dec
(43) |
2006 |
Jan
(85) |
Feb
(62) |
Mar
(92) |
Apr
(75) |
May
(68) |
Jun
(101) |
Jul
(73) |
Aug
(37) |
Sep
(91) |
Oct
(65) |
Nov
(30) |
Dec
(39) |
2007 |
Jan
(24) |
Feb
(28) |
Mar
(10) |
Apr
(2) |
May
(18) |
Jun
(16) |
Jul
(21) |
Aug
(6) |
Sep
(30) |
Oct
(31) |
Nov
(153) |
Dec
(31) |
2008 |
Jan
(63) |
Feb
(70) |
Mar
(47) |
Apr
(24) |
May
(59) |
Jun
(22) |
Jul
(12) |
Aug
(7) |
Sep
(14) |
Oct
(26) |
Nov
(5) |
Dec
(5) |
2009 |
Jan
(10) |
Feb
(41) |
Mar
(70) |
Apr
(88) |
May
(49) |
Jun
(62) |
Jul
(34) |
Aug
(15) |
Sep
(55) |
Oct
(40) |
Nov
(67) |
Dec
(21) |
2010 |
Jan
(60) |
Feb
(17) |
Mar
(26) |
Apr
(26) |
May
(29) |
Jun
(4) |
Jul
(21) |
Aug
(21) |
Sep
(10) |
Oct
(12) |
Nov
(3) |
Dec
(19) |
2011 |
Jan
(3) |
Feb
(13) |
Mar
(8) |
Apr
(8) |
May
(17) |
Jun
(20) |
Jul
(21) |
Aug
(7) |
Sep
|
Oct
|
Nov
(9) |
Dec
(11) |
2012 |
Jan
(3) |
Feb
|
Mar
|
Apr
(5) |
May
(4) |
Jun
(14) |
Jul
(5) |
Aug
(2) |
Sep
(15) |
Oct
(2) |
Nov
(23) |
Dec
(1) |
2013 |
Jan
(8) |
Feb
(1) |
Mar
|
Apr
|
May
(5) |
Jun
(1) |
Jul
(5) |
Aug
(4) |
Sep
|
Oct
(12) |
Nov
(10) |
Dec
(3) |
2014 |
Jan
(7) |
Feb
(14) |
Mar
(2) |
Apr
|
May
(2) |
Jun
(11) |
Jul
(10) |
Aug
(4) |
Sep
|
Oct
(8) |
Nov
(1) |
Dec
(2) |
2015 |
Jan
(9) |
Feb
(7) |
Mar
(1) |
Apr
|
May
(7) |
Jun
|
Jul
(5) |
Aug
(6) |
Sep
|
Oct
(1) |
Nov
(4) |
Dec
|
2016 |
Jan
(1) |
Feb
(1) |
Mar
(4) |
Apr
(2) |
May
(1) |
Jun
|
Jul
(6) |
Aug
(8) |
Sep
(21) |
Oct
(17) |
Nov
|
Dec
(36) |
2017 |
Jan
(6) |
Feb
(2) |
Mar
(4) |
Apr
(2) |
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(1) |
Oct
|
Nov
(1) |
Dec
(6) |
2018 |
Jan
(2) |
Feb
(3) |
Mar
(3) |
Apr
(14) |
May
(2) |
Jun
(2) |
Jul
(4) |
Aug
(3) |
Sep
(6) |
Oct
(16) |
Nov
(1) |
Dec
(6) |
2019 |
Jan
(3) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
(6) |
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(2) |
Jun
(1) |
Jul
(7) |
Aug
(1) |
Sep
(1) |
Oct
|
Nov
(2) |
Dec
(1) |
2021 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
(5) |
Sep
(1) |
Oct
|
Nov
(1) |
Dec
|
2023 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
2025 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Michael M. <mic...@gm...> - 2011-02-10 16:43:08
|
I was experimenting with migrating from an old XCode template based project to py2app last night. The first thing I tried was to clone Ronald's bitbucket repo for py2app and install it from there, but it seemed to require a version of modulegraph (0.8.1) that doesn't exist yet - even in the modulegraph repo… Was I doing that correctly? I backed off to the last version of py2app on pypi, but it looked like I might be missing out on some useful bug fixes, so I thought I'd mention it. PS, also - I failed to successfully migrate my project, but that might be the topic for a longer email. Briefly, though - is there a guide for migrating anywhere? If not, I'll share my troubles and maybe we can write one here. Thanks, -mike |
From: Ronald O. <ron...@ma...> - 2011-02-08 13:40:29
|
On 6 Feb, 2011, at 11:26, Phillip Nguyen wrote: > > Hi, > > I'm writing code for Snow Leopard that I would like to support the default installed version of PyObjC. I'm calling NSOpenGLContext.setValues_forParameter_() which takes as its first argument a pointer to an int (or array of ints). It seems to work fine in PyObjC 2.3, but in PyObjC 2.2b3 I get > > ValueError: depythonifying 'pointer', got 'int' > > I don't know enough about PyObjC to figure out how to supply the 'pointer' that it wants. Currently I am using a horrible hack involving ctypes: That's probably the easiest way to do this in 2.2b3, I've fisxed a number of bugs in the wrappes in later versions and this is one of them. The fix involved changed to C code and is hence not easily reproduced in scripts. Ronald |
From: Ronald O. <ron...@ma...> - 2011-02-08 13:39:09
|
On 4 Feb, 2011, at 21:55, Trevor Bentley wrote: >> IMHO your problem is not PyObjc - you have everything you need there. It's getting things into NumPy. >> >> One way would be to use ctypes. You can create a pointer to whatever data-type you want, and initialize that with the returned integer. I don't have example code right here (wrong machine), but it's not that hard. >> >> then at least you can access the data properly, and stuff it into a NumPy array. >> >> However, the best solution would of course be to be able to create a NumPy array based on the pointer. I know NumPy has a C-API, maybe that's exposed somehow? >> >> Diez > > That's where I took it immediately after sending the e-mail: ctypes > pointers. I managed to get a pointer to something... maybe it's pixel > data. NumPy doesn't want to import my pointer as an array, and it turns > out I don't know what format the returned data is in, anyway. > > Since efficiency isn't even a slight concern, I actually found a > technique that works... Which techinque did you find? Ronald |
From: Ronald O. <ron...@ma...> - 2011-02-08 13:36:54
|
On 4 Feb, 2011, at 18:16, Trevor Bentley wrote: > Hello, > > I am working on a small Python script to grab a single frame from the > iSight camera using PyObjC. I want to import the frame into a python > numpy array for manipulation, and I want to write it exclusively in > Python. I have fairly limited experience in Python and Objective-C, and > no prior experience with PyObjC. > > I have made some progress, and currently it is able to find the camera, > open it, and capture a frame. The frame data is (theoretically) > available in my QTCaptureDecompressedVideoOutput delegate's callback > function: > > - (void)captureOutput:(QTCaptureOutput *)captureOutput > didOutputVideoFrame:(CVImageBufferRef)videoFrame > withSampleBuffer:(QTSampleBuffer *)sampleBuffer > fromConnection:(QTCaptureConnection *)connection > > So I added "pdb.set_trace()" at the beginning of the callback, and am > trying to figure out how to get the raw bytes available in Python. > > The closest I have come is examining sampleBuffer: > -------------------------------------------------- > (Pdb) sampleBuffer > <QTSampleBuffer: 0x1044b42d0> > (Pdb) sampleBuffer.numberOfSamples() > 1 > (Pdb) sampleBuffer.lengthForAllSamples() > 2624000 > (Pdb) sampleBuffer.bytesForAllSamples() > 4674363392L That's a bug, PyObjC should be smart enough to know that it supposed to return a buffer (string/bytes/...) in bytesForAllSamples. I will fix this in a future version, but don't know yet when that will be. Sadly enough I'll have to write some C code for that. I haven't used ctypes myself beyond simple hello-world level scripts, but it should be possible to tell ctypes that the integer you get back from bytesForSamples is actually a 'void*', and that should give you a way to copy the buffer into a python string. Ronald |
From: Phillip N. <evi...@gm...> - 2011-02-07 00:58:46
|
> Seeing as it's really a pointer to an array, have you tried > something obvious such as a list of ints? Trying self._nscontext.setValues_forParameter_([ 1 ], NSOpenGLCPSwapInterval) just gives me ValueError: depythonifying 'pointer', got 'list' instead. Is there another way for me to pass in an array of ints? --phillip |
From: Greg E. <gre...@ca...> - 2011-02-06 21:48:02
|
Phillip Nguyen wrote: > I'm calling > NSOpenGLContext.setValues_forParameter_() which takes as its first argument a > pointer to an int (or array of ints). It seems to work fine in PyObjC 2.3, but > in PyObjC 2.2b3 I get > > ValueError: depythonifying 'pointer', got 'int' Seeing as it's really a pointer to an array, have you tried something obvious such as a list of ints? -- Greg |
From: Phillip N. <evi...@gm...> - 2011-02-06 10:26:49
|
Hi, I'm writing code for Snow Leopard that I would like to support the default installed version of PyObjC. I'm calling NSOpenGLContext.setValues_forParameter_() which takes as its first argument a pointer to an int (or array of ints). It seems to work fine in PyObjC 2.3, but in PyObjC 2.2b3 I get ValueError: depythonifying 'pointer', got 'int' I don't know enough about PyObjC to figure out how to supply the 'pointer' that it wants. Currently I am using a horrible hack involving ctypes: def set_vsync(self, vsync=True): from objc import __version__ as pyobjc_version if pyobjc_version[:3] in ('2.3', '2.4'): self._nscontext.setValues_forParameter_(vsync, NSOpenGLCPSwapInterval) else: # This is an ugly hack, but it works. cglContext = self._nscontext.CGLContextObj() dir(cglContext) # must call dir in order to access pointerAsInteger??? from ctypes import cdll, util, c_void_p, c_int, byref ctypes_context = c_void_p(cglContext.pointerAsInteger) quartz = cdll.LoadLibrary(util.find_library('Quartz')) value = c_int(vsync) kCGLCPSwapInterval = 222 quartz.CGLSetParameter(ctypes_context, kCGLCPSwapInterval, byref(value)) So my question is: what is the correct way to write the else statement code in PyObjC 2.2? And why can I access cglContext.pointerAsInteger only after calling dir(cglContext)? --phillip |
From: Trevor B. <mr...@gm...> - 2011-02-04 20:55:16
|
> IMHO your problem is not PyObjc - you have everything you need there. It's getting things into NumPy. > > One way would be to use ctypes. You can create a pointer to whatever data-type you want, and initialize that with the returned integer. I don't have example code right here (wrong machine), but it's not that hard. > > then at least you can access the data properly, and stuff it into a NumPy array. > > However, the best solution would of course be to be able to create a NumPy array based on the pointer. I know NumPy has a C-API, maybe that's exposed somehow? > > Diez That's where I took it immediately after sending the e-mail: ctypes pointers. I managed to get a pointer to something... maybe it's pixel data. NumPy doesn't want to import my pointer as an array, and it turns out I don't know what format the returned data is in, anyway. Since efficiency isn't even a slight concern, I actually found a technique that works... but the final step is Cocoa writing the image to a file. This saves a bitmap using Cocoa: -------------------------------------------------- ciimage = CIImage.imageWithCVImageBuffer_(videoFrame) rep = NSCIImageRep.imageRepWithCIImage_(ciimage) bitrep = NSBitmapImageRep.alloc().initWithCIImage_(ciimage) bitdata = bitrep.representationUsingType_properties_(NSBMPFileType, objc.NULL) bitdata.writeToFile_atomically_("grab.bmp", False) -------------------------------------------------- But the real answer just came by mistake while poking around in pdb. 'bitdata' in the above code is an NSData object, which PyObjC can apparently magically copy over to Python-land as a read-only buffer: -------------------------------------------------- bitbuf = bitdata.bytes() f = open("python.bmp", "w") f.write(bitbuf) f.close() -------------------------------------------------- Strange but true, native Python saves it faster on my machine: Save bitdata with Cocoa's writeToFile:atomically: takes 0.077 s Save bitdata with Python's write() takes 0.0288 s Thanks for the help, I think I have everything I need now. Trevor |
From: Trevor B. <mr...@gm...> - 2011-02-04 17:16:23
|
Hello, I am working on a small Python script to grab a single frame from the iSight camera using PyObjC. I want to import the frame into a python numpy array for manipulation, and I want to write it exclusively in Python. I have fairly limited experience in Python and Objective-C, and no prior experience with PyObjC. I have made some progress, and currently it is able to find the camera, open it, and capture a frame. The frame data is (theoretically) available in my QTCaptureDecompressedVideoOutput delegate's callback function: - (void)captureOutput:(QTCaptureOutput *)captureOutput didOutputVideoFrame:(CVImageBufferRef)videoFrame withSampleBuffer:(QTSampleBuffer *)sampleBuffer fromConnection:(QTCaptureConnection *)connection So I added "pdb.set_trace()" at the beginning of the callback, and am trying to figure out how to get the raw bytes available in Python. The closest I have come is examining sampleBuffer: -------------------------------------------------- (Pdb) sampleBuffer <QTSampleBuffer: 0x1044b42d0> (Pdb) sampleBuffer.numberOfSamples() 1 (Pdb) sampleBuffer.lengthForAllSamples() 2624000 (Pdb) sampleBuffer.bytesForAllSamples() 4674363392L -------------------------------------------------- However, this is where I'm confused. bytesForAllSamples() returns a (void*), which is literally, of course, a long integer. I have no idea how to get at those bytes, since I'm assuming I can't just dereference an ObjC pointer somehow in Python. I was hoping an NSData object initialized with the address would work, but it does not: -------------------------------------------------- (Pdb) NSData.dataWithBytes_length_(sampleBuffer.bytesForAllSamples(),2624000) *** TypeError: converting to a C array -------------------------------------------------- Any guidance in getting past this point would be much appreciated! And thanks to everyone responsible for PyObjC, it is an excellent resource. -Trevor |
From: Ronald O. <ron...@ma...> - 2011-02-01 16:38:21
|
On 30 Jan, 2011, at 21:38, Scott Harris wrote: > I'm trying to compile and run the graphlaughs example from big nerd ranch. > > http://weblog.bignerdranch.com/?p=19 > > However, when I build the project they setup.py script fails here: > > from PyObjCTools import XcodeSupport > > Has this gone away? Why? > > Also, I've noticed that older PyObjC projects tended to follow the pattern of starting up via python and > now the XCode templates have a main.m that instantiates a python interpreter and loads the .py files. > > 1. Why did things change? Xcode's code completion and other tools don't work when the project doesn't have an Objective-C file in it. > 2. What's the easiest way modify the graph laughs example and get it up and running? Have the changes to PyObjC made its approach > outdated? The link to that example doesn't work for me right now. That said, I tend to use py2app to create application bundles and don't use Xcode for Python development at all because for a Python developer Xcode is just a basic editor with a lot of junk (said junk is very usefull when writing Objective-C, but most tools in Xcode don't understand code that isn't [Objective-]C[++] Ronald |
From: Ronald O. <ron...@ma...> - 2011-02-01 16:32:50
|
On 30 Jan, 2011, at 9:15, Scott Harris wrote: > OK, I found python2.7 in /Library/Frameworks and I got rid of that. Now the Xcode template is working, but it's choosing python2.5.4 > > How do I control which python the Xcode template picks to run my code? I want it to use the Apple supplied 2.6 version. You cannot control which framework is used by the Xcode templates other than by installing or removing frameworks. The templates should pick whichever framework gets used when you link with '-framework Python'. This is suboptimal, there really should be an option somewhere that can be used to explicitly select a Python. I haven't looked at the xcode templates for a long time because working on them is an experience that is not much better than just banging my head against a wall: the templates are text-ish files (undocumented format) with some markers in them and Apple doesn't provide tools that make it easier to work on templates. Ronald |
From: Scott H. <sco...@gm...> - 2011-01-30 20:38:52
|
I'm trying to compile and run the graphlaughs example from big nerd ranch. http://weblog.bignerdranch.com/?p=19 However, when I build the project they setup.py script fails here: from PyObjCTools import XcodeSupport Has this gone away? Why? Also, I've noticed that older PyObjC projects tended to follow the pattern of starting up via python and now the XCode templates have a main.m that instantiates a python interpreter and loads the .py files. 1. Why did things change? 2. What's the easiest way modify the graph laughs example and get it up and running? Have the changes to PyObjC made its approach outdated? Thanks, -Scott |
From: Scott H. <sco...@gm...> - 2011-01-30 08:15:18
|
OK, I found python2.7 in /Library/Frameworks and I got rid of that. Now the Xcode template is working, but it's choosing python2.5.4 How do I control which python the Xcode template picks to run my code? I want it to use the Apple supplied 2.6 version. Thanks, -Scott On Jan 30, 2011, at 1:03 AM, Scott Harris wrote: > I think the issue is that something has changed in Xcode. I've explicitly made the main.m in the template call python2.6. > > It used to work with all the apple supplied stuff , so I don't want to install new stuff to confuse the debugging. > > So it is running python 2.7 even though I explicitly put this in main.m: > > Py_SetProgramName("/usr/bin/python2.6"); > > Where is Xcode picking 2.7 up from? > > -Scott > On Jan 30, 2011, at 12:35 AM, Jair Gaxiola wrote: > >> On Sun, Jan 30, 2011 at 1:10 AM, Scott Harris <sco...@gm...> wrote: >>> Yes. pyobjc is found when I run python from the terminal. I'm using the Apple supplied pyobj and python. >>> >> >> Ok, check python version uses in terminal and xcode is the same. Try >> install pyobjc from easy_install. >> >> -- >> SIN ETIQUETAS.[ PUNTO ] >> http://flavors.me/jyr >> http://pythoncocoa.com >> http://opentumblr.com > |
From: Scott H. <sco...@gm...> - 2011-01-30 06:44:51
|
Have the Xcode template changed recently? I'm getting new errors when I try the pyobjc Xcode templates I had installed some time ago. Xcode ver 3.2.5 I have to remove PPC architectures form the project setting to get it to compile and then I get the console output below. Any ideas? Thanks, -Scott Traceback (most recent call last): File "main.py", line 10, in <module> import objc ImportError: No module named objc 2011-01-29 23:43:00.279 junl[57821:a0f] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '/Users/scott/Development/junl/main.m:44 main() PyRun_SimpleFile failed with file '/Users/scott/Development/junl/build/Debug/junl.app/Contents/Resources/main.py'. See console for errors.' *** Call stack at first throw: ( 0 CoreFoundation 0x963ac6ba __raiseError + 410 1 libobjc.A.dylib 0x9543e509 objc_exception_throw + 56 2 CoreFoundation 0x963ac3e8 +[NSException raise:format:arguments:] + 136 3 CoreFoundation 0x963ac35a +[NSException raise:format:] + 58 4 junl 0x00002c76 main + 1032 5 junl 0x00002842 start + 54 6 ??? 0x00000001 0x0 + 1 ) |
From: Ronald O. <ron...@ma...> - 2010-12-21 08:25:20
|
On 16 Dec, 2010, at 6:51, Greg Ewing wrote: > Every time NSGraphicsContext.graphicsPort() is called, I get > a message like this: > > 2010-12-16 18:49:28.865 Python[210:607] PyObjCPointer created: at 0x395ded0 of > type {CGContext=} > > Is there any way of turning these messages off? I'm finding > them annoying. They are printed because creating PyObjCPointers is a bug. The print should go away when you add "import Quartz" somewhere in your program before you call the graphicsPort method (because that way PyObjC knows that it needs to create a CGContext object instead of a generic pointer). Ronald > > -- > Greg > > ------------------------------------------------------------------------------ > Lotusphere 2011 > Register now for Lotusphere 2011 and learn how > to connect the dots, take your collaborative environment > to the next level, and enter the era of Social Business. > http://p.sf.net/sfu/lotusphere-d2d > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev |
From: Ptolemy S. <sa...@ya...> - 2010-12-17 17:45:45
|
I am on Mac G4 running OS 10.4.11 and Python 2.7.1. I am tryingto install the module PyGame and it needs PyObjC version 1.1 orabove. I would like to install PyObjC 2.0 (or 2.2 if it is more stable) on mysystem. However, I cannot figure out how to download the sourcecode to build and install PyObjC. The instructions at the SourceForge website states that I should do a checkout from the CVS repository. I typed in the module name and the search came backwith 0 results. Is there a .tar version available? Thanks for your help. - sartimk |
From: Greg E. <gre...@ca...> - 2010-12-16 06:09:44
|
PyGUI 2.3.2 is available: http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/ This version fixes a problem in Cocoa whereby the coordinate system for drawing in a Pixmap was upside down, and corrects a slight mistake in the Canvas documentation. What is PyGUI? -------------- PyGUI is a cross-platform GUI toolkit designed to be lightweight and have a highly Pythonic API. -- Gregory Ewing gre...@ca... http://www.cosc.canterbury.ac.nz/greg.ewing/ |
From: Greg E. <gre...@ca...> - 2010-12-16 05:51:51
|
Every time NSGraphicsContext.graphicsPort() is called, I get a message like this: 2010-12-16 18:49:28.865 Python[210:607] PyObjCPointer created: at 0x395ded0 of type {CGContext=} Is there any way of turning these messages off? I'm finding them annoying. -- Greg |
From: Greg E. <gre...@ca...> - 2010-12-15 11:23:59
|
I want to create an NSGraphicsContext for an NSBitmapImageRep with a flipped coordinate system, but I can't see any way to do this. NSGraphicsContext has no method for setting the isFlipped property, and you only get to specify the flipped state when creating it from a CGContexRef, not from an NSBitmapImageRep. Surely there must be some way to do it? Anyone have any ideas? -- Greg |
From: Ronald O. <ron...@ma...> - 2010-12-10 13:37:04
|
On 09 Dec, 2010,at 08:35 PM, Mark Sienkiewicz <sie...@st...> wrote: >> :>>> import sysconfig >> :>>> print sysconfig.get_config_var('USE_TOOLBOX_OBJECT_GLUE') >> >> I'd expect that this prints None on your system, which is a configuration I haven't tested in a long while. > > It says 0, not None. > > In the python build procedure that we use here, I see that my configure line includes --disable-toolbox-glue --disable-framework --disable-universalsdk. At one point, all three of them were necessary to get a python that worked, but that choice of options is many years old and I'm not sure I ever knew why those are the options to use. I think it is partly because we don't want this python to try to go into /Library or whatever. This is the problem. If I recompile python without --disable-toolbox-glue these things work: - I can install pyobjc 2.2 with easy_install pyobjc==2.2 - I can install pyobjc 2.3 with easy_install --prefix ~/py pyobjc-core==2.3 easy_install --prefix ~/py pyobjc==2.3 I've come over to the belief that there are so many environment variation that it makes sense to explicitly check for prerequisites in the setup.py. For example, when I have C extensions, I call a function that confirms that Python.h is really present in the directory that Python says it is in. (Many linux distributions decide to make it part of a "development" package, so even though distutils will tell you where it is, the file isn't actually there.) I can suggest something like: if not sysconfig.get_config_var('USE_TOOLBOX_OBJECT_GLUE') : print "pyobjc requires a python interpreter that was compiled with --enable-toolbox-glue" sys.exit(1) # exit 1 so the build is recognized as failing I need to change pyobjc-core to ensure that I call function that I only call the problematic function when TOOLBOX_GLUE is enabled. Ronald Thanks for all the help! I never would have had a solution otherwise. Mark S. |
From: Mark S. <sie...@st...> - 2010-12-09 19:35:34
|
>> :>>> import sysconfig >> :>>> print sysconfig.get_config_var('USE_TOOLBOX_OBJECT_GLUE') >> >> I'd expect that this prints None on your system, which is a configuration I haven't tested in a long while. > > It says 0, not None. > > In the python build procedure that we use here, I see that my configure line includes --disable-toolbox-glue --disable-framework --disable-universalsdk. At one point, all three of them were necessary to get a python that worked, but that choice of options is many years old and I'm not sure I ever knew why those are the options to use. I think it is partly because we don't want this python to try to go into /Library or whatever. This is the problem. If I recompile python without --disable-toolbox-glue these things work: - I can install pyobjc 2.2 with easy_install pyobjc==2.2 - I can install pyobjc 2.3 with easy_install --prefix ~/py pyobjc-core==2.3 easy_install --prefix ~/py pyobjc==2.3 I've come over to the belief that there are so many environment variation that it makes sense to explicitly check for prerequisites in the setup.py. For example, when I have C extensions, I call a function that confirms that Python.h is really present in the directory that Python says it is in. (Many linux distributions decide to make it part of a "development" package, so even though distutils will tell you where it is, the file isn't actually there.) I can suggest something like: if not sysconfig.get_config_var('USE_TOOLBOX_OBJECT_GLUE') : print "pyobjc requires a python interpreter that was compiled with --enable-toolbox-glue" sys.exit(1) # exit 1 so the build is recognized as failing Thanks for all the help! I never would have had a solution otherwise. Mark S. |
From: Mark S. <sie...@st...> - 2010-12-09 17:34:00
|
>> ImportError: dlopen(/Users/sienkiew/py/lib/python2.7/site-packages/pyobjc_core-2.3-py2.7-macosx-10.4-i386.egg/objc/_objc.so, 2): Symbol not found: _PyMac_Error >> Referenced from: /Users/sienkiew/py/lib/python2.7/site-packages/pyobjc_core-2.3-py2.7-macosx-10.4-i386.egg/objc/_objc.so >> Expected in: dynamic lookup > That's one error I hadn't expected. Which python do you use? Are you using a prebuilt binary from the python.org website or something else? It is Python 2.7.1 compiled from source as an i386 executable (32 bits) on Leopard. > What's the output of this code: > > :>>> import sysconfig > :>>> print sysconfig.get_config_var('USE_TOOLBOX_OBJECT_GLUE') > > I'd expect that this prints None on your system, which is a configuration I haven't tested in a long while. It says 0, not None. In the python build procedure that we use here, I see that my configure line includes --disable-toolbox-glue --disable-framework --disable-universalsdk. At one point, all three of them were necessary to get a python that worked, but that choice of options is many years old and I'm not sure I ever knew why those are the options to use. I think it is partly because we don't want this python to try to go into /Library or whatever. >> ( Actually, that hints at my next question: Is it possible to install pyobjc from a local copy of the software -- e.g. while not connected to the internet? Eventually, I have to take this to systems with more strict configuration control. ) > > There are source archives for all bits of pyobjc on PyPI. I don't have an archive with all of PyObjC at this time. > > The setup.py file for 'pyobjc' itself contains a list of subprojects, if you install the source archives for the subprojects in the order they are listed there you should be able to install without an internet connection. I'll take a look - thanks! Mark |
From: Ronald O. <ron...@ma...> - 2010-12-09 16:21:20
|
On 9 Dec, 2010, at 17:09, Mark Sienkiewicz wrote: > Thanks for the clarification on those un-important errors. > >>>>>> import pyobjc >>> Traceback (most recent call last): >>> File "<stdin>", line 1, in <module> >>> ImportError: No module named pyobjc >> That's expected. Use 'import objc' instead. > > Oh - sorry. (I'm not the user of this package; I just install things.) No need to apologize. > > >> You seem the end up with a complete installation. Does 'import Foundation' or 'import AppKit' work? > > I get this now from pyobjc 2.3: > >>>> import objc > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File "/Users/sienkiew/py/lib/python2.7/site-packages/pyobjc_core-2.3-py2.7-macosx-10.4-i386.egg/objc/__init__.py", line 24, in <module> > _update() > File "/Users/sienkiew/py/lib/python2.7/site-packages/pyobjc_core-2.3-py2.7-macosx-10.4-i386.egg/objc/__init__.py", line 21, in _update > import objc._objc as _objc > ImportError: dlopen(/Users/sienkiew/py/lib/python2.7/site-packages/pyobjc_core-2.3-py2.7-macosx-10.4-i386.egg/objc/_objc.so, 2): Symbol not found: _PyMac_Error > Referenced from: /Users/sienkiew/py/lib/python2.7/site-packages/pyobjc_core-2.3-py2.7-macosx-10.4-i386.egg/objc/_objc.so > Expected in: dynamic lookup > > Foundation and AppKit both start to import, but they get this same exception when they try to import objc. That's one error I hadn't expected. Which python do you use? Are you using a prebuilt binary from the python.org website or something else? What's the output of this code: :>>> import sysconfig :>>> print sysconfig.get_config_var('USE_TOOLBOX_OBJECT_GLUE') I'd expect that this prints None on your system, which is a configuration I haven't tested in a long while. > > With pyobjc 2.2 it is a different symbol: > >>>> import objc > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File "/Users/sienkiew/py2/lib/python2.7/site-packages/pyobjc_core-2.2-py2.7-macosx-10.4-i386.egg/objc/__init__.py", line 22, in <module> > _update() > File "/Users/sienkiew/py2/lib/python2.7/site-packages/pyobjc_core-2.2-py2.7-macosx-10.4-i386.egg/objc/__init__.py", line 19, in _update > import _objc > ImportError: dlopen(/Users/sienkiew/py2/lib/python2.7/site-packages/pyobjc_core-2.2-py2.7-macosx-10.4-i386.egg/objc/_objc.so, 2): Symbol not found: _CFMutableArrayRefObj_New > Referenced from: /Users/sienkiew/py2/lib/python2.7/site-packages/pyobjc_core-2.2-py2.7-macosx-10.4-i386.egg/objc/_objc.so > Expected in: dynamic lookup > > > Normally, I would go hunting for the references to the missing symbols and I would look for where they came from, but as far as I can tell, easy_install does not leave any source code behind. Is there a normal source distribution I can download, so I can see what the code does? > > ( Actually, that hints at my next question: Is it possible to install pyobjc from a local copy of the software -- e.g. while not connected to the internet? Eventually, I have to take this to systems with more strict configuration control. ) There are source archives for all bits of pyobjc on PyPI. I don't have an archive with all of PyObjC at this time. The setup.py file for 'pyobjc' itself contains a list of subprojects, if you install the source archives for the subprojects in the order they are listed there you should be able to install without an internet connection. Ronald > > Mark > |
From: Mark S. <sie...@st...> - 2010-12-09 16:09:28
|
Thanks for the clarification on those un-important errors. >>>>> import pyobjc >> Traceback (most recent call last): >> File "<stdin>", line 1, in <module> >> ImportError: No module named pyobjc > > That's expected. Use 'import objc' instead. Oh - sorry. (I'm not the user of this package; I just install things.) > You seem the end up with a complete installation. Does 'import Foundation' or 'import AppKit' work? I get this now from pyobjc 2.3: >>> import objc Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/sienkiew/py/lib/python2.7/site-packages/pyobjc_core-2.3-py2.7-macosx-10.4-i386.egg/objc/__init__.py", line 24, in <module> _update() File "/Users/sienkiew/py/lib/python2.7/site-packages/pyobjc_core-2.3-py2.7-macosx-10.4-i386.egg/objc/__init__.py", line 21, in _update import objc._objc as _objc ImportError: dlopen(/Users/sienkiew/py/lib/python2.7/site-packages/pyobjc_core-2.3-py2.7-macosx-10.4-i386.egg/objc/_objc.so, 2): Symbol not found: _PyMac_Error Referenced from: /Users/sienkiew/py/lib/python2.7/site-packages/pyobjc_core-2.3-py2.7-macosx-10.4-i386.egg/objc/_objc.so Expected in: dynamic lookup Foundation and AppKit both start to import, but they get this same exception when they try to import objc. With pyobjc 2.2 it is a different symbol: >>> import objc Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/sienkiew/py2/lib/python2.7/site-packages/pyobjc_core-2.2-py2.7-macosx-10.4-i386.egg/objc/__init__.py", line 22, in <module> _update() File "/Users/sienkiew/py2/lib/python2.7/site-packages/pyobjc_core-2.2-py2.7-macosx-10.4-i386.egg/objc/__init__.py", line 19, in _update import _objc ImportError: dlopen(/Users/sienkiew/py2/lib/python2.7/site-packages/pyobjc_core-2.2-py2.7-macosx-10.4-i386.egg/objc/_objc.so, 2): Symbol not found: _CFMutableArrayRefObj_New Referenced from: /Users/sienkiew/py2/lib/python2.7/site-packages/pyobjc_core-2.2-py2.7-macosx-10.4-i386.egg/objc/_objc.so Expected in: dynamic lookup Normally, I would go hunting for the references to the missing symbols and I would look for where they came from, but as far as I can tell, easy_install does not leave any source code behind. Is there a normal source distribution I can download, so I can see what the code does? ( Actually, that hints at my next question: Is it possible to install pyobjc from a local copy of the software -- e.g. while not connected to the internet? Eventually, I have to take this to systems with more strict configuration control. ) Mark |
From: Ronald O. <ron...@ma...> - 2010-12-09 15:49:23
|
On 9 Dec, 2010, at 16:43, Mark Sienkiewicz wrote: > >>> error: Could not find required distribution pyobjc-core >>> >>> As far as I can tell, some part of it must be missing from pypi. Any ideas? >> That's odd, pyobjc-core is on pypi and should work just fine. >> Could you try "easy_install pyobjc-core==2.3" followed running "python setup.py install" for pyobjc itself again? > > > I did this: > > setenv PYTHONPATH /Users/sienkiew/py/lib/python2.7/site-packages > easy_install --prefix ~/py pyobjc-core==2.3 > > It installed something that involved compiling a lot of C code. During the install, there were a few things that look broken, though: > > > libtool: link: ar cru .libs/libxml2.a SAX.o entities.o encoding.o error.o parserInternals.o parser.o tree.o hash.o list.o xmlIO.o xmlmemory o uri.o valid.o xlink.o HTMLparser.o HTMLtree.o debugXML.o xpath.o xpointer.o xinclude.o nanohttp.o nanoftp.o DOCBparser.o catalog.o globals o threads.o c14n.o xmlstring.o xmlregexp.o xmlschemas.o xmlschemastypes.o xmlunicode.o xmlreader.o relaxng.o dict.o SAX2.o xmlwriter.o legac .o chvalid.o pattern.o xmlsave.o xmlmodule.o schematron.o > ranlib: file: .libs/libxml2.a(SAX.o) has no symbols > ranlib: file: .libs/libxml2.a(xlink.o) has no symbols > ranlib: file: .libs/libxml2.a(HTMLparser.o) has no symbols > ranlib: file: .libs/libxml2.a(HTMLtree.o) has no symbols > ... repeats for about 20 more files ... This is harmless, due to the way pyobjc compiles a 3th party library we end up with some empty C object files. > > And later: > > Modules/objc/test/properties.m:24: warning: Mac OS X version 10.5 or later is needed for use of property > Modules/objc/test/properties.m:25: warning: Mac OS X version 10.5 or later is needed for use of property > Modules/objc/test/properties.m:26: warning: Mac OS X version 10.5 or later is needed for use of property > Modules/objc/test/properties.m:27: warning: Mac OS X version 10.5 or later is needed for use of property > Modules/objc/test/properties.m:27: warning: no 'assign', 'retain', or 'copy' attribute is specified - 'assign' is assumed > Modules/objc/test/properties.m:27: warning: 'assign' attribute (default) not appropriate for non-gc object property 'prop4' This is not a problem for using pyobjc, the warnings are for parts of the unittests for pyobjc-core. > > > It is 10.5. system_profiler says "System Version: Mac OS X 10.5.8 (9L31a) )" > > And finally: > > Skipping installation of build/bdist.macosx-10.4-i386/egg/PyObjCTest/__init__.py (namespace package) > Skipping installation of build/bdist.macosx-10.4-i386/egg/PyObjCTest/arrays.so (namespace package) > Skipping installation of build/bdist.macosx-10.4-i386/egg/PyObjCTest/block.so (namespace package) > Skipping installation of build/bdist.macosx-10.4-i386/egg/PyObjCTest/cfsocket.so (namespace package) > Skipping installation of build/bdist.macosx-10.4-i386/egg/PyObjCTest/clinmeth.so (namespace package) > ... another 90-100 lines of this, some for .so and some for .py files > Skipping installation of build/bdist.macosx-10.4-i386/egg/PyObjCTest/testclassandinst.so (namespace package) > Skipping installation of build/bdist.macosx-10.4-i386/egg/PyObjCTest/testoutputinitializer.so (namespace package) > Skipping installation of build/bdist.macosx-10.4-i386/egg/PyObjCTest/voidpointer.so (namespace package) > Adding pyobjc-core 2.3 to easy-install.pth file > > Installed /Users/sienkiew/py/lib/python2.7/site-packages/pyobjc_core-2.3-py2.7-macosx-10.4-i386.egg > Processing dependencies for pyobjc-core==2.3 > Finished processing dependencies for pyobjc-core==2.3 This looks OK. > > > The easy_install step did not produce a working pyobjc: > >>>> import pyobjc > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > ImportError: No module named pyobjc That's expected. Use 'import objc' instead. > > > > At this point, I'm thinking there must be something odd about my system that two different versions do not work at all, even when installed with easy_install. Unfortunately, I don't really know enough about easy_install to know what questions to ask next. Do you have any suggestions? You seem the end up with a complete installation. Does 'import Foundation' or 'import AppKit' work? Ronald > > Mark S. > |