Here's the whole code:
Code:
import sysimport osimport sysif sys.platform == 'win32': print("pipe-test.py, running on windows") TONAME = '\\\\.\\pipe\\ToSrvPipe' FROMNAME = '\\\\.\\pipe\\FromSrvPipe' EOL = '\r\n\0'else: print("pipe-test.py, running on linux or mac") TONAME = '/tmp/audacity_script_pipe.to.' + str(os.getuid()) FROMNAME = '/tmp/audacity_script_pipe.from.' + str(os.getuid()) EOL = '\n'print("Write to \"" + TONAME +"\"")if not os.path.exists(TONAME): print(" ..does not exist. Ensure Audacity is running with mod-script-pipe.") sys.exit()print("Read from \"" + FROMNAME +"\"")if not os.path.exists(FROMNAME): print(" ..does not exist. Ensure Audacity is running with mod-script-pipe.") sys.exit()print("-- Both pipes exist. This is a good thing.")TOFILE = open(TONAME, 'w')print("-- File to which to write has been opened")FROMFILE = open(FROMNAME, 'rt')print("-- File from which to read has now been opened also\r\n")def send_command(command): """Send a single command.""" print("Send: >>> \n"+command) TOFILE.write(command + EOL) TOFILE.flush()send_command("Export")
Statistics: Posted by Henrik Gill — Mon Feb 26, 2024 1:06 pm