我输入此输入命令时收到此错误:

$python3.4 cron_e2e.py -f test_web_events -E ctg-clickstream testbrad

错误:

$python3.4 cron_e2e.py -f test_web_events -E ctg-clickstream testbrad

Traceback (most recent call last):

File "cron_e2e.py", line 421, in

sys.exit(main(sys.argv))

File "cron_e2e.py", line 368, in main

log.addHandler(logging.FileHandler(logfile))

File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py", line 1006, in __init__

StreamHandler.__init__(self, self._open())

File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py", line 1030, in _open

return open(self.baseFilename, self.mode, encoding=self.encoding)

FileNotFoundError: [Errno 2] No such file or directory: '/Users/bli1/Development/QE/chun-qe-trinity-functional/qe/tests/qe/logs/testbrad_8_21_2015_cron.log'

错误发生在这一行:

log.addHandler(logging.FileHandler(logfile))

不太确定我的代码在哪里不为我创建日志文件

码:

def main(argv):

"Test"

exit_code = 0

global me; me = os.path.basename(argv[0]) # name of this program

global mydir; mydir = os.path.dirname(os.path.abspath(__file__))

parser = argparse.ArgumentParser(description=main.__doc__)

parser.add_argument("-f", "--functional_test", metavar="FUNCTEST",

dest="functest", help="Type of functional test")

parser.add_argument("-p","--phase", action="append",

metavar="POST|HDFS|HIVE|ALL", dest="phase",

help="phase of test to run")

parser.add_argument("-t", "--testfile", metavar="TESTFILE",

dest="testfile", default=os.path.join(mydir, "resources/cron.json"),

help="file with test commands")

parser.add_argument("-E","--Event", metavar="EVENTNAME",

dest="event_names", action="append",

help="[repeatable] topic to which to post")

parser.add_argument("runtag",

metavar="RUNTAG",

help="run tag for this run")

args = parser.parse_args(args=argv[1:]) # will exit on parse error

log = logging.getLogger(me)

log.setLevel(logging.INFO)

dt = datetime.datetime.utcnow()

logfile = "qe/logs/" + (args.runtag + "_{}_{}_{}".format(dt.month, dt.day, dt.year) + "_cron.log")

pdb.set_trace()

if isinstance(logfile, str):

if os.path.exists(logfile):

os.remove(logfile)

# logging.FileHandler() returns FileHandler class, the file is opened and used as the stream for logging

log.addHandler(logging.FileHandler(logfile))

console = logging.StreamHandler(sys.stderr); console.setLevel(logging.WARNING); log.addHandler(console)

python安装找不到.log的文件_python – logger找不到文件相关推荐

  1. python怎么调用文件_python 中如何引用头文件

    python 引入 导入 自定义模块, python 引入 导入 外部文件 python 引入 导入 自定义模块, python 引入  导入 外部文件 项目中想使用以前的代码,或者什么样的需求致使你 ...

  2. python安装在d盘环境变量配置_python安装与环境变量配置

    1.问:自学简单吗? 答:自学简单,当第一次接触这门语言的时候,哇,语法好简单,简简单单的一句代码就可以实现输出,比如想输出hello world!,直接在python shell中输入 print( ...

  3. python解压7z文件_Python调用7zip命令实现文件批量解压

    Python调用7zip命令实现文件批量解压 1.输入压缩文件所在的路径 2.可以在代码中修改解压到的文件路径和所需要解压的类型,列入,解压文件夹下面所有的mp4格式的文件 3.cmd 指的就是Pyt ...

  4. python安装与开发环境搭建实验总结_python实验一:python环境配置

     你看到提示符 >>> 就表示我们已经在 Python 交互式环境中了,可以输入任何 Python 代码,回车后会立刻得到执行结果.现在,输入 exit() 并回车,就可以 退出 ...

  5. python读取所有txt文件_python如何批量读取txt文件

    python批量读取txt文件的方法:首先导入系统模块:然后将文件夹路径更改为需要批量读取的txt文件存放的路径:再调用系统模块得到该文件夹下的所有文件名称:最后遍历文件夹,读取txt文件. 如果文件 ...

  6. python高级教程html文件_Python之html转docx文件高级用法

    说到word文档转html的,网上一搜一大把,各种在线word转html页面,使用起来也方便.但是在实际项目中要使用的话,需要自己开发,这里就提供一个简单的方法. 后缀 .doc 和 .docx 都是 ...

  7. python从csv读取数据到网页输入框_python中怎么把csv文件读取的数据显示在网页上...

    python的标准库csv库主要是面向本地文件,就是说你的CSV文件得存储在你的电脑上.当进行网络数据采集的时候,很多文件都是在线的.不过有一些办法可以解决这个问题: 1,手动把CSV文件下载到本机, ...

  8. python pandas 处理相同标题的csv文件_Python使用pandas处理CSV文件的实例讲解

    Python中有许多方便的库可以用来进行数据处理,尤其是Numpy和Pandas,再搭配matplot画图专用模块,功能十分强大. CSV(Comma-Separated Values)格式的文件是指 ...

  9. python导入mat文件_python读取并写入mat文件的方法

    先给大家介绍下python读取并写入mat文件的方法 用matlab生成一个示例mat文件: clear;clc matrix1 = magic(5); matrix2 = magic(6); sav ...

最新文章

  1. 干货|最全面的卷积神经网络入门教程
  2. c语言答案填空选择,C语言试题配答案
  3. Java引入import其它目录的自定义包或java源文件
  4. xgboost安装_Machine Learning Mastery 博客文章翻译:XGBoost
  5. SM37作业条目的存储表
  6. vue项目中所使用的element-UI / echarts
  7. java web程序 上机考试做一个登陆注册程序
  8. SELinux 引起的 Docker 启动失败
  9. Action类一般情况为何要继承ActionSupport
  10. python程序设计pdf上海交大_上海交大2011_2012程序设计python期末考试题
  11. 嵌入式系统那些事—脚本语言tcl
  12. 安装Centos7操作系统教程
  13. ps制作计算机考试证件照,如何通过PS制作一寸证件照(超详细流程)?
  14. amazon linux ami root 密码,Amazon Linux AMI 常见问题
  15. java 游戏源码_源码下载 - Java源码 - 游戏娱乐
  16. idea打开文件显示多行,不隐藏
  17. MTK机器原始OTA更新方法
  18. 存储单位bit、byte、KB、MB、GB、TB、PB、EB、ZB、YB、BB、NB、DB、CB、XB
  19. matlab中f分布,在matlab中用哪个函数求F分布的分位点(分子分母的自由度和概率均已知)...
  20. CSS3的动画与变形

热门文章

  1. Leetcode 509. Fibonacci Number
  2. sklearn学习5-----模型评估(1) 分类度量
  3. IDEA快捷键生成serialVersionUID
  4. ELK学习总结(3-2)elk的过滤查询
  5. webpack 命令
  6. 利用java导入导出excel到oracle数据库
  7. css背景图充满整个屏幕
  8. 数据结构开发(5):线性表的链式存储结构
  9. rabbitmq之window环境启动
  10. .net与.net core学习目录