You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from airtest.core.api import *
auto_setup(__file__)
snapshot(filename='endTest', msg="airtest")
错误日志:
[16:58:09][DEBUG]<airtest.utils.nbsp> [minicap_server]b'INFO: (external/MY_minicap/src/minicap_29.cpp:255) Creating virtual display'
[16:58:09][DEBUG]<airtest.utils.nbsp> [minicap_server]b'INFO: (external/MY_minicap/src/minicap_29.cpp:261) Creating buffer queue'
[16:58:09][DEBUG]<airtest.utils.nbsp> [minicap_server]b'INFO: (external/MY_minicap/src/minicap_29.cpp:264) Setting buffer options'
[16:58:09][DEBUG]<airtest.utils.nbsp> [minicap_server]b'INFO: (external/MY_minicap/src/minicap_29.cpp:268) Creating CPU consumer'
[16:58:09][DEBUG]<airtest.utils.nbsp> [minicap_server]b'INFO: (external/MY_minicap/src/minicap_29.cpp:272) Creating frame waiter'
[16:58:09][DEBUG]<airtest.utils.nbsp> [minicap_server]b'INFO: (external/MY_minicap/src/minicap_29.cpp:276) Publishing virtual display'
[16:58:09][DEBUG]<airtest.utils.nbsp> [minicap_server]b'INFO: (jni/minicap/JpgEncoder.cpp:64) Allocating 7678980 bytes for JPG encoder'
[16:58:09][DEBUG]<airtest.utils.nbsp> [minicap_server]b'INFO: (jni/minicap/minicap.cpp:489) Server start'
[16:58:09][DEBUG]<airtest.core.android.cap_methods.minicap> (1, 24, 4956, 1080, 2340, 1080, 2340, 0, 2)
[16:58:09][DEBUG]<airtest.utils.nbsp> [minicap_server]b'INFO: (jni/minicap/minicap.cpp:492) New client connection'
[16:58:10][ERROR]<airtest.core.api> Traceback (most recent call last):
File "C:\Users\lyyd\pyenv-win\pyenv-win\versions\3.8.5\lib\site-packages\PIL\Image.py", line 2543, in save
format = EXTENSION[ext]
KeyError: ''
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\lyyd\pyenv-win\pyenv-win\versions\3.8.5\lib\site-packages\airtest\cli\runner.py", line 72, in runTest
exec(compile(code.encode("utf-8"), pyfilepath, 'exec'), self.scope)
File "C:\Users\lyyd\Desktop\airtest_demo.air\airtest_demo.py", line 13, in <module>
snapshot(filename='endTest', msg="airtest")
File "C:\Users\lyyd\pyenv-win\pyenv-win\versions\3.8.5\lib\site-packages\airtest\utils\logwraper.py", line 131, in wrapper
res = f(*args, **kwargs)
File "C:\Users\lyyd\pyenv-win\pyenv-win\versions\3.8.5\lib\site-packages\airtest\core\api.py", line 295, in snapshot
screen = G.DEVICE.snapshot(filename, quality=quality, max_size=max_size)
File "C:\Users\lyyd\pyenv-win\pyenv-win\versions\3.8.5\lib\site-packages\airtest\core\android\android.py", line 490, in snapshot
aircv.imwrite(filename, screen, quality, max_size=max_size)
File "C:\Users\lyyd\pyenv-win\pyenv-win\versions\3.8.5\lib\site-packages\airtest\aircv\aircv.py", line 34, in imwrite
compress_image(pil_img, filename, quality, max_size=max_size)
File "C:\Users\lyyd\pyenv-win\pyenv-win\versions\3.8.5\lib\site-packages\airtest\aircv\utils.py", line 107, in compress_image
pil_img.save(path, quality=quality, optimize=True)
File "C:\Users\lyyd\pyenv-win\pyenv-win\versions\3.8.5\lib\site-packages\PIL\Image.py", line 2546, in save
raise ValueError(msg) from e
ValueError: unknown file extension:
custom tearDown
======================================================================
ERROR: runTest (__main__.CustomCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\lyyd\pyenv-win\pyenv-win\versions\3.8.5\lib\site-packages\PIL\Image.py", line 2543, in save
format = EXTENSION[ext]
KeyError: ''
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\lyyd\pyenv-win\pyenv-win\versions\3.8.5\lib\site-packages\airtest\cli\runner.py", line 75, in runTest
six.reraise(*sys.exc_info())
File "C:\Users\lyyd\pyenv-win\pyenv-win\versions\3.8.5\lib\site-packages\six.py", line 719, in reraise
raise value
File "C:\Users\lyyd\pyenv-win\pyenv-win\versions\3.8.5\lib\site-packages\airtest\cli\runner.py", line 72, in runTest
exec(compile(code.encode("utf-8"), pyfilepath, 'exec'), self.scope)
File "C:\Users\lyyd\Desktop\airtest_demo.air\airtest_demo.py", line 13, in <module>
snapshot(filename='endTest', msg="airtest")
File "C:\Users\lyyd\pyenv-win\pyenv-win\versions\3.8.5\lib\site-packages\airtest\utils\logwraper.py", line 131, in wrapper
res = f(*args, **kwargs)
File "C:\Users\lyyd\pyenv-win\pyenv-win\versions\3.8.5\lib\site-packages\airtest\core\api.py", line 295, in snapshot
screen = G.DEVICE.snapshot(filename, quality=quality, max_size=max_size)
File "C:\Users\lyyd\pyenv-win\pyenv-win\versions\3.8.5\lib\site-packages\airtest\core\android\android.py", line 490, in snapshot
aircv.imwrite(filename, screen, quality, max_size=max_size)
File "C:\Users\lyyd\pyenv-win\pyenv-win\versions\3.8.5\lib\site-packages\airtest\aircv\aircv.py", line 34, in imwrite
compress_image(pil_img, filename, quality, max_size=max_size)
File "C:\Users\lyyd\pyenv-win\pyenv-win\versions\3.8.5\lib\site-packages\airtest\aircv\utils.py", line 107, in compress_image
pil_img.save(path, quality=quality, optimize=True)
File "C:\Users\lyyd\pyenv-win\pyenv-win\versions\3.8.5\lib\site-packages\PIL\Image.py", line 2546, in save
raise ValueError(msg) from e
ValueError: unknown file extension:
----------------------------------------------------------------------
Ran 1 test in 3.759s
FAILED (errors=1)
[16:58:10][DEBUG]<airtest.core.android.adb> C:\Users\lyyd\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s 75575fdc forward --remove tcp:16873
[16:58:10][DEBUG]<airtest.utils.nbsp> [rotation_server]b''
[16:58:10][DEBUG]<airtest.utils.nbsp> [minicap_server]b''
[16:58:10][DEBUG]<airtest.core.android.adb> C:\Users\lyyd\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s 75575fdc forward --remove tcp:16873
[16:58:10][DEBUG]<airtest.core.android.cap_methods.minicap> minicap stream ends
[Finished]
实际情况:
截图可以正常保存到本地
运行日志:
{"tag": "function", "depth": 1, "time": 1723712287.0723295, "data": {"name": "connect_device", "call_args": {"uri": "android://127.0.0.1:5037/75575fdc?touch_method=MAXTOUCH&"}, "start_time": 1723712286.5688064, "ret": "<Android '75575fdc'>", "end_time": 1723712287.0723295}}
{"tag": "function", "depth": 1, "time": 1723712290.0786386, "data": {"name": "snapshot", "call_args": {"filename": "endTest", "msg": "airtest", "quality": null, "max_size": null}, "start_time": 1723712287.0723295, "traceback": "Traceback (most recent call last):\n File \"C:\\Users\\lyyd\\pyenv-win\\pyenv-win\\versions\\3.8.5\\lib\\site-packages\\PIL\\Image.py\", line 2543, in save\n format = EXTENSION[ext]\nKeyError: ''\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"C:\\Users\\lyyd\\pyenv-win\\pyenv-win\\versions\\3.8.5\\lib\\site-packages\\airtest\\utils\\logwraper.py\", line 131, in wrapper\n res = f(*args, **kwargs)\n File \"C:\\Users\\lyyd\\pyenv-win\\pyenv-win\\versions\\3.8.5\\lib\\site-packages\\airtest\\core\\api.py\", line 295, in snapshot\n screen = G.DEVICE.snapshot(filename, quality=quality, max_size=max_size)\n File \"C:\\Users\\lyyd\\pyenv-win\\pyenv-win\\versions\\3.8.5\\lib\\site-packages\\airtest\\core\\android\\android.py\", line 490, in snapshot\n aircv.imwrite(filename, screen, quality, max_size=max_size)\n File \"C:\\Users\\lyyd\\pyenv-win\\pyenv-win\\versions\\3.8.5\\lib\\site-packages\\airtest\\aircv\\aircv.py\", line 34, in imwrite\n compress_image(pil_img, filename, quality, max_size=max_size)\n File \"C:\\Users\\lyyd\\pyenv-win\\pyenv-win\\versions\\3.8.5\\lib\\site-packages\\airtest\\aircv\\utils.py\", line 107, in compress_image\n pil_img.save(path, quality=quality, optimize=True)\n File \"C:\\Users\\lyyd\\pyenv-win\\pyenv-win\\versions\\3.8.5\\lib\\site-packages\\PIL\\Image.py\", line 2546, in save\n raise ValueError(msg) from e\nValueError: unknown file extension: \n", "end_time": 1723712290.0786386}}
{"tag": "function", "depth": 2, "time": 1723712290.3102157, "data": {"name": "try_log_screen", "call_args": {"screen": null, "quality": null, "max_size": null}, "start_time": 1723712290.0786386, "ret": {"screen": "1723712290294.jpg", "resolution": [1080, 2340]}, "end_time": 1723712290.3102157}}
{"tag": "info", "depth": 1, "time": 1723712290.3102157, "data": {"name": "Final Error", "traceback": "Traceback (most recent call last):\n File \"C:\\Users\\lyyd\\pyenv-win\\pyenv-win\\versions\\3.8.5\\lib\\site-packages\\PIL\\Image.py\", line 2543, in save\n format = EXTENSION[ext]\nKeyError: ''\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"C:\\Users\\lyyd\\pyenv-win\\pyenv-win\\versions\\3.8.5\\lib\\site-packages\\airtest\\cli\\runner.py\", line 72, in runTest\n exec(compile(code.encode(\"utf-8\"), pyfilepath, 'exec'), self.scope)\n File \"C:\\Users\\lyyd\\Desktop\\airtest_demo.air\\airtest_demo.py\", line 13, in <module>\n snapshot(filename='endTest', msg=\"airtest\")\n File \"C:\\Users\\lyyd\\pyenv-win\\pyenv-win\\versions\\3.8.5\\lib\\site-packages\\airtest\\utils\\logwraper.py\", line 131, in wrapper\n res = f(*args, **kwargs)\n File \"C:\\Users\\lyyd\\pyenv-win\\pyenv-win\\versions\\3.8.5\\lib\\site-packages\\airtest\\core\\api.py\", line 295, in snapshot\n screen = G.DEVICE.snapshot(filename, quality=quality, max_size=max_size)\n File \"C:\\Users\\lyyd\\pyenv-win\\pyenv-win\\versions\\3.8.5\\lib\\site-packages\\airtest\\core\\android\\android.py\", line 490, in snapshot\n aircv.imwrite(filename, screen, quality, max_size=max_size)\n File \"C:\\Users\\lyyd\\pyenv-win\\pyenv-win\\versions\\3.8.5\\lib\\site-packages\\airtest\\aircv\\aircv.py\", line 34, in imwrite\n compress_image(pil_img, filename, quality, max_size=max_size)\n File \"C:\\Users\\lyyd\\pyenv-win\\pyenv-win\\versions\\3.8.5\\lib\\site-packages\\airtest\\aircv\\utils.py\", line 107, in compress_image\n pil_img.save(path, quality=quality, optimize=True)\n File \"C:\\Users\\lyyd\\pyenv-win\\pyenv-win\\versions\\3.8.5\\lib\\site-packages\\PIL\\Image.py\", line 2546, in save\n raise ValueError(msg) from e\nValueError: unknown file extension: \n"}}
代码:
错误日志:
实际情况:
运行日志:
如果
snapshot(filename='endTest', msg="airtest")
不加filename参数,是可以正常运行的,加了以后就报错了系统环境
The text was updated successfully, but these errors were encountered: