带有 Terminus 的 Sublime Text Python 似乎会干扰文件处理

问题描述 投票:0回答:1

我正在运行这段简短的代码:

import os
if os.path.exists("demofile.txt"):
    print("file exists")
else:
    print("file does not exist")

文件“demofile.txt”与我的 python 文件位于同一目录中。

如果我使用这个 Python3 构建系统:

{
    "shell_cmd": "python3 -OO -u \"$file\"",
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python.3",
    "windows":
    {
        "shell_cmd": "py -3 -OO -u \"$file\""
    }
}

我的输出显示:

file exists
[Finished in 0.0s]

但是,如果我使用相同的 Python3 构建系统并添加了 Terminus:

{
    "target": "terminus_exec",
    "cancel": "terminus_cancel_build",

    "focus": true,
    
    "shell_cmd": "python3 -OO -u \"$file\"",
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python.3",
    "windows":
    {
        "shell_cmd": "py -3 -OO -u \"$file\""
    }
}

我的输出显示:

file does not exist
[Finished in 0.08s]

其他文件处理测试似乎也有类似的结果,其中添加 terminus 无法找到存在的文件。

对这里可能发生的事情有什么想法吗?

谢谢

python python-3.x sublimetext3 file-handling build-system
1个回答
0
投票

Debian GNU/Linux 12(书虫)64 位 侏儒 43.9 韦兰 Sublime Text 4 v4189(终点站)

构建系统(python3 v3.11.2):

// Python 终端构建

{ “目标”:“terminus_exec”, “取消”:“terminus_cancel_build”,

"focus": true,

"shell_cmd": "python3 -u \"$file\"",
"env": {
    "PYTHONIOENCODING": "utf-8"
},
"selector": "source.python",

"variants": [
    {
        "name": "Syntax Check",
        "shell_cmd": "python3 -m py_compile \"$file\""
    }
]

}

© www.soinside.com 2019 - 2024. All rights reserved.