1

it would be quite difficult to explain, I'll do my best..

I'm writing a plugin for QGIS (with the plugin builder, so the folder structure is straightforward). This plugin calls other software (that of course have to be installed on the computer) that do some mathematical models.

Now, the problem is that I'm able to call these software (all these software work from the command line) from the python plugin but at this point I have to pass to the opened command line, the commands required by them.

These commands are, for example, the loading of a specific file created by the plugin.

The final user should not see and know that the plugin calls other software and I would like that the command line of that software remains hidden.

So, how can I pass the information required by the command line directly by the python script of the plugin?

BTW, this is a code snippet within the python script that calls the external software:

if not self.chkOnlyInputMT.isChecked() and sewatFlag == 0:
        QtGui.QMessageBox.information(None, 'Information', 'Running ... \n' + mt3ddir )
        mt_namefile = transportName + '.nam_mt3dms'
        sub.Popen([mt3ddir, mt_namefile], cwd=pathfile)

In other words, I would like that, in this script, the information written in another file will be read by the command line without interacting with it..

  • Read the subprocess documentation. Can you edit your question to specify when you run the external program from a command prompt whether you call the program with the required arguments all at once and it then runs or whether you call the program, press enter and then have to type further commands in. – user2856 Nov 1 '15 at 10:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.