Search code examples
pythonvlc

vlc.Instance: AttributeError("module 'vlc' has no attribute 'Instance'")


I'm trying to make it so that the VLC player will import correctly so that it will play a series of VLC media files in succession. However, I cannot seem to get VLC to import properly! I've downloaded the vlc.py and added it to my workspace. It looks like this;

import vlc

class PlayerWindow(Frame):

    def __init__(self, parent):

        super().__init__()



        self.parent = parent

        self.parent.attributes('-alpha', 0)

        self.parent.attributes("-fullscreen", True)

        self.parent.bind_all("<Key>", self.key)



        # VLC player controls

        self.Instance = vlc.Instance()

        self.player = self.Instance.media_player_new()

        self.player.toggle_fullscreen()

        self.player.video_set_key_input(False)



        self.parent.update()

Im using Microsoft VS 2017


Solution

  • Try the combinations of uninstalling vlc ( pip uninstall vlc ) and reinstalling it . Same for python-vlc. Also check if your path variables are set( Both VS Code and VideoLAN\VLC ). It must work then.