473,763 Members | 6,666 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

pure python data compression (zip)

Hallo

I wonder if there are any pure python implementations available/known
for the zip (or any other) data compression... As far as I know
python's zlib uses http://www.zlib.net/, which is written in
C. Unfortunately this is not solution for me, because my target "only"
has a python interpreter....

I have "googled" for a while, but I don't have found anything useful.

Regards,
René
Oct 23 '07 #1
2 2010
2007/10/23, Rene Maurer <rm***@mailc.ne t>:
Hallo

I wonder if there are any pure python implementations available/known
for the zip (or any other) data compression... As far as I know
python's zlib uses http://www.zlib.net/, which is written in
C. Unfortunately this is not solution for me, because my target "only"
has a python interpreter....

I have "googled" for a while, but I don't have found anything useful.

Regards,
René
--
http://mail.python.org/mailman/listinfo/python-list
I have implemented Huffman in Python, it is not very fast yet. Further
improvements would requires writing some parts in C and use as a
module in Python, or maybe I just didn't think enough on how to
improve the python code.

If you don't know how huffman works, you may read this:
http://gpolo.ath.cx:81/implements/huffman
I have described the improvements I have done to this "teaching
version" here: http://gpolo.ath.cx:81/texts/opc

If you don't want to read at all, you can search at pypi for "huffman"

It doesn't have all the functionalities of any normal compressor, like
compressing directories, but it could be implemented of course.

Feedback is welcome

--
-- Guilherme H. Polo Goncalves
Oct 23 '07 #2
Guilherme Polo writes (23.10.2007):
2007/10/23, Rene Maurer <rm***@mailc.ne t>:
>I wonder if there are any pure python implementations available/known
for the zip (or any other) data compression... As far as I know
python's zlib uses http://www.zlib.net/, which is written in
C. Unfortunately this is not solution for me, because my target "only"
has a python interpreter....

I have implemented Huffman in Python, it is not very fast yet. Further
improvements would requires writing some parts in C and use as a
module in Python, or maybe I just didn't think enough on how to
improve the python code.

If you don't know how huffman works, you may read this:
http://gpolo.ath.cx:81/implements/huffman
I have described the improvements I have done to this "teaching
version" here: http://gpolo.ath.cx:81/texts/opc
Thank you very much. I will have a look this and try it out.
Regards,
René
Oct 23 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
3690
by: Andrew Dalke | last post by:
Is there an author index for the new version of the Python cookbook? As a contributor I got my comp version delivered today and my ego wanted some gratification. I couldn't find my entries. Andrew dalke@dalkescientific.com
1
1702
by: deejaay | last post by:
Hello, I following an example on how to zip files from the www.devshed.com site. I can create a zip package, however I am not getting any compression. 120M file stays 120M within the zip package. I need to know how to set or activate the compression values. here is the code I'm using: >import zipfile >zip = zipfile.ZipFile('<path/zipfilename.zip>', 'w')
25
7754
by: Xah Lee | last post by:
Python Doc Problem Example: gzip Xah Lee, 20050831 Today i need to use Python to compress/decompress gzip files. Since i've read the official Python tutorial 8 months ago, have spent 30 minutes with Python 3 times a week since, have 14 years of computing experience, 8 years in mathematical computing and 4 years in unix admin and perl, i have quickly found the official doc: http://python.org/doc/2.4.1/lib/module-gzip.html
3
1207
by: dermot | last post by:
Last year, I wrote a pure VB compression program because there didn't seem to be anything like this. It is not zip- compatible because it uses newer (industry-tested, well known) algorithms, but it compresses a bit better than zip and is quite fast. Some of the fastest moden compression programs such as Bzip use these algorithms. I've converted it to VB.Net for anyone who is interested. If your app both compresses and decompresses, then...
6
2111
by: sri2097 | last post by:
Hi, I'm trying to zip a particular fiolder and place the zipped folder into a target folder using python. I have used the following command in 'ubuntu'. zip_command = 'zip -qr %s %s' % (target, ' '.join(source)) I execute this using os.command(zip_command). It works fine... But when I run this script in Windows XP, I get an error while
0
361
by: Kurt B. Kaiser | last post by:
Patch / Bug Summary ___________________ Patches : 378 open ( +3) / 3298 closed (+34) / 3676 total (+37) Bugs : 886 open (-24) / 5926 closed (+75) / 6812 total (+51) RFE : 224 open ( +7) / 227 closed ( +7) / 451 total (+14) New / Reopened Patches ______________________
2
2491
by: TerryStone | last post by:
Thanks to anyone who reads this. Below is some C# that compresses an array of bytes, and then decompresses, and compares the original data with the new. Firstly, the length of the decompressed data is shorter than the original. So some loss of data has occured. But the content up until the early truncation matches. So am I flushing correctly? This error only occurs for particular combinations of bytes in the original buffer.
4
3061
by: Pacino | last post by:
Hi, everyone, I am wondering whether it's possible to read part (e.g. 1000*1000) of a huge jpeg file (e.g. 30000*30000) and save it to another jpeg file by pure python. I failed to read the whole file and split it, because it would cost 2GB memory. Can anyone help me? Any comments would be appreciated. Thanks.
0
9564
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9387
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10148
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10002
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9823
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8822
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3528
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2794
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.