[BangPypers] Import Error

Anand Chitipothu anandology at gmail.com
Mon Nov 14 14:12:53 CET 2011


2011/11/14 Subhodip Biswas <subhodipbiswas at gmail.com>:
> Hi,
>
> On Mon, Nov 14, 2011 at 4:17 PM, Gora Mohanty <gora at mimirtech.com> wrote:
>> On Mon, Nov 14, 2011 at 3:07 PM, Subhodip Biswas
>> <subhodipbiswas at gmail.com> wrote:
>>> Hi,
>>>
>>> On Mon, Nov 14, 2011 at 1:10 PM, Noufal Ibrahim <noufal at gmail.com> wrote:
>>>> Subhodip Biswas <subhodipbiswas at gmail.com> writes:
>>>>
>>>>> Hi all,
>>>>>
>>>>> I am trying to install lxml in my windows box with jython 2.5.2. I can
>>>>> see a lxml egg folder in site packages under jython installation
>>>>> directory.
>>>>> However if I try to import lxml the following thing happens :
>>>>
>>>> load_dynamic is something used to load shared libraries[1]
>>>>
>>>> As far as I know, lxml has some components implemented in C and I'm not
>>>> totally sure if it's been ported. A quick search brought this up
>>>> http://old.nabble.com/lxml-replacement-in-Jython-td27164714.html#a27164714
>>>>
>>> I know of two Libraries that is used by lxml. One is libxml2 and
>>> libxslt. It is required for compiling lxml from source and if lxml is
>>> not ported like say Amara/Akara. It should give me a "compiling
>>> extensions in not supported in jython". Instead I get lxml installed
>>> and then this. Is there a way I can get lxml in jython?
>>
>> Has been a while since I have had reason to use jython,
>> but my understanding is that it cannot handle libraries that
>> have components implemented in C. You are probably best
>> off asking on a Jython-specific group.
>>
>>> Slightly off topic. My main intention is a unmarshalling library like
>>> xmlbeans in Java.What are the alternatives apart from generateDS or
>>> Amara that works with jython??
>>
>> Not familiar with either GenerateDS, or Amara, but ElementTree
>> ( http://effbot.org/zone/element-index.htm ) has a pure Python
>> implementation, which should work with jython. I think that is also true
>> of BeautifulSoup ( http://www.crummy.com/software/BeautifulSoup/ )
>>
>
> I guess I hit a dead end again. I wanted to use GenerateDS as I wanted
> to generate some python classes based on a XSD/XML feed. The reason I
> am stuck with jython is I have some java dependencies for my project.I
> think I need to figure some weird way of doing so.

It looks like you are looking for an object serialization library. I
suggest you to try XStream.

http://xstream.codehaus.org/

It is a popular Java library for object serialization. It shouldn't be
hard to write a converter for Python objects. I think you should be
able to write the converter in Python itself.

This page has couple of example of installing custom converters.

http://xstream.codehaus.org/javadoc/com/thoughtworks/xstream/XStream.html

Anand


More information about the BangPypers mailing list