On Sat, Jan 14, 2012 at 09:28:08AM -0000, Trevor Daniels wrote: > > Graham, you wrote Saturday, January 14, 2012 8:07 AM > > >Could somebody on windows send me lilypond-book.py ? I only need > >that file... actually, I only need the first 20 lines or so of > >that file. But you might as well send me the entire thing just in > >case. > > Here it is, from usr/bin.
Excellent, we're in business. Please put the attached file in the same directory as lilypond-book, then run test-subprocess.py I expect 1 and 2 to work. If 3 works, we're golden. If 4 succeeds then something weirder than I think is happening. - Graham
#!/usr/bin/python # -*- coding: utf-8 -*- import os import sys import subprocess """ This generic code used for all python scripts. The quotes are to ensure that the source .py file can still be run as a python script, but does not include any sys.path handling. Otherwise, the lilypond-book calls inside the build might modify installed .pyc files. """ for d in ['/usr/share/lilypond/2.15.25', '/usr/lib/lilypond/2.15.25']: sys.path.insert (0, os.path.join (d, 'python')) # dynamic relocation, for GUB binaries. bindir = os.path.abspath (os.path.dirname (sys.argv[0])) for p in ['share', 'lib']: datadir = os.path.abspath (bindir + '/../%s/lilypond/current/python/' % p) sys.path.insert (0, datadir) """ """ def main(): print "**** Begin testing" cmd = "dir" ret = os.system(cmd) print "1. return code: ", ret cmd = "dir" proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE) ret = proc.wait() print "2. return code: ", ret out = open('log.txt', 'w') cmd = "dir" proc = subprocess.Popen(cmd, shell=True, stdout=out) ret = proc.wait() print "3. return code: ", ret cmd = "dir" proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE) ans = proc.communicate() ret = proc.returncode print "4. return code: ", ret if __name__ == '__main__': main ()
_______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel