Pyinstaller EXE fails to run on different PC

26 Views Asked by At

I have create a program to run a promo video through VLC on loop and intend to put it into the start up folder on a PC connected to a TV which will play the promo video on loop until the under inputs q followed by enter. BUT the .exe file generated by pyinstaller wont run, all I see a quick flash of the command prompt.

For reference here is the python code I'm using (just a beginner so sorry if this code is sloppy)

import vlc

autoplayer = False
player = vlc.MediaPlayer("Assets/Chapel Flythrough 1.mp4")


def start():
    player.set_fullscreen(True)
    em = player.event_manager()
    em.event_attach(vlc.EventType.MediaPlayerEndReached, onend)
    player.play()


def onend(event):
    global autoplayer
    if event.type == vlc.EventType.MediaPlayerEndReached:
        autoplayer = True


def back():
    player.set_media(player.get_media())
    player.play()


start()

print("Press Q & Enter to Close Video Loop")
close = input("").lower()

while True:
    if autoplayer:
        back()
        autoplayer = False

    if close == 'q':
        break

I tried generating a .exe that runs windowed and this results in a window containing the following:

 Traceback (most recent call last):
  File "PyInstaller\loader\pyimod03_ctypes.py", line 53, in __init__
  File "ctypes\__init__.py", line 379, in __init__
FileNotFoundError: Could not find module 'F:\AutoPlay\libvlc.dll' (or one of its dependencies).  Try using the full path with constructor syntax.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "Auto_Play.py", line 1, in <module>
    import vlc
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module
  File "vlc.py", line 220, in <module>
  File "vlc.py", line 180, in find_lib
  File "PyInstaller\loader\pyimod03_ctypes.py", line 55, in __init__
pyimod03_ctypes.install.<locals>.PyInstallerImportError: Failed to load dynlib/dll '.\\libvlc.dll'. Most likely this dynlib/dll was not found when the application was frozen.

Not sure why it works on my laptop no matter where i put the .exe but it wont on the other pc.

Any advise would be greatly appreciated!

0

There are 0 best solutions below