beetbox / audioread

cross-library (GStreamer + Core Audio + MAD + FFmpeg) audio decoding for Python
MIT License
483 stars 108 forks source link

WindowsError: [Error 5] Access is denied #56

Open Saw-mon-and-Natalie opened 7 years ago

Saw-mon-and-Natalie commented 7 years ago

I get this error from ffedc.py:

  File "C:\Python27\lib\site-packages\audioread\ffdec.py", line 279, in __exit__
    self.close()
  File "C:\Python27\lib\site-packages\audioread\ffdec.py", line 263, in close
    self.proc.kill()
  File "C:\Python27\lib\subprocess.py", line 1002, in terminate
    _subprocess.TerminateProcess(self._handle, 1)
WindowsError: [Error 5] Access is denied

I've been searching how to resolve it and found this on stackoverflow: https://stackoverflow.com/questions/17076679/windowserror-access-is-denied-on-calling-process-terminate

But even trying this try-catch trick doesn't work when I modify ffdec.py. Looks like issue might be related to this: https://stackoverflow.com/questions/5573257/windowserror-error-5-access-is-denied-when-trying-to-kill-a-subprocess-pytho

But still don't know how to resolve. I tried running my code with admin privileges too and I have all the permissions to modify my file.

sampsyo commented 7 years ago

Thanks for the report! This sounds related to #51, although that one is in the context of WSL.

I don't have a lot to offer because I don't have a Windows machine to test on, but it might be the case that this happens when the process has already exited. Catching the exception and ignoring it would then be OK. Could you please open a PR with the try/catch addition you tried so we can take a look?