现在,我正在启动一个Python项目,该项目应该获取所选twitch频道的屏幕截图,修改这些截图并将它们放到GUI上。GUI不应该是个问题,但我的屏幕截图有问题。
我找到了两个资源来处理twitch通信:python twitch包和一个名为ttvsnap(https://github.com/chfoo/ttvsnap)的脚本。
这个软件包对我没有帮助,因为我没有找到任何与截图有关的东西。剧本看起来很有前途,但我遇到了一些问题:
根据创建者的说法,ttvsnap会定期截取twitch流的屏幕截图,并将它们放入选定的目录中。 如果我尝试启动脚本,就会出现以下错误:
Traceback (most recent call last):
File "ttvsnap.py", line 13, in <module>
import requests
ImportError: No module named 'requests'
从脚本中删除“导入请求”允许我运行它,但是脚本在选择目录时出现问题。为了运行脚本,我应该写下:
^{pr2}$creator的示例目录是'./screenshot/',但是有了这个输入,我得到了以下错误(可能是因为我在Windows上?)公司名称:
Output directory specified is not valid.
尝试像C:\DevFiles\Screenshots这样的目录会出现以下错误:
Invalid drive specification. ###Translated this line since I'm using a German OS
Traceback (most recent call last):
File "ttvsnap.py", line 176, in <module>
main()
File "ttvsnap.py", line 46, in main
subprocess.check_call(['convert', '-version'])
File "C:\Program Files (x86)\Python35-32\lib\subprocess.py", line 584, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['convert', '-version']' returned non-zero exit status 4
任何关于如何让它运行或使用不同资源的想法都将非常感谢。在
Selenium可以方便地导航站点和截图。在
http://selenium-python.readthedocs.io/
充实出一个能满足你需要的例子。 还有主旨链接: https://gist.github.com/ryantownshend/6449c4d78793f015f3adda22a46f1a19
你不应该从你试图使用的开源项目中删除一些东西。在
相反,安装丢失的软件包
pip install requests
如果您对此有问题,可能您没有{或者使用这个
python.exe -m pip install requests
。在此错误
Output directory specified is not valid.
是由以下行引起的:这通常意味着目录不存在。在
至于最后一个错误,它无法执行命令
^{pr2}$convert
:它只是表示您没有安装
Imagemagick
。您可以通过下载适合您的体系结构的正确安装程序来安装它:http://www.imagemagick.org/script/binary-releases.php然后在安装时勾选以下选项:
然后尝试确保从终端执行
convert
命令。如果没有,请遵循以下说明:相关问题 更多 >
编程相关推荐