老师,我照着你的代码写,运行的时候一直报错:SystemError: tile cannot extend outside image

来源:2-17 注册流程梳理及代码封装

罪月

2019-09-23

Traceback (most recent call last):
File “C:\Users\AppData\Local\Programs\Python\Python37-32\lib\site-packages\PIL\ImageFile.py”, line 498, in _save
fh = fp.fileno()
AttributeError: ‘_idat’ object has no attribute ‘fileno’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “D:/WorkSpace/WebUi/register_page.py”, line 77, in
run_main()
File “D:/WorkSpace/WebUi/register_page.py”, line 71, in run_main
get_code_image(file_name) # 调用获取图片方法
File “D:/WorkSpace/WebUi/register_page.py”, line 48, in get_code_image
img.save(file_name)
File “C:\Users\AppData\Local\Programs\Python\Python37-32\lib\site-packages\PIL\Image.py”, line 2088, in save
save_handler(self, fp, filename)
File “C:\Users\AppData\Local\Programs\Python\Python37-32\lib\site-packages\PIL\PngImagePlugin.py”, line 909, in _save
ImageFile._save(im, _idat(fp, chunk), [(“zip”, (0, 0) + im.size, 0, rawmode)])
File “C:\Users\AppData\Local\Programs\Python\Python37-32\lib\site-packages\PIL\ImageFile.py”, line 506, in _save
e.setimage(im.im, b)
SystemError: tile cannot extend outside image

写回答

1回答

Mushishi

2019-09-25

超出截图范围了,看一下你图片原生大小,还有要截图的坐标

0
0

Selenium3与Python3实战Web自动化测试框架

打破无项目经验、无框架经验瓶颈,实战Web自动化测试框架!

1890 学习 · 1093 问题

查看课程