admin管理员组文章数量:1317131
I'm trying to install this library for LZJB pression. PyLZJB LINK
The library is a binding for a C library, the file is located here PyLZJB.so
Unfortunately by copying to the site-packages directory when import I get the "Wrong ELF class" error.
>>> import PyLZJB
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: ./PyLZJB.so: wrong ELF class: ELFCLASS32
Help would be great. :)
PS: I'm running Ubuntu 10.4 64bit
Edit:
If someone could suggest me an alternative pression algorithm I would be equally happy. :)
The algorithm is for HTML pression, and it needs client side Javascript depression/pression support too.
I really hope someone can help on this one. Thanks guys!
I'm trying to install this library for LZJB pression. PyLZJB LINK
The library is a binding for a C library, the file is located here PyLZJB.so
Unfortunately by copying to the site-packages directory when import I get the "Wrong ELF class" error.
>>> import PyLZJB
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: ./PyLZJB.so: wrong ELF class: ELFCLASS32
Help would be great. :)
PS: I'm running Ubuntu 10.4 64bit
Edit:
If someone could suggest me an alternative pression algorithm I would be equally happy. :)
The algorithm is for HTML pression, and it needs client side Javascript depression/pression support too.
I really hope someone can help on this one. Thanks guys!
Share Improve this question edited Jun 20, 2020 at 9:12 CommunityBot 11 silver badge asked Jul 27, 2010 at 22:30 RadiantHexRadiantHex 25.6k47 gold badges155 silver badges251 bronze badges 7- 2 Ick, depression in JavaScript? You can't take advantage of the built-in pression support in most modern browsers and HTTP servers? – Nicholas Knight Commented Jul 27, 2010 at 22:38
- @Nicholas – I totally agree: depression in JavaScript, which is essentially an interpreted language, will be very slow in parison to a browser's (or operating system's) native (GZip) pression. @RadiantHex – Just curious: why do you need this? – Marcel Korpel Commented Jul 27, 2010 at 22:43
- @Nicholas: do they Gzip GET parameters within a request? – RadiantHex Commented Jul 27, 2010 at 22:45
- @Marcel: I'm sending loads of debugging data from and to a server... and I really need to press this. Also pression is an easy way to serialize data too for a GET request, don't you think? :) – RadiantHex Commented Jul 27, 2010 at 22:46
- 2 @RadiantHex: If you're putting enough data in GET parameters to justify pression, there's almost certainly something very wrong with your application design. I would strongly suggest posting a new question asking for advice on how to acplish what you're doing in a saner manner. – Nicholas Knight Commented Jul 27, 2010 at 22:51
3 Answers
Reset to default 7You are running a 64 bit Python interpreter and trying to load a 32 bit extension and that is not allowed.
You need to have both your Python interpreter and your extension piled for the same architectures. While you could get a 32 bit Python interpreter, it would probably be better to get a 64 bit extension.
What you should do is get the source for LZJB and build it yourself to get a 64 bit shared object.
If someone could suggest me an alternative pression algorithm I would be equally happy.
There is always good old deflate, a much more mon member of the LZ pression family. JavaScript implementation. How to handle raw deflate content with Python's zlib module.
This a lot of overhead in relatively slow client-side code to be pressing submission data, and it's not trivial to submit the raw bytes you will obtain from it.
do they Gzip GET parameters within a request?
GET form submissions in the query string must by nature be fairly short, or you will overrun browser or server URL length limits. There is no point pressing anything so small. If you have a lot of data, it needs to go in a POST form.
Even in a POST form, the default enctype
is application/x-www-form-urlencoded
, which means a majority of bytes are going to get encoded as %nn
sequences. This will balloon your form submission, probably beyond the original unpressed size. To submit raw bytes you would have to use a enctype="multipart/form-data"
form.
Even then, you're going to have encoding problems. JS strings are Unicode not bytes, and will get encoded using the encoding of the page containing the form. That should normally be UTF-8, but then you can't actually generate an arbitrary sequence of bytes for upload by encoding to it, since many byte sequences are not valid in UTF-8. You could have bytes-in-unicode by encoding each byte as a code unit to UTF-8, but that would bloat your pressed bytes by 50% (since half the code units, those over 0x80
, would encode to two UTF-8 bytes).
In theory, if you didn't mind losing proper internationalisation support, you could serve the page as ISO-8859-1 and use the escape/encodeURIComponent
idiom to convert between UTF-8 and ISO-8859-1 for output. But that won't work because browsers lie and actually use Windows code page 1252 for encoding/decoding content marked as ISO-8859-1. You could use another encoding that mapped every byte to a character, but that'd be more manual encoding overhead and would further limit characters you could use in the page.
You could avoid encoding problems by using something like base64, but then, again, you've got more manual encoding performance overhead and a 33% bloat.
In summary, all approaches are bad; I don't think you're going to get much useful out of this.
You can either run a 32-bit Python or pile your own PyLZJB rather than using the prebuilt binary. Or get a 64-bit binary PyLZJB from somewhere.
本文标签: javascriptWrong ELF classPythonStack Overflow
版权声明:本文标题:javascript - Wrong ELF class - Python - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742021187a2414704.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论