Message5721

Author kwatford
Recipients amak, kwatford
Date 2010-04-16.17:24:55
SpamBayes Score 1.3454732e-05
Marked as misclassified No
Message-id <1271438696.99.0.357296434566.issue1537@psf.upfronthosting.co.za>
In-reply-to
Content
Due to the way MATLAB manhandles its filehandles I can't use a real Jython prompt, but I can push to an InteractiveConsole just fine. Here are the results, plus the results with my workaround:

>> ic = org.python.util.InteractiveConsole();
>> ic.push('import org.python.apache.xerces.parsers.SAXParser');
>> ic.push('import org.apache.xerces.parsers.SAXParser');
>> ic.push('import xml.etree.ElementTree as etree');
>> ic.push('x = etree.parse("test.xml")');
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/amd/ss01/export/homes16/kwatford/TUF/jlib/jython-2.5.1.jar/Lib/xml/etree/ElementTree.py", line 862, in parse
  File "/amd/ss01/export/homes16/kwatford/TUF/jlib/jython-2.5.1.jar/Lib/xml/etree/ElementTree.py", line 581, in parse
  File "/amd/ss01/export/homes16/kwatford/TUF/jlib/jython-2.5.1.jar/Lib/xml/etree/ElementTree.py", line 1120, in __init__
  File "/amd/ss01/export/homes16/kwatford/TUF/jlib/jython-2.5.1.jar/Lib/xml/parsers/expat.py", line 63, in ParserCreate
  File "/amd/ss01/export/homes16/kwatford/TUF/jlib/jython-2.5.1.jar/Lib/xml/parsers/expat.py", line 91, in __init__
	at org.xml.sax.helpers.XMLReaderFactory.loadClass(Unknown Source)
	at org.xml.sax.helpers.XMLReaderFactory.createXMLReader(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)

org.xml.sax.SAXException: java.lang.ClassNotFoundException: org.python.apache.xerces.parsers.SAXParser
>> ic.push('import xml.parsers.expat');
>> ic.push('xml.parsers.expat._xerces_parser = "org.apache.xerces.parsers.SAXParser"');
>> ic.push('x = etree.parse("test.xml")');
>> ic.push('print x');
<xml.etree.ElementTree.ElementTree instance at 0x2>
History
Date User Action Args
2010-04-16 17:24:56kwatfordsetmessageid: <1271438696.99.0.357296434566.issue1537@psf.upfronthosting.co.za>
2010-04-16 17:24:56kwatfordsetrecipients: + kwatford, amak
2010-04-16 17:24:56kwatfordlinkissue1537 messages
2010-04-16 17:24:55kwatfordcreate