def save_string_and_execute_LilyPond(ly_string, filename, command):
    """A helper function for to_png and to_pdf. Should not be used directly."""
    ly_string = '\\version "2.10.33"\n' + ly_string
    if filename[-4:] in ['.pdf', '.png']:
        filename = filename[:-4]
    try:
        f = open(filename + '.ly', 'w')
        f.write(ly_string)
        f.close()
    except:
        return False
    command = 'lilypond %s -o "%s" "%s.ly"' % (command, filename, filename)
    print 'Executing: %s' % command
    p = subprocess.Popen(command, shell=True).wait()
    os.remove(filename + '.ly')
    return True
def save_string_and_execute_LilyPond ( ly_string , filename , command ) : ly_string = '\\version "2.10.33"\n' + ly_string if filename [ - 4 : ] in [ '.pdf' , '.png' ] : filename = filename [ : - 4 ] try : f = open ( filename + '.ly' , 'w' ) f . write ( ly_string ) f . close ( ) except : return False command = 'lilypond %s -o "%s" "%s.ly"' % ( command , filename , filename ) print 'Executing: %s' % command p = subprocess . Popen ( command , shell = True ) . wait ( ) os . remove ( filename + '.ly' ) return True
A helper function for to_png and to_pdf. Should not be used directly.