Skip to content

[question] 脚本中该如何处理相对路径? #2404

@Attrify-fanlin

Description

@Attrify-fanlin

背景

我有一个网络请求, 请求体内容是经过了加密的 pb 格式数据. 我想把它解密并转成 json 输出, 目前将 pb 文件都放在了 addons.py 目录下

问题

编辑时脚本文件的路径是 Reqable/user/xxx/scripts/xxx/addons.py, 而运行时脚本文件的路径是 Reqable/scripts/exec/xxxx/xxxx/addons.py, 导致无法找到对应的 pb 文件;
因为这个脚本需要共享给其他同事使用, 不太想使用绝对路径

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions