简体   繁体   中英

How to remove the Windows PATH from a Sublime Text 3 Python build error?

I am using Python 3 on Sublime Text 3 (win8.1 64bit). When I write some code and then build, if there is an error, the Windows PATH is displayed as part of the error.

How do I remove the Windows PATH on Sublime Text 3 output when there is an error?

I wont to remove ==> I want to erase.

This behavior can be changed by commenting out four specific lines in Packages/Default/exec.py , which is the system file that runs build systems by default.

First, you'll need to install PackageResourceViewer from Package Control. Next, open the Command Palette with Ctrl Shift P and type in prv to bring up the PackageResourceViewer options. Select PackageResourceViewer: Open Resource , then Default , then exec.py . You can now hit Esc to clear the Command Palette.

In the open file, scroll down to approximately line 212, looking specifically for this code block:

if "PATH" in merged_env:
    self.debug_text += "[path: " + str(merged_env["PATH"]) + "]"
else:
    self.debug_text += "[path: " + str(os.environ["PATH"]) + "]"

Select all 4 lines, then comment them out by hitting Ctrl / . Finally, hit Ctrl S to save the file.

This will create a new Default folder in your Packages directory (the one opened by selecting Preferences -> Browse Packages... ) with exec.py inside, and will override the original file stored in Default.sublime-package , which is stored elsewhere, in Sublime's installation directory. If at any time you wish to have the full PATH printed again, simply open Packages/Default/exec.py and uncomment the lines you commented before, then save the file.

I would also recommend deleting exec.py and re-running through the procedure above every time you upgrade Sublime, as there may be vital changes to this file in the new release that are key for other parts of the build systems to work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM