I2C SPI USB CAN eSPI Cable Testing View All Videos Quick Start Guides Software Downloads App Notes White Papers User Manuals Knowledge Base Sales Support About Us
Products Blog Sales Support Contact Search
Support Question of the Week: Controlling Data Center Software with a Remote Terminal and a Python Script

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.

  1. I start Data Center Software with the command line option, -c
  2. After that, I try to execute commands in Data Center Software’s command line.
  3. However, only every other command seems to reach Data Center Software’s command prompt. The other is interpreted by Windows’ console.

Here are the details:

  1. I run the command “Data Center.exe” –c.
  2. The command line instantly returns to the system’s prompt C:\temp\dc>.
  3. Meanwhile, the Data Center Software starts and the output until 1> is printed to the console.
  4. I enter dir [RETURN].
  5. This command is interpreted by windows command line (the directory content is printed).
  6. I enter dir [RETURN] again.
  7. Command is interpreted by Data Center à name ‘dir’ is not defined is printed.
  8. I enter dir [RETURN] again.
  9. Again, it’s interpreted by Windows console.

The screenshot below shows an example. My inputs are shown in red.

The original commands the customer used Example of Customer Commands and Results

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 time

import 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 command

tn.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')


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 Guide

We 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.