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

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to