对python来说很新,所以我确定它可能是愚蠢的。试图在我的Mac上运行https://github.com/aesptux/download-reddit-saved-images。我用pip安装了所有要求:
beautifulsoup4>=4.3.2
praw>=2.1.17
requests>=2.3.0
PyYAML==3.10
Pillow==2.4.0
然后配置config.yaml
并尝试运行脚本。它返回此错误:
/Users/dp/Dev/download-reddit-saved-images/script.py: line 3:
Python script to download saved images from reddit
: command not found
from: can't read /var/mail/__future__
/Users/dp/Dev/download-reddit-saved-images/script.py: line 5: import: command not found
/Users/dp/Dev/download-reddit-saved-images/script.py: line 6: import: command not found
from: can't read /var/mail/glob
from: can't read /var/mail/bs4
from: can't read /var/mail/zipfile
from: can't read /var/mail/PIL
/Users/dp/Dev/download-reddit-saved-images/script.py: line 11: import: command not found
/Users/dp/Dev/download-reddit-saved-images/script.py: line 12: try:: command not found
from: can't read /var/mail/io
/Users/dp/Dev/download-reddit-saved-images/script.py: line 14: except: command not found
from: can't read /var/mail/StringIO
/Users/dp/Dev/download-reddit-saved-images/script.py: line 16: import: command not found
/Users/dp/Dev/download-reddit-saved-images/script.py: line 17: import: command not found
/Users/dp/Dev/download-reddit-saved-images/script.py: line 20: __author__: command not found
/Users/dp/Dev/download-reddit-saved-images/script.py: line 21: __version__: command not found
/Users/dp/Dev/download-reddit-saved-images/script.py: line 22: __contributor__: command not found
/Users/dp/Dev/download-reddit-saved-images/script.py: line 24: IMAGE_FORMATS: command not found
/Users/dp/Dev/download-reddit-saved-images/script.py: line 25: pcd,: command not found
/Users/dp/Dev/download-reddit-saved-images/script.py: line 26: tiff,: command not found
/Users/dp/Dev/download-reddit-saved-images/script.py: line 28: syntax error near unexpected token `('
/Users/dp/Dev/download-reddit-saved-images/script.py: line 28: `CONFIG = open('config.yaml')'
我不知道从哪里开始进行故障排除。
答案 0 :(得分:0)
它作为shell脚本而不是Python脚本运行。尝试:
<div class="form1btn">
<input type="button" value="" id="mcodebtn">
</div>
Paulo Almeida在comment中提供的解决方案,但他还没有将其作为答案。