0

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

2
  • 2
    ExternCmd is created before you change arg1 Commented Oct 5, 2015 at 14:23
  • The code is incorrect arg2 ' -v ' is invalid syntax. Post real non-working code. See mcve. Commented Oct 6, 2015 at 14:11

1 Answer 1

1

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)
Sign up to request clarification or add additional context in comments.

1 Comment

oops, in my haste to write a simple example I put ExternCmd outside of the loop. In my actual code it is inside - I'll update my original post

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.