Commits

Amaury Forgeot d'Arc  committed 200de6d

graphviewer now uses the subprocess module instead of os.popen2.
This works on Windows.
And no need to hack the file mode any more :-)

  • Participants
  • Parent commits 72a64a1

Comments (0)

Files changed (2)

File dotviewer/graphclient.py

 import os, sys, re
+import subprocess
 import msgstruct
 
 this_dir = os.path.dirname(os.path.abspath(__file__))
     else:
         python = sys.executable
     cmdline = '"%s" -u "%s" --stdio' % (python, GRAPHSERVER)
-    child_in, child_out = os.popen2(cmdline, 'tb')
+    p = subprocess.Popen(cmdline,
+                         stdout=subprocess.PIPE, stdin=subprocess.PIPE)
+    child_in, child_out = p.stdin, p.stdout
     io = msgstruct.FileIO(child_out, child_in)
     return io
 

File dotviewer/msgstruct.py

 
 class FileIO(IO):
     def __init__(self, f_in, f_out):
-        if sys.platform == 'win32':
-            import msvcrt
-            msvcrt.setmode(f_in.fileno(), os.O_BINARY)
-            msvcrt.setmode(f_out.fileno(), os.O_BINARY)
         self.f_in = f_in
         self.f_out = f_out