Re: [Pyobjc-dev] Exception when trying to use datetime object in NSArrayController
Brought to you by:
ronaldoussoren
From: Ronald O. <ron...@ma...> - 2009-09-29 14:03:04
|
On 29 Sep, 2009, at 3:14, Erik Wickstrom wrote: > I'm having some trouble passing a Python datetime.datetime.now() > object to an NSArrayController. I keep getting this error: > > (ValueError: NSInvalidArgumentException - *** -[NSDate > initWithTimeIntervalSinceReferenceDate:]: method only defined for > abstract class. Define -[OC_PythonDate > initWithTimeIntervalSinceReferenceDate:]!) -- I though pyobjc could > convert this type. Any ideas? > > class DTController(NSObject): > arrayController = objc.IBOutlet() > data = [] > > def awakeFromNib(self): > print "testing 123" > self.data.append({'date': datetime.datetime.now(), > 'comments': 'testing 123',}) > self.arrayController.rearrangeObjects() > > Any idea what I'm doing wrong? It seems to work for me, could you please tell more about your environment: * Which version of OSX? * Are you using /usr/bin/python or a custom install? * Which version of PyObjC are you using (python -c 'import objc; print objc.__version__') BTW. The script I tested with is: # begin of file from Cocoa import * import datetime a = NSMutableArray.array() c = NSArrayController.alloc().initWithContent_(a) a.addObject_(datetime.datetime.now()) print a c.rearrangeObjects() # end of file Could you create a small standalone program what demonstrates the problem? A GUI tool would be fine. Ronald > > Thanks! > Erik > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry® Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart > your > developing skills, take BlackBerry mobile applications to market and > stay > ahead of the curve. Join us from November 9-12, 2009. Register > now! > http://p.sf.net/sfu/devconf > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev |