Hello all!
I’m having some problems when executing a Python input() function when scripting in a Text DAT. The Texport and OP’s Info says about EOF Error (EOFError: EOF when reading a line)
The input() function doesn’t work even in a simple script like this:
a = input("Type something ")
print(a)
However, in a PyCharm editor (with a Python 2.7) a code like this works fine:
a = raw_input("Type something ")
print(a)
I’m running TouchDesigner 099 on OSX 10.11.6, if that helps
I think part of the challenge you’re experiencing is that the textport doesn’t really assume python interactivity the way that a traditional console might - in the installations I’ve made and seen the text port isn’t exposed to the user, so the idea of using input is something of a discontinuity with the environment.
What are you looking to do with a text input? There might be a more TouchDesiger centric way of getting to the same result.
Ran into this issue while doing FFMPEG conversions in textport. When FFMPEG was asking to overwrite files? [Y/N], textport was auto-exiting the script, not even giving me a choice.
Was able to work around this by calling the script externally outside the scope of textport. Here’s a basic example:
import subprocess
import os
# Define the external script path
# Replace test.py with the path to your script with input() functions
script_path = r"test.py"
# Data you'll send to the script
data = "hello world"
# Create the command to open a new CMD window and run the script
command = f'start cmd /k python "{script_path}" "{data}"'
# Run the command
subprocess.run(command, shell=True)
Keep in mind, you’ll need to parse out the data accordingly depending on your inputs. For example:
# test.py
import sys
# Get the data from the command-line arguments
data = sys.argv[1]
# Use the data in input
i = input(data + ": ")
print(i)
Now if you run op(‘text1’) you’ll be able to use input() functionality since it’s running outside the scope of textport.