pythonvlclibvlc

Can't import vlc module into Python, "not a valid Win32 application" error


I am trying to use the VLC module for a python script. I have run pip install python-vlc

C:\Users\Me>pip install python-vlc
Requirement already satisfied: python-vlc in c:\python34\lib\site-packages

When I run 'import vlc' I get this error:

Python 3.4.4rc1 (v3.4.4rc1:04f3f725896c, Dec  6 2015, 17:06:10) [MSC v.1600 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import vlc
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python34\lib\vlc.py", line 181, in <module>
    dll, plugin_path  = find_lib()
  File "C:\Python34\lib\vlc.py", line 159, in find_lib
    dll = ctypes.CDLL(p)
  File "C:\Python34\lib\ctypes\__init__.py", line 351, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application
>>>

I have been trying to figure this out for the last couple hours, and am stumped. After searching through SO and Google for a while, I believe it has something to do with setting a PATH variable? But, I could be waaay off. Maybe I installed this wrong, or something, I don't know...


Solution

    1. Uninstall your vlc
    2. Search 'libvlc.dll' on your local disk, and delete them all.
    3. Install vlc(x64) again, and note that don't install it under 'program files',
    4. Then it will work.