From: Reinhold Kainhofer Date: Mon, 23 Aug 2010 17:05:17 +0000 (+0200) Subject: Lilypond-book: (Windows) the subprocess mod fails due to msvcrt, use os.popen3 X-Git-Tag: release/2.13.31-1~2^2~1 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=6e0a478c394f0cd382b46d992362bb2e8f01c409;p=lilypond.git Lilypond-book: (Windows) the subprocess mod fails due to msvcrt, use os.popen3 os.popen3 is deprecated, but the GUB build does not include the msvcrt module which is required by the subprocess module (Windows only). So, we can't use the suggested replacement (subprocess.Popen) instead of os.popen3... --- diff --git a/python/book_snippets.py b/python/book_snippets.py index 443ad3c363..a19a5796d7 100644 --- a/python/book_snippets.py +++ b/python/book_snippets.py @@ -6,7 +6,11 @@ global _;_=ly._ import re import os import copy -from subprocess import Popen, PIPE +# TODO: We are using os.popen3, which has been deprecated since python 2.6. The +# suggested replacement is the Popen function of the subprocess module. +# Unfortunately, on windows this needs the msvcrt module, which doesn't seem +# to be available in GUB?!?!?! +# from subprocess import Popen, PIPE progress = ly.progress warning = ly.warning @@ -717,10 +721,10 @@ printing diff against existing file." % filename) if self.global_options.verbose: progress (_ ("Opening filter `%s'\n") % cmd) - #(stdin, stdout, stderr) = os.popen3 (cmd) - - p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True) - (stdin, stdout, stderr) = (p.stdin, p.stdout, p.stderr) + # TODO: Use Popen once we resolve the problem with msvcrt in Windows: + (stdin, stdout, stderr) = os.popen3 (cmd) + # p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True) + # (stdin, stdout, stderr) = (p.stdin, p.stdout, p.stderr) stdin.write (input) status = stdin.close ()