jaseg / python-mpv

Python interface to the awesome mpv media player
https://git.jaseg.de/python-mpv.git
Other
532 stars 67 forks source link

AttributeError: 'NoneType' object has no attribute 'encode' #219

Closed mikwee closed 2 years ago

mikwee commented 2 years ago

Got this error:

Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\lib\tkinter\__init__.py", line 1921, in __call__
    return self.func(*args)
  File "d:\mlp-mpv\main.py", line 48, in playVideo
    player.play(link)
  File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\lib\site-packages\mpv.py", line 1806, in play
    self.loadfile(filename)
  File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\lib\site-packages\mpv.py", line 1291, in loadfile
    self.command('loadfile', filename.encode(fs_enc), mode, MPV._encode_options(options))
AttributeError: 'NoneType' object has no attribute 'encode'

I think this is related to how the package is written, but it could be related to how I installed the package. I heard it's hard on WIndows (I did install mpv-1.dll).

mikwee commented 2 years ago

For some reason, it detects the string variable I gave play as a NoneType, and I don't get why!

dfaker commented 2 years ago

link must be None almost nothing is going on between the call to play and calling the encode method on filename.

mikwee commented 2 years ago

I'll check the code when I come home.

jaseg commented 2 years ago

I agree that link must be None here. If it's indeed an issue in python-mpv, feel free to re-open this issue.