C:\Users\A B>"C:\Users\A B\AppData\Roaming\Python\Python38\Scripts\playwithmpv.exe"
* Serving Flask app 'playwithmpv.server' (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
* Running on http://127.0.0.1:50000/ (Press CTRL+C to quit)
127.0.0.1 - - [15/Mar/2022 02:29:33] "OPTIONS / HTTP/1.1" 200 -
mpv --http-header-fields="referer:https://www.bilibili.com/","user-agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0" --playlist=C:\Users\A B\_tmp_playlist.m3u
video_title.flv
[file] Cannot open file 'C:\Users\A': No such file or directory
Failed to open C:\Users\A.
Error reading playlist 'C:\Users\A'
Exiting... (Fatal error)
在windows下首次使用时出现了与 #3 相同的问题, 按照原issue提供的方法将
\site-packages\playwithmpv\server.py
中的os.environ['HOME']
更改为os.environ['USERPROFILE']
之后发现MPV提示路径错误,查看输出后发现程序传递给MPV的--playlist
参数没有使用" "
包围,而我的系统用户名中带有空格,便发生了问题。超菜的解决方法:将
\site-packages\playwithmpv\server.py
中的mpv_cmd = ' '.join([args['dir'], mpv_httpd_header, '--playlist=' + playlist_file ])
修改为mpv_cmd = ' '.join([args['dir'], mpv_httpd_header, '--playlist=' + '"' + playlist_file + '"' ])
(其实也可以把USERPROFILE
修改为其他不包含空格路径的变量)以下为关键输出内容:(用户名使用"A B"代替)