我的资源:
Python 2.7、Ubuntu 18.04、Pycharm、虚拟盒子oracle
我有一个用 python 构建的自动化解决方案。该解决方案可以同时从 cmd
或 pycharm
运行。 2 个运行自动化解决方案的选项。
python main.py args a,b,c...(run 1 suite of tests)
python jenkinsRun.py arg a,b,c...(run main.py with diff args each time -lets say 5 time for instance)
一旦 jenkinsRun.py
运行,它将执行每个 main.py
像这样:
os.system('python main.py %s %s %s %s %s %s'%(STD,config.VpcStackName, '-dryrun', 'false', '-tenant' ,config.PROD_STAGE_Tenant))
请注意,这就是我 3 年前实现它的方式。可能是更好的方法,例如使用 __import__
,但需要传递参数的方法等…
无论如何,运行时:
python main.py arg a,b,c..
都好。
运行时:
jenkinsRun.py
每次都应该使用 diff args 运行 main 我得到异常:
"/home/ohad/.local/lib/python2.7/site-packages/botocore/httpsession.py", line 7, in <module>
from urllib3.util.ssl_ import (
ImportError: cannot import name ssl
只有当我上周在我的新环境中运行代码时才会发生这种情况(请参阅上面的参考资料)我有带有 ubuntu 15.04(旧)的旧 virtul box,一切都运行良好(从那以后就没有碰过 vode)。
我已经从头开始在新的虚拟盒子上安装了库、驱动程序等。
有任何想法吗?
原文由 ohadshay 发布,翻译遵循 CC BY-SA 4.0 许可协议
只是为了确保:你确定你正在调用
Python 2.x
吗?Ubuntu 18.04
有Python 3.x
作为默认值,因此请确保您不会不小心使用另一个 python 版本启动脚本。