Python - Pymediainfo Module [Error 126] The specified module could not be found
Question: The error I'm receiving is this:

    
    
    Traceback (most recent call last):
    File "C:\Users\Me\test3.py", line 4, in <module>
       media_info = MediaInfo.parse("video.mp4")
    File "C:\Python27\lib\site-packages\pymediainfo-2.0-py2.7.egg\pymediainfo\__init__.py", line 70, in parse
       lib = windll.MediaInfo 
    File "C:\Python27\lib\ctypes\__init__.py", line 435, in __getattr__
       dll = self._dlltype(name)
    File "C:\Python27\lib\ctypes\__init__.py", line 365, in __init__
       self._handle = _dlopen(self._name, mode)
    WindowsError: [Error 126] The specified module could not be found
    

Pymediainfo has been the only module to have caused this error for me. To see
if the problem was related to pip, I reinstalled it through the zip file found
[here](https://github.com/sbraz/pymediainfo) to no avail. Here is the code
causing the error:

    
    
    from pymediainfo import MediaInfo
    
    # sample code from pymediainfo docs
    media_info = MediaInfo.parse("video.mp4")
    for track in media_info.tracks:
        if track.track_type == 'Video':
            print track.bit_rate, track.bit_rate_mode, track.codec
    

If you need any more info, let me know.


Answer: I guess you forgot to add the dll path for Mediainfo.dll.

    
    
    import os
    
    os.environ['PATH'] = os.path.dirname('file/path/to/Mediainfo.dll') + ';' + os.environ['PATH']
    

