-1

i have a simple test file i created in order to use vmd (a program for my job) This test file is as simple as :

import os

os.system("vmd -eofexit < VMD_script.tcl -args 3spi_cholesterol")

Basically, im using os.system to launch a program name vmd with another script i wrote and im giving it one argument. What i found it is that when i run this test script, i get nothing done but if i just go in terminal and write :

vmd -eofexit < VMD_script.tcl -args 3spi_cholesterol

everything works perfectly. Is there anything im doing wrong with os.system? I have been using this line for a while now but on linux and it was working perfectly, could it be a mac issue?

Thanks allot

Moses Koledoye
  • 77,341
  • 8
  • 133
  • 139
Tanjay
  • 11
  • 2
  • See [this question](http://stackoverflow.com/questions/18739239/python-how-to-get-stdout-after-running-os-system) – Laur Ivan Jun 23 '16 at 15:05
  • I suggest using subprocess.Popen instead. According to [the accepted answer of this question](http://stackoverflow.com/questions/4813238/difference-between-subprocess-popen-and-os-system), Popen is a more flexible replacement of os.system. – kirkpatt Jun 23 '16 at 15:05

1 Answers1

0
import subprocess
ls_output = subprocess.check_output(['vmd', '-eofexit', '<', 'VMD_script.tcl', '-args', '3spi_cholesterol'])
Ohad the Lad
  • 1,889
  • 1
  • 15
  • 24