python WindowsError: [Error 145] :解决

执行自动化脚本时,删除文件夹里旧文件报错。如下
C:\ProgramData\Anaconda2\python.exe F:/AutoStartTime/Record_QQLive.py
删除旧文件 -- 开始
Traceback (most recent call last):
File "F:/AutoStartTime/Record_QQLive.py", line 197, in
QQLive = Record_QQLive(serial='cddfc295')
File "F:/AutoStartTime/Record_QQLive.py", line 26, in init
self.test_initEnv()
File "F:/AutoStartTime/Record_QQLive.py", line 92, in test_initEnv
shutil.rmtree(self.pcAppPath)
File "C:\ProgramData\Anaconda2\lib\shutil.py", line 261, in rmtree
rmtree(fullname, ignore_errors, onerror)
File "C:\ProgramData\Anaconda2\lib\shutil.py", line 261, in rmtree
rmtree(fullname, ignore_errors, onerror)
File "C:\ProgramData\Anaconda2\lib\shutil.py", line 270, in rmtree
onerror(os.rmdir, path, sys.exc_info())
File "C:\ProgramData\Anaconda2\lib\shutil.py", line 268, in rmtree
os.rmdir(path)
WindowsError: [Error 145] : u'QQLive\ad\nocache'

原因: 该文件夹处于被打开状态

解决办法: 关闭文件夹后再执行脚本 。so sad~~~低级错误

python WindowsError: [Error 145] :解决

windows10 subsystem for linux adb 连接识别设备

系统:windows10 subsystem for linux ubuntu 16.04

问题:安装了Android-tools 之后 adb 可以执行,但adb devices拉不到设备list

原因: windows 系统的adb version 必须与linux 子系统的adb version保持一致

解决步骤:
1、ubuntu adb 安装
sudo apt-get update && sudo apt-get install android-tools-adb

2、重新下载一个与windows adb version 一样的 linux 版本adb (查看命令 adb version)
wget -O - https://skia.googlesource.com/skia/+archive/cd048d18e0b81338c1a04b9749a00444597df394/platform_tools/android/bin/linux.tar.gz | tar -zxvf - adb

3、覆盖/usr/bin/adb
* sudo mv adb /usr/bin/adb
* sudo chmod +x /usr/bin/adb (如果有执行权限可省略这一步)
* adb version (查看版本是否与windows下的adb 一致)
* adb devices (成功拉取到设备list)

windows10 subsystem for linux adb 连接识别设备

python 自动化uiautomator 报错:ioerror RPC server not started解决办法

在使用最新的VIVO X21手机过程中,自动化脚本报错:

Traceback (most recent call last):
File "main.py", line 75, in
Automated.test_auto_test()
File "main.py", line 22, in test_auto_test
QQLive = Record_QQLive(serial='2973cab8')
File "/mnt/f/AutoStartTime/Record_QQLive.py", line 25, in init
self.test_initEnv()
File "/mnt/f/AutoStartTime/Record_QQLive.py", line 93, in test_initEnv
self.dins.pressHome()
File "/mnt/f/AutoStartTime/androidDrive/deviceInstance.py", line 85, in pressHome
self.ins.pressHome()
File "/mnt/f/AutoStartTime/androidDrive/deviceInstance.py", line 239, in pressHome
self._sys.pressHome()
File "/mnt/f/AutoStartTime/androidDrive/sysActions.py", line 49, in pressHome
self._d.press("home")
File "/mnt/f/AutoStartTime/androidDrive/helper.py", line 140, in call
return self.func(*args, **kwargs)
File "/mnt/f/AutoStartTime/androidDrive/automatorDevice.py", line 233, in _press
return self.server.jsonrpc.pressKey(str(key))
File "/mnt/f/AutoStartTime/androidDrive/automatorServer.py", line 81, in wrapper
server.start(timeout=30)
File "/mnt/f/AutoStartTime/androidDrive/automatorServer.py", line 122, in start
**raise IOError("RPC server not started!")
IOError: RPC server not started!
**

出错原因:
7.0的手机不会自动安装app-uiautomator.apk和app-uiautomator-test.apk,手动装一下就可以了

解决办法如下:
1. adb shell pm uninstall com.github.uiautomator
2. adb shell pm uninstall com.github.uiautomator.test
3. adb install app-uiautomator.apk
4. adb install app-uiautomator-test.apk
5. adb push bundle.jar /data/local/tmp/
6. adb push uiautomator-stub.jar /data/local/tmp/

相关文件下载地址:
https://github.com/jiankehtt/uiautomator/tree/master/uiautomator/libs

python 自动化uiautomator 报错:ioerror RPC server not started解决办法

自我介绍

周末到山东接小孩,自然是要聚聚
觥筹交错之间,自我介绍是需要的

记得以前,介绍百度很简单,就是那个百度
然后介绍腾讯,有一段时间,亲人们会提到QQ
但,这次,谈话间,只提微信了

而,百度还是百度

升华下(比较擅长)...
在剧烈变化的行业里面工作,产品一直在迭代。“风口论”催生了很多创业公司
移动互联网的大潮汹涌而来
而今,“风口论”变了,现在是AI论,ALL IN AI,不提AI,都不好意思说在做技术了
AI 跑起来...

测试in AI
数据in AI
运维in AI
APPin AI
后台in AI

ml

自我介绍

DATABASE ERROR CONNECTION FAILED UNABLE TO CONNECT TO THE DATABASE解决方案

迁移到wordpress之后,2~3天mysql就挂掉,提示

database error connection failed unable to connect to the database

从server提供的日志看,是mysql内存占用过大,被kill了。起初以为1G内存不够用,需要加内存,看了看加服务器内存价格,算了,研究其他解决方法:
1、限制mysql只能本地访问(避免数据库扫库攻击)
2、更改robots.txt规则,拒绝搜索引擎抓取内容
3、设置首页最大文章展现数量,从展现10篇文章改为5篇

更改之后,运行几天观察,暂无“DATABASE ERROR CONNECTION FAILED” 告警。

DATABASE ERROR CONNECTION FAILED UNABLE TO CONNECT TO THE DATABASE解决方案