[Pythonmac-SIG] Calling diff from MacPython

Robin Siebler Robin.Siebler@palmsource.com
Fri, 13 Sep 2002 13:26:07 -0700


Using filecmp.cmp()and cmp() seems to be working, although I haven't fed =
it any large files yet.  I think using cmp() to compare each line of the =
file (for files that filecmp shows to be different) might be a bit slow =
on large (5k lines or better) files.

-----Original Message-----
From: Ryan Wilcox [mailto:ryanwilcox@mac.com]
Sent: Friday, September 13, 2002 12:48 PM
To: Robin Siebler; pythonmac-sig@python.org
Subject: Re: [Pythonmac-SIG] Calling diff from MacPython


On Friday, September 13, 2002, at 11:40 AM, Robin Siebler wrote:

>I need to compare to files and find out where they are different.=20
>Using diff seems to be a much better/faster choice compared to using
>cmp().  How would I call the *nix command diff from MacPython?  The
>MacPython version of os has no system() call.=20


If you can control your environment, you might consider using BBEdit's
Compare Files. It's only "ok" -- but it's pretty easy to figure out if
two files are different. (It however, will NOT tell you how MANY
differences WERE found via the scripting interface)

Don't know if it's faster then cmp() though. And I don't think there's
a built-in BBEdit python module -- you'd have to wrap a lot of it
yourself.

---------------
HOLD THE TRAIN....

You also might be able to use the "do shell script" osax to do this..
wrapping this into SYSTEM, I think, would be pretty simple.

On OS 9, doesn't system() call MPW? (I thought I saw that somewhere)

If I get a chance this weekend, I can investigate this...

Have a good holiday, Jack.
-Ryan Wilcox
----------------
PGP: 0x2F4E9C31
----------------