Python change the working directory for an exe opened with startfile?

Don't use os. Startfile for starters. Use subprocess you can then use cwd argument of Popen.

Don't use os. Startfile, for starters. Use subprocess, you can then use cwd argument of Popen.

Import subprocess process = subprocess. Popen('command', cwd = 'directory') If you really want to use ShellExecute, then the best way will be to skip os. Startfile and call it directly with ctypes (or look whether it's in pywin32 somewhere).

It still executes it from the python's directory! Thanks for your help but it didn't work... have you tried it? Are you 100% sure this should work?

Because it didn't – Saulpila Jun 27 at 0:13 @Saulpila: How are you checking it? And which Python version are you using? – Cat Plus Plus Jun 27 at 0:31 I'm using python 2.7.2.

I changed the code, and ran it, I know when the executable isn't running in place, because before making it's stuff, it creates a file... and the file is being created in the python script's folder – Saulpila Jun 27 at 0:53 wait! I rechecked and worked, sorry, Thanks a lot! – Saulpila Jun 27 at 1:21.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions