Wechat_jump_game: 无法识别autojump.png

Created on 1 Jan 2018  ·  6Comments  ·  Source: wangshub/wechat_jump_game

如果你的脚本无法工作,上报issue时请copy如下信息:


Screen: Physical size: 1080x1920
Density: Physical density: 480
DeviceType: HUAWEI GRA-UL10
OS: win32
Python: 3.6.3 |Anaconda, Inc.| (default, Oct 15 2017, 03:27:45) [MSC v.1900 64 bit (AMD64)]


List of devices attached
A7J5T15608027801 device

Traceback (most recent call last):
File "wechat_jump_auto.py", line 356, in
main()
File "wechat_jump_auto.py", line 343, in main
im = Image.open('./autojump.png')
File "D:\Program Files\Anaconda\lib\site-packages\PIL\Image.py", line 2519, in open
% (filename if filename else fp))
OSError: cannot identify image file './autojump.png'

进入activate wechat_env正常
手动打adb shell screencap -p /sdcard/autojump.png运行正常,但是到文件夹里去打开图片,发现一般只能截取上面的任务栏,图片的下面都是白色的
不知道是不是这个问题导致无法识别图片
还有在虚拟环境中手动运行adb shell screencap -p /sdcard/autojump.png时,运行不报错,但是图片没有截取成功,还是上次截取的图片

Most helpful comment

已经找到解决方法,将screenshot = screenshot.replace(b'\r\n',b'\n')改为screenshot = screenshot.replace(b'\r\r\n',b'\n')后完美解决

All 6 comments

作者用Python的文件流写入图片,我运行时也得不到图片,所以我把写图片的语句删了,改为调用项目主页介绍的adb命令。

请问解决了吗,我也是这样的问题,楼上为什么不贴出代码

已经找到解决方法,将screenshot = screenshot.replace(b'\r\n',b'\n')改为screenshot = screenshot.replace(b'\r\r\n',b'\n')后完美解决

@pmupkin 厉害,按照你的方法修改完美解决,感谢

@pmupkin 感谢,完美解决

将screenshot = screenshot.replace(b'\r\n',b'\n')改为screenshot = screenshot.replace(b'\r\r\n',b'\n')后问题完美解决
screenshot = screenshot.replace(b'\r\r\n',b'\n')这句代码什么意思

Was this page helpful?
0 / 5 - 0 ratings