AirtestProject / Poco

A cross-engine test automation framework based on UI inspection
http://airtest.netease.com/
Apache License 2.0
1.77k stars 318 forks source link

在Pycharm的terminal下直接通过python test.py执行测试没问题,但是在cmd中执行python "e:\test.py"就会报错。 #85

Open laihanhua opened 6 years ago

laihanhua commented 6 years ago

(请尽量按照下面提示内容填写,有助于我们快速定位和解决问题,感谢配合。否则直接关闭。)

(重要!问题分类)

描述问题bug 我在Pycharm的terminal下直接通过python test.py执行测试没问题,但是在cmd中执行python "e:\test.py"就会报错。

Exception in thread Thread-138:
Traceback (most recent call last):
  File "D:\Python27\lib\threading.py", line 801, in __bootstrap_inner
    self.run()
  File "D:\Python27\lib\threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "D:\Python27\lib\site-packages\poco\drivers\android\uiautomation.py", line 206, in loop
    stdout, stderr = self._instrument_proc.communicate()
AttributeError: 'NoneType' object has no attribute 'communicate'

enter pay test
2018-09-26 17:29:31
[05:29:31][INFO]<airtest.core.api> Try finding:
Template(C:\Users\gzlaihanhua\res\img\pay\tpl1530687273894.png)
Try finding:
Template(C:\Users\gzlaihanhua\res\img\pay\tpl1530687273894.png)
[05:29:31][DEBUG]<airtest.core.android.adb> D:\Python27\lib\site-packages\airtest\core\android\static\adb\windows\adb.exe -s GWY7N16B05000455 shell am force-stop com.netease.dm0.allysdk.guaimao
D:\Python27\lib\site-packages\airtest\core\android\static\adb\windows\adb.exe -s GWY7N16B05000455 shell am force-stop com.netease.dm0.allysdk.guaimao
[05:29:31][INFO]<airtest.core.android.rotation> update orientation 1->0
update orientation 1->0
[05:29:31][DEBUG]<airtest.core.android.minicap> update_rotation: 0
update_rotation: 0
[05:29:31][DEBUG]<airtest.core.android.adb> D:\Python27\lib\site-packages\airtest\core\android\static\adb\windows\adb.exe -s GWY7N16B05000455 forward --remove tcp:16718
D:\Python27\lib\site-packages\airtest\core\android\static\adb\windows\adb.exe -s GWY7N16B05000455 forward --remove tcp:16718
[05:29:31][DEBUG]<airtest.core.android.adb> D:\Python27\lib\site-packages\airtest\core\android\static\adb\windows\adb.exe -s GWY7N16B05000455 forward --remove tcp:12271
D:\Python27\lib\site-packages\airtest\core\android\static\adb\windows\adb.exe -s GWY7N16B05000455 forward --remove tcp:12271
[05:29:31][DEBUG]<airtest.core.android.adb> D:\Python27\lib\site-packages\airtest\core\android\static\adb\windows\adb.exe -s GWY7N16B05000455 forward --remove tcp:17675
D:\Python27\lib\site-packages\airtest\core\android\static\adb\windows\adb.exe -s GWY7N16B05000455 forward --remove tcp:17675
[05:29:31][DEBUG]<airtest.core.android.adb> D:\Python27\lib\site-packages\airtest\core\android\static\adb\windows\adb.exe -s GWY7N16B05000455 forward --remove tcp:12669
D:\Python27\lib\site-packages\airtest\core\android\static\adb\windows\adb.exe -s GWY7N16B05000455 forward --remove tcp:12669
[05:29:31][DEBUG]<airtest.core.android.adb> D:\Python27\lib\site-packages\airtest\core\android\static\adb\windows\adb.exe -s GWY7N16B05000455 forward --remove tcp:15180
D:\Python27\lib\site-packages\airtest\core\android\static\adb\windows\adb.exe -s GWY7N16B05000455 forward --remove tcp:15180
[05:29:31][DEBUG]<airtest.core.android.adb> D:\Python27\lib\site-packages\airtest\core\android\static\adb\windows\adb.exe -s GWY7N16B05000455 forward --remove tcp:18850
D:\Python27\lib\site-packages\airtest\core\android\static\adb\windows\adb.exe -s GWY7N16B05000455 forward --remove tcp:18850
[05:29:31][DEBUG]<airtest.core.android.adb> D:\Python27\lib\site-packages\airtest\core\android\static\adb\windows\adb.exe -s GWY7N16B05000455 forward --remove tcp:19701
D:\Python27\lib\site-packages\airtest\core\android\static\adb\windows\adb.exe -s GWY7N16B05000455 forward --remove tcp:19701
[05:29:31][DEBUG]<airtest.core.android.adb> D:\Python27\lib\site-packages\airtest\core\android\static\adb\windows\adb.exe -s GWY7N16B05000455 forward --remove tcp:14100
D:\Python27\lib\site-packages\airtest\core\android\static\adb\windows\adb.exe -s GWY7N16B05000455 forward --remove tcp:14100
[05:29:31][DEBUG]<airtest.core.android.adb> D:\Python27\lib\site-packages\airtest\core\android\static\adb\windows\adb.exe -s GWY7N16B05000455 forward --remove tcp:15122
D:\Python27\lib\site-packages\airtest\core\android\static\adb\windows\adb.exe -s GWY7N16B05000455 forward --remove tcp:15122
[05:29:31][DEBUG]<airtest.core.android.adb> D:\Python27\lib\site-packages\airtest\core\android\static\adb\windows\adb.exe -s GWY7N16B05000455 forward --remove tcp:14464
D:\Python27\lib\site-packages\airtest\core\android\static\adb\windows\adb.exe -s GWY7N16B05000455 forward --remove tcp:14464
[05:29:31][DEBUG]<airtest.core.android.adb> D:\Python27\lib\site-packages\airtest\core\android\static\adb\windows\adb.exe -s GWY7N16B05000455 forward --remove tcp:15224
D:\Python27\lib\site-packages\airtest\core\android\static\adb\windows\adb.exe -s GWY7N16B05000455 forward --remove tcp:15224
[05:29:31][DEBUG]<airtest.core.android.rotation> orientationWatcher has ended
orientationWatcher has ended

复现步骤

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

预期效果 (预期想要得到什么、见到什么)

相关截图 (贴出遇到问题时的截图内容,如果有的话)

python 版本: python2.7

poco 版本: 1.0.69

poco版本通过pip freeze可以命令可以查到

设备:

其他相关环境信息 (其他运行环境,例如在linux ubuntu16.04上运行异常,在windows上正常。)

yimelia commented 6 years ago

hi @laihanhua 求提供一下所连接的android应用名?我们可以测试一下

laihanhua commented 6 years ago

@yimelia 你好,内部应用,不方便提供。

yimelia commented 6 years ago

@laihanhua 检查一下pycharm所用的环境与命令行中是否一致?

adolli commented 6 years ago
Traceback (most recent call last):
  File "D:\Python27\lib\threading.py", line 801, in __bootstrap_inner
    self.run()
  File "D:\Python27\lib\threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "D:\Python27\lib\site-packages\poco\drivers\android\uiautomation.py", line 206, in loop
    stdout, stderr = self._instrument_proc.communicate()
AttributeError: 'NoneType' object has no attribute 'communicate'

从这个报错看来,是你的库没更新。试试 pip install -U pocoui