Commits

Lenard Lindstrom  committed 45d04b2

Python 3.1 upgrade

  • Participants
  • Parent commits cd8ec06

Comments (0)

Files changed (1)

 
 from msysio import raw_input_ as msys_raw_input, print_ as msys_print
 from msysio import is_msys
+import sys
 import os
 import time
 import subprocess
 def geterror():
     return sys.exc_info()[1]
 
+if sys.version_info > (3,):
+    def encode_script(s):
+        return s.encode('ascii')
+else:
+    def encode_script(s):
+        return s
+
 FSTAB_REGEX = (r'^[ \t]*(?P<path>'
                r'([a-zA-Z]:){0,1}([\\/][^\s*^?:%\\/]+)+)'
                r'[ \t]+/mingw(\s|$)'
             process = subprocess.Popen(cmd,
                                        stdin=subprocess.PIPE,
                                        env=self.environ)
-            process.communicate(script)
+            process.communicate(encode_script(script))
             return process.returncode
         finally:
             time.sleep(2)  # Allow shell subprocesses to terminate.