os.py”, line 725, in getitem raise KeyError(key) from None KeyError: ‘PATH’
scenario: when I was working on the project, I encountered a problem. Everything was running normally on the Linux server, but there was a problem when I was running in the remote finalshell (the code behind the process actually ran), but it seemed that there was a problem with the environment.
Solution process:
when I instantiated a class, I was a little puzzled by this problem. When I began to find out about os.environ [“path”], I knew that Python did not load the environment (here I used the virtual environment instead of the system default Python). So I went into the virtual environment to execute this:
import os
print(os.environ["PATH"])
It is found that there is a value here, but the bug reported is none. Therefore, at the beginning of the code, I add the value printed out just now to the code, and then I can continue to execute Python code in the virtual environment of the server on the remote shell
import os
os.environ["PATH"] = "This string copies the value printed from the above code"
So far, everything can run normally
Read More:
- [Solved] Keras Error: KeyError: ‘accuracy‘, KeyError: ‘val_acc‘, KeyError: ‘acc‘
- mmdetection Error when running voc.py: KeyError: ‘NumClassCheckHook is already registered in hook‘
- Maskrcnn-benchmark Error: KeyError “Non-existent config key: MODEL.BACKBONE.OUT_CHANNELS“
- result = e.symbols[symb] KeyError: b‘system‘ [How to Solve]
- Python3: Str.format Keyerror Solution for incoming parameter error
- How to Fix KeyError: ‘plotly_domain’
- [Solved] PYNQ load bit error: KeyError: ‘interrupts‘
- [Solved] Fluent filesysterexception: exists failed, path =’d: \ as’. Plugins’ (OS error: incorrect file name, directory name or volume slogan)
- flask init-db Error: Error: Could not locate a Flask application. Use the ‘flask –app’ option, ‘FLASK_APP’ environment variable, or a ‘wsgi.py’ or ‘app.py’ file in the current directory.
- [Solved] Gitee generates public key error: Enter file in which to save the key…
- [Solved] Visdom Error: raise ConnectionError
- Error running ‘PigSellCabinetApplication’: Command line is too long. Shorten command line for PigSellCabinetApplication or also for Spring Boot default configuration
- [Solved] Pip install icu failed: Command “python setup.py egg_info” failed with error code 1 in
- E11000 duplicate key error collection: *** index: _id_ dup key
- SpringBoot Error running ‘Application’: Command line is too long.Shorten command line for
- [Solved] SecureCRT Error: Key exchange failed. No compatible key exchange method.
- [Solved] Error running XxlJobExecutorHiveApplication. Command line is too long. Shorten the command line via
- Springboot configuration project access path URL root path
- [Solved] Error running ‘WebApplication‘: Command line is too long. Shorten command line for WebApplication or
- [Solved] Error running ‘LocalTest‘: Command line is too long. Shorten command line for LocalTest or also for…