0

First of all, I'm new to coding and I''ve tried a lot to understand this problem but I'm stuck. So, I have an executable (application/x-executable) file that I need to run in python code(not from command prompt). In command prompt it is working by:

$ ./test
> add filename.xml

So, what I did is I used subprocess module and I guess it is working.

import subprocess
subprocess.call('./test')

Now I need to pass arguments, Im trying to

subprocess.run('add fielname.xml', shell=True)

It is giving the following error

/bin/sh: 1: add: not found

Appreciate any hint or help!

HElooo
  • 23
  • 4

1 Answers1

0

You can do it in this way

subprocess.run(["./test"],input=b"add filename.xml")
Gealber
  • 463
  • 5
  • 13
  • 1
    In [How to Answer](https://stackoverflow.com/help/how-to-answer), note the *Answer Well-Asked Questions* section, and therein the bullet point regarding questions that "have been asked and answered many times before" – Charles Duffy Dec 07 '20 at 19:53
  • You are right, didn't know about that. – Gealber Dec 07 '20 at 21:37