Update mutt-notmuch-py to be py3 compatible
1 files changed, 7 insertions(+), 7 deletions(-)

M bin/mutt-notmuch-py
M bin/mutt-notmuch-py +7 -7
@@ 1,4 1,4 @@ 
-#!/usr/local/bin/python
+#!/usr/bin/python3
 """
 mutt-notmuch-py
 

          
@@ 21,15 21,14 @@ Only tested on OSX Lion.
 (c) 2012 - Honza Pokorny
 Licensed under BSD
 """
-import hashlib, sys
-from commands import getoutput
+import hashlib, sys, subprocess
 from mailbox import Maildir
 from optparse import OptionParser
 
 
 def digest(filename):
     with open(filename) as f:
-        return hashlib.sha1(f.read()).hexdigest()
+        return hashlib.sha1(f.read().encode()).hexdigest()
 
 
 def pick_all_mail(messages):

          
@@ 44,11 43,12 @@ def empty_dir(directory):
 
 
 def command(cmd):
-    return getoutput(cmd)
+    cmds = cmd.split()
+    return subprocess.run(cmds, capture_output=True)
 
 
 def main(dest_box):
-    query = raw_input('Query: ')
+    query = input('Query: ')
 
     command('mkdir -p %s' % dest_box)
     command('mkdir -p %s/cur' % dest_box)

          
@@ 56,7 56,7 @@ def main(dest_box):
 
     empty_dir(dest_box)
 
-    files = command('notmuch search --output=files %s' % query).split('\n')
+    files = command('notmuch search --output=files %s' % query).stdout.decode().split('\n')
     files = filter(None, files)
 
     data = {}