Skip to content

创建容器python读取不到相对路径 #2952

@danpianji

Description

@danpianji

Qinglong version

2.20.2

Steps to reproduce

Traceback (most recent call last):
File "/ql/data/scripts/btdr/app.py", line 32, in
with open('config.yaml', 'r', encoding='utf-8') as f:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'config.yaml'

app.py和config.yaml在同一个文件夹目录下,
之前程序可以跑, 被攻击后删除重新建, 升级最新版本都一样, 执行python的路径正常, 但是python运行的时候它获取当前目录不是程序所在目录, 写出config.yaml的绝对路径是可以运行的, 因为很多脚本包括以后写的都使用程序所在目录读取文件,所以这个问题怎么解决 ,

What is expected?

What is actually happening?

System Info

Any additional comments?

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions