how to disappear CMD window after using os.system in python

0

I have a code in Python 2.7 that opens a PDF with os.system('meuarquivo.pdf') and it opens up right. However when opening the file it also opens an empty CMD window. Is there any way I can close this window or prevent it from appearing?

os.system('MeuArquivo.pdf')

My code gets completely disabled while I do not close this file. I would like it to open as a common file and not necessarily tied to the code.

    
asked by anonymous 27.12.2017 / 17:00

1 answer

1

I found out how to do it.

I can replace os.system() with:

subprocess.Popen([File],shell=True)

So it does not lock the code and does not open the CMD window.

    
27.12.2017 / 17:15