Help, I can't seem to print anything as soon as I call pyo audio server.
It just exits without returning anything.
Even something like this:
from pyo import *
s = Server()
print("this is not printed")
s.boot()
x = 3.4
print(x,"neither are these")
This should be working right? Or am I hugely mistaken?
I am using the python module pyo
version 1.0.1 with Python version 3.7.3 run using Python IDLE 3.7
btw: audio output works, I just want printing for debugging purposes
The problem appears to be redirection of stdout
as seen here: stdout redirect from Jupyter notebook is landing in the terminal
The example below worked for me. I don't know whether this fix screws up anything with pyo
- I imagine the GUI portion could have some issues - but I have been able to produce the sounds I want after applying this fix.
# %%
import sys
old_stdout = sys.stdout
# %%
print('Hello World') # Outputs 'Hello World'
# %%
s=Server()
print('Hello Server') # No output; 'Hello Server' appears in the terminal that called python to begin with
# %%
sys.stdout = old_stdout
print('Hello Again') # Outputs 'Hello Again'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.