Python Forum

Full Version: vlc module error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Getting this error when i run the program below I am trying to play a youtube video: AttributeError: module 'vlc' has no attribute 'Instance'. How do I fix this?

import datetime
import webbrowser
import time
import pafy
import vlc
import cv2

alarmhour = int(input("What hour do you want to wake up?"))
alarmminute = int(input("What minute do you want to wake up?"))
ampm = str(input("am or pm"))

if (ampm == "pm"):
    alarmhour = alarmhour + 12

while (1 == 1):
    if (alarmhour == datetime.datetime.now().hour and
    alarmminute == datetime.datetime.now().minute):
        print("Wake up")
        break

url = "https://www.youtube.com/watch?v=iNpXCzaWW1s"
video = pafy.new(url)
best = video.getbest()
playurl = best.url
ins = vlc.Instance()
player = ins.media_player_new()
Media = ins.media_new(playurl)
Media.get_mrl()
player.set_media(Media)
player.play()
Please post complete and unaltered error traceback. It contains valuable debugging info.

I haven't used this package (use it from command line)
There are a bunch of examples here: https://git.videolan.org/?p=vlc/bindings...es;hb=HEAD
Perhaps you can find an answer there.
I took a quick look, and every call to vlc.Instance passes arguments.

Please show complete error trace