Thread: [Pyobjc-dev] What did I do wrong?
Brought to you by:
ronaldoussoren
From: Deirdre S. M. <de...@de...> - 2001-04-27 06:30:41
|
% /usr/local/bin/python setup.py install running install running build running build_ext building 'pyobjc' extension Traceback (most recent call last): File "setup.py", line 23, in ? ext_modules = [Extension("pyobjc", sourceFiles)], File "/usr/local/lib/python2.0/distutils/core.py", line 157, in setup raise SystemExit, "error: " + str(msg) SystemExit: error: unknown file type '.m' (from 'OC_PythonBundle.m') (I'd have searched the archives on this one more carefully, but they've been down for an hour now. Remind me to wget them tomorrow) |
From: Deirdre S. M. <de...@de...> - 2001-04-27 08:19:18
|
OK, I figured that out -- now I'm up to the problem Steve had last November with not having pyobjc import correctly. I finally just chickened out and grabbed his binaries so I could get something done. >% /usr/local/bin/python setup.py install >running install >running build >running build_ext >building 'pyobjc' extension >Traceback (most recent call last): > File "setup.py", line 23, in ? > ext_modules = [Extension("pyobjc", sourceFiles)], > File "/usr/local/lib/python2.0/distutils/core.py", line 157, in setup > raise SystemExit, "error: " + str(msg) >SystemExit: error: unknown file type '.m' (from 'OC_PythonBundle.m') -- -- _Deirdre Stash-o-Matic: http://weirdre.com http://deirdre.net "I love deadlines. I like the whooshing sound they make as they fly by." - Douglas Adams |
From: Deirdre S. M. <de...@de...> - 2001-04-27 18:09:05
|
I realize that I asked Steve a lot of questions and others might be able to answer and/or shed some light on. My ObjC was never really very good (I'm trying to work on that <g>) and I'm trying to make the paradigm leap at the same time. I'm trying to create a Python version of the Currency Converter tutorial (start smallish, I figured). I figured I'd keep the two classes (Converter and ConverterController) as intended and wrestle with the main function after that, cribbing heavily from Steve. Converter.py looks right (and the python interpreter doesn't complain). But when it gets to the ConverterController class (where all the fun is), my understanding just stops cold. The .h file is: #import <Cocoa/Cocoa.h> @interface ConverterController : NSObject { IBOutlet id converter; IBOutlet id dollarField; IBOutlet id rateField; IBOutlet id totalField; } - (IBAction)convert:(id)sender; @end It seems to me that this has got to have a syntax something like: # ConverterController.py import pyobjc import Converter class ConverterController(pyobjc.runtime.NSObject): def __init__(self): self.converter = pyobjc.runtime.IBOutlet(id) self.dollarField = pyobjc.runtime.IBOutlet(id) self.rateField = pyobjc.runtime.IBOutlet(id) self.totalField = pyobjc.runtime.IBOutlet(id) def convert(sender): amt = self.dollarField.floatValue() rate = self.rateField.floatValue() total = self.converter( amt, rate ) self.totalField.setFloatValue(total) self.rateField.selectText(self.rateField) Am I even close here? |
From: Steven D. M. <sd...@mi...> - 2001-04-27 18:42:11
|
[ I know our mails have crossed, and I addressed some of this in the earlier, longer message, but to distill the problems down more concisely: ] > class ConverterController(pyobjc.runtime.NSObject): [1] That won't work for the same reason you can't directly subclass Python lists or dictionaries. They are objects, but not classes. Look in you're Python lib for UserDict.py and UserList.py -- which are examples of class wrappers around a non-class object. You would need to do something similar for Cocoa classes -- which are not Python classes. We're going to look for a general solution to this problem: Jim Fulton and Don Beaudry both (I think) did some work on "extension classes" and other ways around this problem in Python -- and I think Python is moving towards a more general solution eventually. We might try fixing it without waiting for Python 2.X to fix the problem (looking at those previous attempts). We might be able to add more introspection to the bridge to make it easier to automatically generate, or make a generic one-size-fits-all class wrapper. [2] I haven't yet been able to load and reanimate an IB Nib file from Python. I think this is a much easier problem than [1] above. I'll try to post what I've tried and what didn't work in case anyone else wants to give it a try. -- Steve Majewski |
From: Deirdre S. M. <de...@de...> - 2001-04-27 18:55:30
|
>That won't work for the same reason you can't directly >subclass Python lists or dictionaries. They are objects, >but not classes. Look in you're Python lib for UserDict.py >and UserList.py -- which are examples of class wrappers >around a non-class object. You would need to do something >similar for Cocoa classes -- which are not Python classes. Yeah, figured that out from your prior email. Rats. So much for cheap and easy. :) > We're going to look for a general solution to this problem: >Jim Fulton and Don Beaudry both (I think) did some work on >"extension classes" and other ways around this problem in >Python -- and I think Python is moving towards a more >general solution eventually. > We might try fixing it without waiting for Python 2.X to >fix the problem (looking at those previous attempts). > We might be able to add more introspection to the bridge >to make it easier to automatically generate, or make a >generic one-size-fits-all class wrapper. It seems to me that somehow it could be done if one really compiled python with ObjC (this is intuition) and tweaked the process of building a bit. Failing that, the generic wrapper sounds like a good approach. > I haven't yet been able to load and reanimate an IB Nib file >from Python. I think this is a much easier problem than [1] >above. I'll try to post what I've tried and what didn't work >in case anyone else wants to give it a try. Please -- it's a dull afternoon. :) -- -- _Deirdre Stash-o-Matic: http://weirdre.com http://deirdre.net "I love deadlines. I like the whooshing sound they make as they fly by." - Douglas Adams |
From: Deirdre S. M. <de...@de...> - 2001-05-10 07:44:22
|
At 2:42 PM -0400 4/27/01, Steven D. Majewski wrote: >[2] > I haven't yet been able to load and reanimate an IB Nib file >from Python. I think this is a much easier problem than [1] >above. I'll try to post what I've tried and what didn't work >in case anyone else wants to give it a try. Steven, I never did see these concepts, can you post them? ::whimper:: :) -- _Deirdre Stash-o-Matic: http://weirdre.com http://deirdre.net Macintosh Developer (seeking work): Will work for Cocoa "I love deadlines. I like the whooshing sound they make as they fly by." - Douglas Adams |
From: Steven D. M. <sd...@mi...> - 2001-04-27 18:24:37
|
What version of Python are you using ? One of the beta releases? My patch was accepted into the 2.1 final, so that should work. My copy of Python2.1/lib/distutils/unixccompiler.py has a line: src_extensions = [".c",".C",".cc",".cxx",".cpp",".m"] in the beta (and maybe the final candidate) releases, the ".m" is missing. -- Steve. On Fri, 27 Apr 2001, Deirdre Saoirse Moen wrote: > OK, I figured that out -- now I'm up to the problem Steve had last > November with not having pyobjc import correctly. I finally just > chickened out and grabbed his binaries so I could get something done. > > > >% /usr/local/bin/python setup.py install > >running install > >running build > >running build_ext > >building 'pyobjc' extension > >Traceback (most recent call last): > > File "setup.py", line 23, in ? > > ext_modules = [Extension("pyobjc", sourceFiles)], > > File "/usr/local/lib/python2.0/distutils/core.py", line 157, in setup > > raise SystemExit, "error: " + str(msg) > >SystemExit: error: unknown file type '.m' (from 'OC_PythonBundle.m') > |