Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WindowsError[5] and AttributeError Exception #170

Closed
sxmrxzxr opened this issue May 18, 2015 · 11 comments
Closed

WindowsError[5] and AttributeError Exception #170

sxmrxzxr opened this issue May 18, 2015 · 11 comments

Comments

@sxmrxzxr
Copy link

I was trying out this example and got the following error.

C:\Python27>testmovies.py
Traceback (most recent call last):
  File "C:\Python27\testmovies.py", line 3, in <module>
    video = VideoFileClip("VID_20150518_103912.mp4").subclip(5, 15)
  File "C:\Python27\lib\site-packages\moviepy\video\io\VideoFileClip.py", line 55, in __init__
    reader = FFMPEG_VideoReader(filename, pix_fmt=pix_fmt)
  File "C:\Python27\lib\site-packages\moviepy\video\io\ffmpeg_reader.py", line 32, in __init__
    infos = ffmpeg_parse_infos(filename, print_infos, check_duration)
  File "C:\Python27\lib\site-packages\moviepy\video\io\ffmpeg_reader.py", line 240, in ffmpeg_parse_infos
    proc.terminate()
  File "C:\Python27\lib\subprocess.py", line 1019, in terminate
    _subprocess.TerminateProcess(self._handle, 1)
WindowsError: [Error 5] Access is denied
Exception AttributeError: "VideoFileClip instance has no attribute 'reader'" in
<bound method VideoFileClip.__del__ of <moviepy.video.io.VideoFileClip.VideoFile
Clip instance at 0x030E2080>> ignored

After extensive research, I had difficulty finding other people with this problem so I'm not sure if I'm doing something wrong or I stumbled across an undiscovered bug

@Zulko
Copy link
Owner

Zulko commented May 18, 2015

Not sure. Have you installed ImageMagick ? It is currently necessary to render texts.

@sxmrxzxr
Copy link
Author

Actually no, I haven't. I'll download that and let you know.

@sxmrxzxr
Copy link
Author

Installed ImageMagick and I'm getting the same error. Not sure if it's noteworthy, but I'm getting a different pointer at the bottom each time.

@Zulko
Copy link
Owner

Zulko commented May 18, 2015

I had read too fast the error. It seems that the access to the video file is denied. That's strange.

@sxmrxzxr
Copy link
Author

It's very strange, especially considering that I'm running it in command prompt as an administrator.

@jmcmellen
Copy link

I've been getting the WindowsError Access is Denied, but I don't think it is permissions. I think in some cases the subprocess finishes on its own very quickly, and when you try to terminate a dead process on Windows it throws an Exception, which causes the clip initialization to fail.

I tried wrapping the terminate (in ffmpeg_reader.py) in a try/except, and that seems to allow the script to continue. Would you be interested in a pull request? Or do you want to try it on your own? It's a simple change.

@peircej
Copy link

peircej commented Sep 21, 2015

I've got the same error. On mac and linux everything's running fine, but windows give the same stack trace as above (Win7 32bit version running as admin frmo the terminal).

If I wrap the terminate call in try..except as suggested by @jmcmellen then I get no error but the audio of the movie doesn't get imported (movie.audio=None) and I'm concerned that this is leaving rogue processes that never close?

@peircej
Copy link

peircej commented Sep 22, 2015

My mistake. I'd turned off the audio import previously to see which stream was causing the permissions error. The try...except solution solves the problem for me just fine.

@Zulko
Copy link
Owner

Zulko commented Sep 22, 2015

In that case I'd be interested by a pull request !

@jmcmellen
Copy link

I think this is fixed by PR#175

@keikoro
Copy link
Collaborator

keikoro commented Dec 16, 2018

I'm closing this issue as it's from 2015 and the last comment made it sound like it got fixed by a PR that same year.

@keikoro keikoro closed this as completed Dec 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants