[Pythonmac-SIG] trouble with NSXMLDocument
Bob Ippolito
bob at redivi.com
Thu Nov 10 16:56:30 CET 2005
On Nov 10, 2005, at 2:15 AM, Jack Nutting wrote:
> Hi gang,
>
> I wanted to play around with NSXMLDocument a bit, and figured
> PyObjC would be a good way to do it. Unfortunately, I get strange
> errors.
>
> >>> doc, error = Foundation.NSXMLDocument.alloc
> ().initWithContentsOfURL_options_error_(u"asdfkjsda.svg", 0)
> 2005-11-10 11:03:20.618 python[1018] *** -[OC_PythonUnicode
> absoluteURL]: selector not recognized [self = 0x370db0]
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> ValueError: NSInvalidArgumentException - *** -[OC_PythonUnicode
> absoluteURL]: selector not recognized [self = 0x370db0]
>
> Note that the "asdfkjsda.svg" file is in the same directory where I
> started python. I tried using a file URL instead, but both "
> file://asdfkjsda.svg" and "file:///Users/jnutting/Documents/svg/
> shapes/asdfkjsda.svg" give me the same result, as does wrapping the
> string in unicode(string, 'utf-8') instead of just prepending it
> with 'u'.
It's telling you that strings are not URLs. You need to use a NSURL
instance as the first parameter.
-bob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20051110/cfe2f83e/attachment.html
More information about the Pythonmac-SIG
mailing list