Python script works fine on Linux, on Windows, causes WindowsError: [Error 5] Access is denied
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Quirky Dreamscape Looping
--
Chapters
00:00 Question
00:53 Accepted answer (Score 5)
01:51 Answer 2 (Score 1)
02:14 Thank you
--
Full question
https://stackoverflow.com/questions/1183...
Accepted answer links:
[the documentation]: http://docs.python.org/library/subproces...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #windows #windowsxp
#avk47
ACCEPTED ANSWER
Score 5
According to the documentation, the first item in the argument sequence (in this case, the first element of command) is interpreted as the program to execute.
Looking at the first element of command, it would appear that you're trying to execute a directory. Windows (somewhat non-intuitively) returns an access denied error whenever you try to read from a directory as if it were a file, and the same thing happens if you try to execute one.
Instead of c:\python27 you probably want c:\python27\bin\python.exe or something similar. At any rate, you need to be pointing at the executable, not at the directory. I'm not sure why this works for you on Linux.
ANSWER 2
Score 1
Your program doesn't have access to the file... check permissions on the file you're trying to access, then go from there... (ie, either elevate the Python interpreter's permissions, or reduce access required to said resource) - either way - tread carefully.