Gylles
Gylles

Reputation: 21

launch vim from python script and end script

I'm a newbie in programming in general, and with python in particular ...

I'm trying to write a python script, launched from a Linux Terminal, with a 'latex' file as an argument :

my_script.py file.tex.

I wish then my_script.py to open the file.tex in vim (in the Terminal), run another compiling script and then close, leaving 'file.tex' opened in vim and the compiling script running in background.

So, I tried :

myfile = "file.tex"
subprocess.call("vim "+ myfile)
subprocess.call("Latex_compiling_commande "+myfile)

but my_script.py is still waiting for vim to close before continuing, which is exaclty what subprocess.call is supposed to do, as explained in the : official python doc.

I tried :

subprocess.Popen(["vim", myfile])

I've got an 'input/ouput error'...

Thanks in advance.

Upvotes: 1

Views: 1661

Answers (1)

invictus1306
invictus1306

Reputation: 597

Try with:

import os
os.system("command")

For subprocess see this link

Upvotes: 1

Related Questions