os.system commands

I am developing a program which needs to use os.system because of the old Python limitations. Currently I'm stuck in one small spot.

os.system("C:\\FIOCheck\\xutil.exe  -i get phy" +HBEA + ">C:\\FIOCheck\\HBEAResult.txt")

This is the piece of code I am trying to work through. It will access an external program, which has some parameters. HBEA is the variable I am trying to pass (which is received earlier in the program). The program then takes whatever the .exe created and pipes it to an external file. At this point, the variable HBEA is not being passed to the command line, so the .exe never runs, which causes the .txt to be blank. Since the file is blank, I cannot grab data from it and therefore cannot complete the program.

Any ideas?

EDIT: So I attempted the following code per some suggestions:

cmd = "C:\\FIOCheck\\xutil.exe  -i get phy " +HBEA + ">C:\\FIOCheck\\HBEAResult.txt"
print cmd

The following output was generated:

50012BE00004BDFF  #HBEA variable
C:\FIOCheck\xutil.exe  -i get phy 50012BE00004BDFF>C:\FIOCheck\HBEAResult.txt #the cmd  var

However this still isn't passing the value through. Is the HBEA variable too long?


This program worked with some editing from the best answer. The commands were passing correctly, however the way I formatted it was not correct. The new formatting looks like:

cmd = "C:\\FIOCheck\\xutil.exe -i " + HBEA + " get ver" + ">C:\\FIOCheck\\HBEAResult.txt"

Thanks for the help!


os.system("C:\\FIOCheck\\xutil.exe  -i get phy" +HBEA + ">C:\\FIOCheck\\HBEAResult.txt")

should that be

os.system("C:\\FIOCheck\\xutil.exe  -i get phy " +HBEA + ">C:\\FIOCheck\\HBEAResult.txt")

and you can always build the string first

cmd = "C:\\FIOCheck\\xutil.exe  -i get phy " +HBEA + ">C:\\FIOCheck\\HBEAResult.txt"
print cmd

Need Your Help

Should I use save/load or export/import for my application using Docker? And an additional uncertainty


Without hardly any knowledge of Docker, I made a program that remotely manages images and containers for many PCs (robotic platforms) on a local network. All of the PCs are the same with a lightwe...

I would like to have a CSS layout with 100% body height

css height sticky-footer

I've been making some great progress so far. I have the sticky footer working the way I would like i.e.