0

I run windows command line programm from python, the command line programm return strings, for example: I run that line

subprocess.call("RPiHubCMDTool.exe dev", shell=True)

and I see in cmd window the output dev0 FT2232H RPi HUB Module A 136241 A , dev1 FT2232H RPi HUB Module B 136242 B. I whant to work in python with that output. How to bring it from cmd window to python? Could you provide an example?

glglgl
  • 89,107
  • 13
  • 149
  • 217
MAX K
  • 1
  • 1

2 Answers2

1

to get the output you can use

output=subprocess.check_output(["echo", "Hello World!"])
print output
# Hello World!
sundar nataraj
  • 8,524
  • 2
  • 34
  • 46
0

How about write the result to a file and read this file in python?

subprocess.call("RPiHubCMDTool.exe dev > result.txt", shell=True)
f = open('result.txt', 'r')
# do something with f
D_S_toowhite
  • 643
  • 5
  • 17