Hi there,
While testing pip install pyphen
and the python code by @jordan within SuperCollider 3.13.0 on MacOS and Windows, I found the following problems (?) with Unix-related methods and classes. In this thread I will only use the example of pip install pyphen
to briefly describe the problem, but the same thing happens with @jordan’s code.
Problem 1
When using all Unix-related methods and the Pipe class except .runInTerminal
, SuperCollider under MacOS does not know the paths for python and pip. So the following code will work as expected:
"pip install pyphen".runInTerminal
but any of the following codes will not work under macOS:
"pip install pyphen".unixCmd
"pip install pyphen".systemCmd
"pip install pyphen".unixCmdGetStdOut
"pip install pyphen".unixCmdGetStdOutLines
(
var p, l;
p = Pipe.new("pip install pyphen", "r");
l = p.getLine;
while({l.notNil}, {l.postln; l = p.getLine; });
p.close;
)
The above codes should be rewritten with the path for pip
as follows:
"/Users/prko/opt/anaconda3/bin/pip install pyphen".unixCmd
"/Users/prko/opt/anaconda3/bin/pip install pyphen".systemCmd
"/Users/prko/opt/anaconda3/bin/pip install pyphen".unixCmdGetStdOut
"/Users/prko/opt/anaconda3/bin/pip install pyphen".unixCmdGetStdOutLines
(
var p, l;
p = Pipe.new("/Users/prko/opt/anaconda3/bin/pip install pyphen", "r");
l = p.getLine;
while({l.notNil}, {l.postln; l = p.getLine; });
p.close;
)
Why is this happening on MacOS? On Windows we do not need to specify the path for pip
and python
. I have not tested this on Linux. Does anyone know what happens on Linux?
Problem 2
systemCmd
, unixCmdGetStdOut
, unixCmdGetStdOutLines
and Pipe
only respond at odd times on Windows.
runInTerminal
works as expected:
"pip install pyphen".runInTerminal
Each time the above code is evaluated, sclang returns the following strings in the post window of SC-IDE, and executes the command by running a command prompt window.
-> pip install pyphen
Evaluating the following code will always work correctly,
"pip install pyphen".unixCmd
and will always return the following results on those occasions:
-> 38304
Requirement already satisfied: pyphen in c:\users\prko\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (0.14.0)
However, the following code
"pip install pyphen".systemCmd
and the following code
(
var p, l;
p = Pipe.new("pip install pyphen", "r");
l = p.getLine;
while({l.notNil}, {l.postln; l = p.getLine; });
p.close;
)
return the following strings in the post window of the SC-IDE only on odd times, such as the first time, the third time, and so on, of evaluating the code, and it returns no result on even times, such as the second time, the fourth time, and so on:
Requirement already satisfied: pyphen in c:\users\prko\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (0.14.0)
-> 0
Also, the following code
"pip install pyphen".unixCmdGetStdOut
returns the following strings in the post window of the SC-IDE only on odd times, such as the first time, the third time, and so on, of evaluating the code, and it returns no result on even times, such as the second time, the fourth time, and so on:
-> Requirement already satisfied: pyphen in c:\users\prko\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (0.14.0)
Also, the following code
"pip install pyphen".unixCmdGetStdOutLines
returns the following strings in the post window of the SC-IDE only on odd times, such as the first time, the third time, and so on, of evaluating the code, and it returns no result on even times, such as the second time, the fourth time, and so on:
-> [ Requirement already satisfied: pyphen in c:\users\prko\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (0.14.0) ]
Under MacOS it always returns its result if pip
and python
are specified with the correct path. Why do systemCmd
, unixCmdGetStdOut
, unixCmdGetStdOutLines
and Pipe
only respond at odd times on Windows? What about them on Linux?
Problem 3
systemCmd
, unixCmdGetStdOut
, unixCmdGetStdOutLines
and Pipe
interfere with each other, so the things described in Problem 2 occur across these things.
Are these characteristics bugs or not?
Thanks in advance!