Q: I am trying to control Data Center Software using Python Popen and writing commands to the Data Center Software stdin. However, stdin seems to be closed on startup. I am not able to write commands to the Data Center Software.
Here are the details:
The screenshot below shows an example. My inputs are shown in red.
Any suggestions?
A: Thanks for your question! We recommend using the remote console to control the Data Center Software from an external process. This enables a telnet terminal for other applications (or computers) to connect to and control the software. The remote terminal takes the same commands as the internal command line interface. For more information, see section 4.1.5 of the Data Center User Manual.
This feature will allow you to use a script to send each command as you would from within the application. Here is an example:
The following Python script uses the telnet module to connect to the Data Center running on the same machine. It then sends the command to start the capture, waits for 3 seconds, and then sends commands to stop, save, and clear.
import timeimport telnetlib
# Connect to the remote telnet port of Data Center. This requires
# Data Center to be started with the "-r 6000" command line
# argument.
tn = telnetlib.Telnet('localhost', 6000)
def send (cmd, ret, timeout=10):
# Send the commandtn.write(("%s\n" % cmd).encode('utf-8'))
# Wait for the return value
tn.read_until(ret.encode('utf-8'), timeout)
# Additional delay - prevents strange behavior time.sleep(1)
SAVE = "save(u'/tmp/output%d.tdc', {'no_timing': False, 'filtered_only': False}, True)"
index = 0
while 1:
send('run', 'started')time.sleep(3)
send('stop', 'stopped')
send(SAVE % index, 'saved')
send('clear_all(True)', 'cleared')
index += 1
For more information about Data Center Software and other Total Phase products, please refer to:
Data Center Software User Manual
Total Phase Products Product Selector GuideWe hope this answers your question. If you have other questions about our Host Adapters or other Total Phase products, feel free to email us at sales@totalphase.com or support@totalphase.com.