Reputation: 1
I'm trying to run a simple set of command line calls to a custom app, within a loop.
i.e.
list=['set1','set2','set3','set4']
ExternCmd = (myapp + ' ' + arg1 + ' ' + arg2 ' -v ')
for item in list:
arg1 = item
self.process.start(ExternCmd)
self.process.waitForFinished(-1)
But I dont get sets 2 - 4 processed, only the first.
I tried adding a self.process.join() to get the loop to wait for the current set to finish processing,but I get the following error:
AttributeError: 'QProcess' object has no attribute 'join'
any help would be great getting my processes to work in order. I would ideally like them to be processed one after the other - rather than all at the same time.
thanks
EDIT: I put the ExternCmd in the wrong place for this example. My code should be:
list=['set1','set2','set3','set4']
for item in list:
arg1 = item
ExternCmd = (myapp + ' ' + arg1 + ' ' + arg2 ' -v ')
self.process.start(ExternCmd)
self.process.waitForFinished(-1)
This is still failing to run the command on anything other than Set1
Upvotes: 0
Views: 51
Reputation: 2084
Changing the args isn't changing ExternCmd. You need to set that in the loop, for example:
list=['set1','set2','set3','set4']
for item in list:
ExternCmd = (myapp + ' ' + item + ' -v ')
self.process.start(ExternCmd)
self.process.waitForFinished(-1)
Upvotes: 1