input for Python shell

Dongsun Han's icon

Hi,

Max Patch
Copy patch and select New From Clipboard in Max.

I'm super newbie, sorry. I'm trying to do stuffs at a "hello world" level using shell object and python scripts in Max. for print() objects, like

a = 3
b = 5
print(a+b)
it works, Max console shows well 8. But for example for a = input("enter any number"), it doesn't work! I would like to give an input from Max to Python script. How can I do it? Thanks!!

Sergio Lecuona's icon

Hi donsung han,

I know it's been quite a while since you posted it, but maybe it helps to other people.
I'm not a to-programmer, but I don't like input(). Instead, I would rather interact with python through OSC (I'm using python-osc) or use arguments. With this approach, you could just print at the startup "enter any number" as a call for interaction.

Shakeeb Alireza's icon

You might also check out my py-js project, which provides lots of options for running python3 within Max.