tags:

views:

235

answers:

3
+1  Q: 

Python binary diff

I'm trying to use bsdiff (or any binary diff implementation you come up with) to compute and apply diff onto random binary data. I would like to use it on data from a database, so it would be better not to have to write those onto disk and pass them to bsdiff.exe.

Is there any wrapper library or way in python to do that?

A: 

You can use difflib that is part of Python standard library: http://docs.python.org/library/difflib.html

fserb
difflib seems to be made for text files, returning the diff between the lines.
sharvey
not true. You can send any arbitrary data into a SequenceMatcher.
fserb
+3  A: 

From the bsdiff website:

It has also been made into a Python extension module, and there is a Windows port available.

Following the link brings you to the module's page.

Claudiu
I somehow saw the Windows link but not this one...There's no version for 2.6 but it can't be that hard to build for it, am I right?
sharvey
Probably isn't hard. Definitely worth trying.
quark
python setup.py install just does'nt work, gives me "failed with exit status 1107".
sharvey
A: 

Also, the SequenceMatcher class (from the Python standard library) can be helpful.

Check out the other contents of the difflib module as well.

Eli Bendersky