pkt / splitta

Automatically exported from code.google.com/p/splitta
0 stars 0 forks source link

Fix zcat on Mac #7

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi, on Mac "zcat" does the wrong thing (it looks for a file "feats.Z").  
Instead it needs to be "gzcat".  The following patch fixes it.

Index: sbd_util.py
===================================================================
--- sbd_util.py (revision 20)
+++ sbd_util.py (working copy)
@@ -5,9 +5,11 @@
     cPickle.dump(data, o)
     o.close()

+ZCAT = 'gzcat' if 'Darwin' in os.popen("uname -a").read().split() else zcat
+
 def load_pickle(path):
     #i = gzip.open(path, 'rb')
-    i = os.popen('zcat ' + path)
+    i = os.popen(ZCAT + ' ' + path)
     data = cPickle.load(i)
     i.close()
     return data

Original issue reported on code.google.com by brenocon@gmail.com on 3 Mar 2011 at 7:59

GoogleCodeExporter commented 9 years ago
Oops got the patch wrong. again:

Index: sbd_util.py
===================================================================
--- sbd_util.py (revision 20)
+++ sbd_util.py (working copy)
@@ -5,9 +5,11 @@
     cPickle.dump(data, o)
     o.close()

+ZCAT = 'gzcat' if 'Darwin' in os.popen("uname -a").read().split() else 'zcat'
+
 def load_pickle(path):
     #i = gzip.open(path, 'rb')
-    i = os.popen('zcat ' + path)
+    i = os.popen(ZCAT + ' ' + path)
     data = cPickle.load(i)
     i.close()
     return data

Original comment by brenocon@gmail.com on 3 Mar 2011 at 7:59

GoogleCodeExporter commented 9 years ago
Fixed using your patch. Thanks!
Dan

Original comment by dgill...@gmail.com on 12 May 2011 at 10:02