Mod-script-pipe - Works fine and then file not found

Good Morning,

I’ve managed to use mod-script-pipe to script Audacity (on Win 7 and 10) and it’s working fine, except that after launching a few times the script I seem to lose the connection from Python to Audacity and I get the following error:

FileNotFoundError: [Errno 2] No such file or directory: ‘\\.\pipe\ToSrvPipe’

If I try to launch the script again I then get the following error:

Read (or Write) from “\.\pipe\FromSrvPipe”
…does not exist. Ensure Audacity is running with mod-script-pipe.

I’m using the pipe-test.py file (please see code below) to check the connection with Audacity before running my script. Sometimes if I close Audacity and re-open it the script will work again for a few times and then will give me the same error, sometimes re-opening Audacity doesn’t work. I don’t really understand what the pipe-test.py is trying to (what is path “'\\.\pipe\ToSrvPipe”?), is there anything I could do or add to the code to stabilize the connection between Python and Audacity? I

Thanks in advance for your response

You’ve not attached the code.

I’m not very familiar with names pipes on Windows either, but “pipeclient.py” should provide an easy way to use pipes on all platforms:

When you open a file with the name “filename.ext”; you are telling the open() function that your file is in the current working directory . This is called a relative path.

file = open(‘filename.ext’) //relative path

In the above code, you are not giving the full path to a file to the open() function, just its name - a relative path. The error “FileNotFoundError: [Errno 2] No such file or directory” is telling you that there is no file of that name in the working directory. So, try using the exact, or absolute path.

file = open(r’C:\path\to\your\filename.ext’) //absolute path

In the above code, all of the information needed to locate the file is contained in the path string - absolute path.

I also have the same problem but don’t know how to solve it. Testing with GitHub scripts has this problem. Can you tell me how to solve this problem?
[audacity/scripts/piped-work/pipe_test.py at master · audacity/audacity · GitHub](https://github.com/audacity/audacity/blob/master/scripts/piped-work/pipe_test.py)
PS C:\Users\Eul> python --version
Python 3.7.6
NPP_SAVE: C:\Program Files (x86)\Audacity\Plug-Ins\pipe_test.py
CD: C:\Program Files (x86)\Audacity\Plug-Ins
Current directory: C:\Program Files (x86)\Audacity\Plug-Ins
C:\Users\Eul\AppData\Local\Programs\Python\Python37\python.exe “C:\Program Files (x86)\Audacity\Plug-Ins\pipe_test.py”
Process started (PID=17324) >>>
pipe-test.py, running on windows
Write to “\.\pipe\ToSrvPipe”
…does not exist. Ensure Audacity is running with mod-script-pipe.
<<< Process finished (PID=17324). (Exit code 0)
================ READY ================