mod-script-pipe

Hello,

I’m testing the mod-script-pipe functionality re: writing an addon for blender.

With the build environment I have set up for blender on ubuntu 18 both audacity and mod-script-pipe built with no hassle.

However when running the test scripts in piped-work under python3

tofile = open( toname, 'wt+' )

Always produces the error

io.UnsupportedOperation: File or stream is not seekable.

can be worked around by replacing

wt+

with

wt

Is there likely to be any implications doing this?

I presume that you are referring to “pipe_test.py” ? https://github.com/audacity/audacity/blob/master/scripts/piped-work/pipe_test.py

“pipe_test.py” is only intended as a test to check that scripting is working. Does the test work with your modification?


For practical scripting, I’d recommend using “pipeclient.py” as a starting point. https://github.com/audacity/audacity/blob/master/scripts/piped-work/pipeclient.py

I think ‘wt+’ is a programming error. I recall that the original developer was initially having some difficulty getting the pipes to open correctly on Linux.

This works for me with Python 2.7 and Python 3.4:

tofile = open( toname, 'w' )

Note also that at line 54, the line is indented with a tab character - strictly speaking, that should be replaced with spaces.

pipe_test.py has been updated. The new version is available here: https://raw.githubusercontent.com/audacity/audacity/master/scripts/piped-work/pipe_test.py

Thankyou. Will look into pipe_client.py.

I’ve just posted an example script that uses pipe_client.py: GetInfo from python script - #4 by steve

When I run pipe client on my windows 10 machine I get the error

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

This comes from line 160.

self._write_pipe = open(WRITE_NAME, 'w')

When I run pipe test I get the following output:

pipe-test.py, running on windows
Write to  "\\.\pipe\ToSrvPipe"
Read from "\\.\pipe\FromSrvPipe"
-- Both pipes exist.  Good.
Traceback (most recent call last):
  File "./pipe.py", line 44, in <module>
    TOFILE = open(TONAME, 'w')
FileNotFoundError: [Errno 2] No such file or directory: '\\\\.\\pipe\\ToSrvPipe'

Any ideas how to fix this?

You need to enable mod-script-pipe in Audacity, and then restart Audacity. See: https://manual.audacityteam.org/man/scripting.html#Enable_mod-script-pipe

I already have it enabled. I’m still getting that error.

The only way I can get that error is by disabling the module. Are you absolutely sure that mod-script-pipe is still enabled (AND you restarted Audacity after enabling it)?

Which version of Python are you using?

Are you launching Audacity and mod-script-pipe from different directories?
How exactly are you launching Audacity and Python?

Try launching Audacity from the command line, then (without changing directories), launch pipeclient.py
What happens then?

Which exact version of Audacity are you using?

I’ve discovered some peculiarities in the behaviour of mod-script-pipe in recent versions of Audacity, but I’m not able to progress further diagnosing the problem that you describe Gibbz without further information about what you are using and what you are doing.

There’s an error in pipeclient.py (it appears that someone “corrected” my original script and introduced a bug).
Line 211 should be:

while line != '\n':

I am using audacity version 2.3.2 python 3.7
I have tried disabling the mod-pipe, restart, enable, restart, then run the script.
Tried executing the script from the desktop, and also the audacity folder (C:\Program Files (x86)\Audacity).

I’m still getting the same error each time…

Have you had previous versions of mod-script-pipe installed? If so, there could be a conflict causing this problem.

No other version. Ive just grabbed the new audacity, installed over the old, and thought to enable it to see if its useful for something I want to do.
Would an uninstall - reinstall be likley to fix the issue? Or are there some config files around in my user directory?

Im on windows 10

An uninstall/reinstall won’t help.

You say you are on Win10, but are you perhaps running python in a MinGW environment or Audacity in a Linux VM?

I don’t know how to diagnose this. There may be a way to see creation of named pipes, e.g. using system internals program, but I have not tried this.

Another thought is that you might have a security or group policy setting on your machine.

… my message got cut off.

I was thinking this setting or something similar…

https://docs.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/network-access-restrict-anonymous-access-to-named-pipes-and-shares

There’s a free command line tool called “PipeList” available (32 and 64-bit versions available) from https://live.sysinternals.com/

If you run this tool before launching Audacity, you should see a list similar to this:

Pipe Name                                    Instances       Max Instances
---------                                    ---------       -------------
InitShutdown                                      3               -1
lsass                                             4               -1
ntsvcs                                            3               -1
scerpc                                            3               -1
Winsock2\CatalogChangeListener-3b8-0              1                1
epmapper                                          3               -1
Winsock2\CatalogChangeListener-210-0              1                1
...

Note that there should be no mention of “ToSrvPipe” or “FromSrvPipe”.

Then launch Audacity and run PipeList again. You should now see these items added at the bottom of the list.

ToSrvPipe                                         1               -1
FromSrvPipe                                       1               -1

Does that happen?