Search code examples
pythonpython-3.xtkintertraceback

Not sure what this traceback means


So I found this project

https://codereview.stackexchange.com/questions/192281/download-song-or-video-from-youtube-using-pytube

online and it allows you to dowload youtube videos from online but when I enter the link and click download it gives me this error and I have no idea what it means and I have tried to search google for the answer but I can't find any solutions so I hope that someone could help me.

Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Users\bob\AppData\Local\Programs\Python\Python37\lib\tkinter\
__init__.py", line 1705, in __call__
    return self.func(*args)
  File "C:\Users\bob\Desktop\youtube.py", line 104, in checkYoutubeLink
    self.downloadWindow()
  File "C:\Users\bob\Desktop\youtube.py", line 112, in downloadWindow
    self.app = SecondPage(self.newWindow, self.youtubeEntryVar.get(), self.Folde
rName, self.ChoicesVar.get())
  File "C:\Users\bob\Desktop\youtube.py", line 134, in __init__
    self.yt = YouTube(self.youtubeEntry)
  File "C:\Users\bob\AppData\Local\Programs\Python\Python37\lib\site-pac
kages\pytube\__main__.py", line 88, in __init__
    self.prefetch_init()
  File "C:\Users\bob\AppData\Local\Programs\Python\Python37\lib\site-pac
kages\pytube\__main__.py", line 96, in prefetch_init
    self.prefetch()
  File "C:\Users\bob\AppData\Local\Programs\Python\Python37\lib\site-pac
kages\pytube\__main__.py", line 170, in prefetch
    age_restricted=self.age_restricted,
  File "C:\Users\bob\AppData\Local\Programs\Python\Python37\lib\site-pac
kages\pytube\extract.py", line 121, in video_info_url
    group=0,
  File "C:\Users\bob\AppData\Local\Programs\Python\Python37\lib\site-pac
kages\pytube\helpers.py", line 65, in regex_search
    .format(pattern=pattern),
pytube.exceptions.RegexMatchError: regex pattern (\W[\'"]?t[\'"]?: ?[\'"](.+?)[\
'"]) had zero matches

Solution

  • Since this error was coming from pytube, I did a quick search of their issues in github. This is the issue for the problem:

    https://github.com/nficano/pytube/issues/381

    It says it is fixed in version 9.5.0, pip install -U pytube should install the fixed version.