相关疑难解决方法(0)

import-im6.q16:Python Web刮板未授权的错误“ os” @ error / constitue.c / WriteImage / 1037

我为漫画网站写了一个简单的网络抓取工具。我在Ubuntu(Linux ubuntu 4.18.0-16-generic #17~18.04.1-Ubuntu)上运行它,但是当我执行脚本(权限设置为chmod ug+x)时,导入的系统库不断出现一系列错误以及令人困惑的语法错误:

import-im6.q16: not authorized `time' @ error/constitute.c/WriteImage/1037.
import-im6.q16: not authorized `os' @ error/constitute.c/WriteImage/1037.
import-im6.q16: not authorized `sys' @ error/constitute.c/WriteImage/1037.
import-im6.q16: not authorized `re' @ error/constitute.c/WriteImage/1037.
import-im6.q16: not authorized `requests' @ error/constitute.c/WriteImage/1037.
from: can't read /var/mail/bs4
./poorlywrittenscraper.py: line 15: DEFAULT_DIR_NAME: command not found
./poorlywrittenscraper.py: line 16: syntax error near unexpected token `('
./poorlywrittenscraper.py: line 16: `COMICS_DIRECTORY = os.path.join(os.getcwd(), DEFAULT_DIR_NAME)'
Run Code Online (Sandbox Code Playgroud)

有趣的是,当我通过python3它运行相同的脚本时,它会启动,创建文件夹,获取图像,但是...不会保存它们。O

知道我在这里缺少什么或如何解决这个问题吗?

这是脚本的完整代码:

"""
A simple image downloader for poorlydrawnlines.com/archive
"""
import …
Run Code Online (Sandbox Code Playgroud)

python ubuntu beautifulsoup python-3.x

7
推荐指数
1
解决办法
8687
查看次数

标签 统计

beautifulsoup ×1

python ×1

python-3.x ×1

ubuntu ×1