2

please read before you mark it as duplicate. :) i have tried all other similar issues in SO

I am trying to install virtualenv and i need to call a another python file.

Here is part of script: p = subprocess.Popen([python, 'setup.py', 'develop'], executable=appPath) and i am getting the below error

p = subprocess.Popen([python, 'setup.py', 'develop'], executable=appPath) File "C:\Python27\lib\subprocess.py", line 709, in __init__ errread, errwrite) File "C:\Python27\lib\subprocess.py", line 957, in _execute_child startupinfo) WindowsError: [Error 5] Access is denied

my appPath points to the setup.py location.

I have tried the answers here: 1 2 3 but that didn't help. I am running my cmd.exe under Administration privileges.

I tried processExplorer to see if there is any lock the file i am accessing but no one using the file at that point. my initial guess was it's something to do with the permissions but read/write permissions didnt help either.

Community
  • 1
  • 1
user3739537
  • 63
  • 2
  • 7
  • You are attempting to execute a python script. It is better to use `execfile()` instead of forking a child process via `subprocess` and running a new instance of python. Try `execfile('/path/to/setup.py')`. – alvits Jul 11 '14 at 23:26
  • @alvits: exec solved the issue for now. But i would really like to know what's actually happening when i used the subprocess.Popen. – user3739537 Jul 15 '14 at 23:27
  • In your original code, you set `executable` to `appPath`. This is causing your issue. You can think of `executable` as similar to `argv[0]`. It should be set to python because the first member of the list in `subprocess.Popen` is python. `setup.py` is just a parameter to the executable. – alvits Jul 16 '14 at 00:12

0 Answers0