Link to home
Start Free TrialLog in
Avatar of enthuguy
enthuguyFlag for Australia

asked on

Python3 subprocess.call exception handling

Hi experts,

what is the best way to handle exception in below python3 subprocess scenario please?

I execute below line in my python script.

subprocess.call(['aws', 'ec2', 'start-instances', '--instance-ids', instance , '--output', 'table'])

Open in new window


could you suggest a best way to handle exception please? try/except?

Thanks in advance
ASKER CERTIFIED SOLUTION
Avatar of Norie
Norie

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of enthuguy

ASKER

thanks a lot Norie. Hope this is in python3. could you pls help me understand difference between Popen and subprocess.call

Will try and update you
Thanks a lot

understood from this
https://docs.python.org/3/library/subprocess.html