1
#!/usr/bin/python



def copyPatchTempToPatchStage(destinationLoction):

 command='/usr/bin/python '+destinationLoction+'/PatchGen.py '
 print command
 executeCommand(command)




def executeCommand(command):

 p_output=subprocess.Popen(command, stdout=subprocess.PIPE, shell=True)
 p_output.communicate()
 p_output.wait()


if __name__ == '__main__':

 destinationLoction="/scratch/app/product/fmw/obpinstall/patching/patchGenerationPath/2015-12-28/T14_OPATCH/100005135/PATCH_TEMP"
 copyPatchTempToPatchStage(destinationLoction)

Now while debbuging the python file it does not enters the PatchGen.py

Is there any way to debug System commands

1
  • If you say what's going wrong (i.e. why you want to debug it) we may be able to suggest ways to solve that problem Commented Dec 29, 2015 at 12:14

1 Answer 1

3

No it is not possible to debug System commands.

If you write p_output=subprocess.Popen(command, stdout=subprocess.PIPE, shell=True) Python does not know what is being run, it may be anything, not just a Python script.

What you want is importing that module and running its main function from your current file. This will allow you to see debugging information.

Sign up to request clarification or add additional context in comments.

2 Comments

If I will directly call the main function then wont be able to use popen pipe command
@RohanGala I just suggested a workaround. In general, it is not possible to debug popen pipe commands.

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.