added a wait for python execution finish