[Pythonmac-SIG] PyObjC: Errors initializing NSAttributedString using initWithHTML

Michael Glassford glassfordm at hotmail.com
Tue Jan 10 23:16:51 CET 2006


When trying to initialize an NSAttributedString like this:

attributedString = 
AppKit.NSAttributedString.alloc().initWithHTML_baseURL_documentAttributes_(data, 
url, None)

I get the error "TypeError: Need 2 arguments, got 3", although the 
documentation makes it pretty clear that there are in fact 3 arguments. 
Similarly,

attributedString = 
AppKit.NSAttributedString.alloc().initWithHTML_documentAttributes_(data, 
url)

gives the error "TypeError: Need 1 arguments, got 2", although the 
documentation makes it pretty clear that there are in fact 2 arguments.

I've looked at the signatures for the function in PyObjC's 
_FoundationSignatures.py, but wasn't able to interpret them well enough 
to help me. For reference, they are:

setSignatureForSelector("NSAttributedString", 
"initWithHTML:baseURL:documentAttributes:", "@0 at 4:8 at 12@16o^@20")

setSignatureForSelector("NSAttributedString", 
"initWithHTML:documentAttributes:", "@@:@o^@")

Can someone more familiar with what these mean help me out?

Thanks,

Mike



More information about the Pythonmac-SIG mailing list