2024-05-28 19:11:25 发布
网友
我一直在尝试使用以下方法来访问卷装载中的文件:
with open('./log/file.json', 'w+') as f: f.write(json.dumps(output, sort_keys=True, indent=4))
但它不起作用。有什么想法吗?在部署文件中,我有:
volumeMounts: - mountPath: /logs name: wag-log
您已经定义了一个volumeMount,mountPath设置为/logs,这将把一个卷装入/logs目录。在Python代码中,您是在路径./log/file.json处编写的,该路径不在/logs中。你知道吗
volumeMount
mountPath
/logs
./log/file.json
尝试将日志写入已装入的目录,例如:
with open('/logs/file.json', 'w+') as f: f.write(json.dumps(output, sort_keys=True, indent=4))
您已经定义了一个
volumeMount
,mountPath
设置为/logs
,这将把一个卷装入/logs
目录。在Python代码中,您是在路径./log/file.json
处编写的,该路径不在/logs
中。你知道吗尝试将日志写入已装入的目录,例如:
相关问题 更多 >
编程相关推荐