I need to call an external programme from python plugin in qgis, I didn't use os.systeme because I want to hide the launched programme with 'startupinfo.dwFlags |= subprocess._subprocess.STARTF_USESHOWWINDOW'.

import subprocess
import os
startupinfo = None
if os.name == 'nt':
    startupinfo = subprocess.STARTUPINFO()
    startupinfo.dwFlags |= subprocess._subprocess.STARTF_USESHOWWINDOW
subprocess.Popen("TeighaFileConverter",shell=True, stdin=None, stdout=PIPE, stderr=PIPE,startupinfo=startupinfo)

it's workin on pyzo but not working in QGIS editor.
this code is working on linux but not on windows :/

1 Answer 1


you could also try subprocess.call


and make sure that you have the path to your TeighaFileConverter installation in you path variable


I tested the code above again in the python console in qgis and it didn't work, sorry for posting a wrong code, you have to mention the whole path in order to call it

subprocess.call(['C:/Program Files (x86)/ODA/Teigha File Converter 4.3.2/TeighaFileConverter.exe'])
  • thanks for ur comment, subprocess.call(["TeighaFileConverter"]) it's not working i've changed it to subprocess.call(["TeighaFileConverter"],shell=True) in output i get '1' Jul 23, 2018 at 15:25
  • @AnassAyar Did you also add Teigha to your path variable ? Jul 23, 2018 at 15:26
  • yes and I've tested running the code in pyzo and it's working Jul 23, 2018 at 15:32
  • @AnassAyar I've edited my answer with a working code Jul 23, 2018 at 15:46
  • now it's working thanks ! is it possible to avoid the full path to the programme ? Jul 23, 2018 at 16:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.