【Selenium + Python】路径报错之OSError: [Errno 22] Invalid argument: './t/report/2018-03-23_11:03:12_report.html'
现象:

此问题真的是太痛苦了,查了好多资料是说路径的问题,结果还是报错,后来一点点的排查才发现原来是!!!!!!
废话不多说上原来代码:
if __name__ == '__main__':
startime = time.strftime('%H:%M:%S')
print("开始时间为:%s" % startime)
#测试路径
test_dir = './t/test_case'
#报告路径
report_dir = './t/report/' now = time.strftime('%Y-%m-%d_%H:%M:%S')
# 创建完整报告文件
filename = report_dir + now + '_report.html'
fp = open(filename,'wb')
看到没有!!看第九行,now的获取时间有问题!!!时分秒之间不能用冒号:,不能用冒号:,不能用冒号:,重要的事情说三遍!!!真的要哭了!!!
修改如下:
if __name__ == '__main__':
startime = time.strftime('%H:%M:%S')
print("开始时间为:%s" % startime)
#测试路径
test_dir = './t/test_case'
#报告路径
report_dir = './t/report/' now = time.strftime('%Y-%m-%d_%H_%M_%S')
# 创建完整报告文件
filename = report_dir + now + '_report.html'
fp = open(filename,'wb')
【Selenium + Python】路径报错之OSError: [Errno 22] Invalid argument: './t/report/2018-03-23_11:03:12_report.html'的更多相关文章
- 【Selenium】【BugList9】windows环境,fp = open("./"+ time.strftime("%Y-%m-%d %H:%M:%S") + " result.html",'wb'),报错:OSError: [Errno 22] Invalid argument: './2018-09-05 10:29:32 result.html'
[代码] if __name__=="__main__": suite = unittest.TestSuite() suite.addTest(Baidu("test_ ...
- 在使用python语言的open函数时,提示错误OSError: [Errno 22] Invalid argument: ‘文件路径’
如题,在使用python语言的open函数时,提示错误OSError: [Errno 22] Invalid argument: '文件路径',在查阅了大量资料后也得到了一些解决方案,但是这些解决方案 ...
- python使用open的OSError: [Errno 22] Invalid argument错误
这两天在写一个新闻类的spider时,遇到了OSError: [Errno 22] Invalid argument这个错误,苦恼的两天,无果.后来通过请教学长,发现原来是打开的文件名中含有一些系统的 ...
- python OSError: [Errno 22] Invalid argument: '\u202aF://text
windows10 python3 读文件的时候报的错误 原因不明时好时坏很头疼但又没办法不知道怎么解决,网上的说法都不能解决,
- python OSError: [Errno 22] Invalid argument: 'D:\\crawle\x01.html1'
import urllib.request file = urllib.request.open("http://www.baidu.com") data = file.read( ...
- tensorboard OSError:[Errno 22] Invalid argument
哈哈 问题解决了.感谢大佬 Bill.Z 附上原文链接:https://blog.csdn.net/u013244846/article/details/88380860 解决方法:更改manager ...
- OSError: [Errno 22] Invalid argument: 'D:\x07ckup\test.txt'
使用with open("D:\backup\test.txt","rt") as f:报上面的错误,将上面的语句改成 with open(r"D:\ ...
- Python创建文件报错OSError:[Errno 22] Invalid argument处理
问题: windows平台下使用python open函数w模式打开文件报错“OSError: [Errno 22] Invalid argument: '../news/“消费升维”成零售业新风口? ...
- 训练DQN,报错:OSError: [Errno 12] Cannot allocate memory
训练DQN,报错:OSError: [Errno 12] Cannot allocate memory 问题介绍: 这两天在做强化学习的作业,使用 DQN 打 Atari 游戏,但在训练过程中,出现了 ...
随机推荐
- .NET设计模式系列文章《转》
原文发布时间为:2008-11-02 -- 来源于本人的百度文章 [由搬家工具导入] http://www.cnblogs.com/Terrylee/archive/2006/07/17/334911 ...
- 《Linux命令行与shell脚本编程大全 第3版》Linux命令行---45
以下为阅读<Linux命令行与shell脚本编程大全 第3版>的读书笔记,为了方便记录,特地与书的内容保持同步,特意做成一节一次随笔,特记录如下:
- Linux继续学习笔记
本篇文章是慕课网<Linux达人养成计划2>笔记. 第一章 VIM文本编辑器 VI : Visual Interface (可视化接口) VIM: 在VI的基础上进行的升级,相比于VI有一 ...
- HDFS写文件过程分析
转自http://shiyanjun.cn/archives/942.html HDFS是一个分布式文件系统,在HDFS上写文件的过程与我们平时使用的单机文件系统非常不同,从宏观上来看,在HDFS文件 ...
- Arduino可穿戴教程Linux平台下安装Arduino IDE
Arduino可穿戴教程Linux平台下安装Arduino IDE Linux平台下安装Arduino IDE Linux平台下的安装方式和Windows下的zip形式安装是类似的,只是Linux下的 ...
- HNOI 2006 BZOJ 1195 最短母串
题面 问题描述 给定n个字符串(S1,S2,„,Sn),要求找到一个最短的字符串T,使得这n个字符串(S1,S2,„,Sn)都是T的子串. 输入 第一行是一个正整数n(n<=12),表示给定的字 ...
- Fresco,Facbook强大的图片加载框架
项目git地址:https://github.com/facebook/fresco Fresco是 facebook推出的一款强大的图片加载的框架:主要有Image Pipeline和Drawees ...
- Scut游戏服务器引擎之Unity3d接入
Scut提供Unity3d Sdk包,方便开发人员快速与Scut游戏服务器对接: 先看Unity3d示例如下: 启动Unity3d项目 打开Scutc.svn\SDK\Unity3d\Assets目录 ...
- linux命令lsattr、chattr、man
1.man命令,可以查看手册 配置位置/etc/man.conf MANPATH决定手册查询位置 MANSECT决定man查询的顺序 man的查询 linux man的常用用法: man sectio ...
- TestNG的參数化測试、共享线程池配置、參数默认值配置
在使用TestNG进行測试时,常常会使用到一些參数化配置,比方数据库.连接池.线程池数. 使用TestNG的參数@Parameter注解进行自己主动化读取 原创文章,版权全部.同意转载,标明出处:ht ...