ydf0509 / nb_log

pip install nb_log 各种日志handler和自动转化项目的任意print的效果。日志自动彩色炫酷,可点击控制台的日志自动精确跳转到pycharm的文件和行号。文件日志多进程切割安全。在10个最重要方面全方位超过loguru
389 stars 73 forks source link

nb_log识别出的nb_log_config.py所在路径,是个错误路径 #47

Closed whitePythonLearn closed 1 year ago

whitePythonLearn commented 1 year ago

failed: Importing listener 'D:\robotframework_smartHub3.0\rf_smarthub3.0\python_files\RobotListener.py' failed: FileNotFoundError: [Errno 2] No such file or directory: 'D:\Python39\Scripts\robot.exe\nb_log_config.py' 执行文件RobotListener.py调用mylog.py image mylog.py: image 项目结构: image

whitePythonLearn commented 1 year ago

补充一下,单个执行RobotListener.py,日志生成是正常的。 我的是robotframework项目,发生错误的操作是执行了robotframework的执行命令: D:\Python39\Scripts\robot.exe --listener D:\robotframework_smartHub3.0\rf_smarthub3.0\python_files\RobotListener.py -d D:\robotframework_smartHub3.0\rf_smarthub3.0 D:\robotframework_smartHub3.0\rf_smarthub3.0\smartHub\测试数据构造\测试数据构造.robot

ydf0509 commented 1 year ago

D:\Python39\Scripts\robot.exe\nb_log_config.py 这种就是sys.path[1]识别错误,因为你打包成exe了,sys.path[1]发生了变化。

你自己使用PYTHONPATH或者sys.path.insert来使nb_log_config.py在sys.path的文件夹列表中的任何一个文件夹下面的位置就行了。