problem when using os.startfile inside python thread

I'm using os.startfile inside a thread, sometime it works fine, and other-times its stops the process.
What is the solution for this problem ? and what dependencies make it work.?
RayanCoheenAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

peprCommented:
You should be more specific, show or better describe the code you use, and possibly write down some expectations, how it fails, when it fails. When working with threads, the reason can also be different than the os.startfile().
1
RayanCoheenAuthor Commented:
OK Pepr,
I couldn't add any part of my code here sir. I can describe the issue more specifically, I'm creating update function to  my application that need to launch some exe files that update the services  of my application  so  I do  use
os.startfile() 

Open in new window

to launch the  exe file but the application some times failed to start launching other application and  my process not responding after this  line executed and couldn't execute any line after this line.

I feel this strange, I don't understand  why  this line  can  launch  other applications  and  failed others. that is the issue .
I hope  that I described the issue more specific.

regards,
Rayan
0
peprCommented:
The os.startfile() was designed for Windows to launch the associated application for the given data file. This way, you probably do not want to use it for lauching your exe files. At least I am not sure how it should behave in the case.

You may want to use the subprocess.call() instead (https://docs.python.org/3.5/library/subprocess.html#subprocess.call), or subprocess.run() if you already use Python 3.5+.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Python

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.