#Question
FileNotFoundError: [Errno 2] No such file or directory:’./XXX’
When ensuring that the file/directory does exist, the probability is the problem of the current running path of the program. Whether the code runner or the terminal is running, the default current path of vs code is not the path where the program file is located, so using the relative path to find the file will report an error.
#Settle
1. For code runner, modify its settings in expansion and check the option of file directory as CWD.
2. For terminal operation, CD to the directory of program files first.
Read More:
- How to import Python from relative path
- Relative path and absolute path${ pageContext.request.contextPath }
- No code, a solution to the error in the path of reading CSV file by Python: filenotfounderror: [errno 2] no such file or directory: ‘XX. CSV‘
- Open vs code through terminal using code command in Mac OS
- MacOS adds code command to vs Code
- VS 2010: An error occurred loading a configuration file: Failed to map the path ‘/’.
- Vs2019: solution nvcc total: cannot find compiler‘ cl.exe ‘ in PATH
- Difference between vs code user and system version
- Vs2015 compiling ffmpeg source code
- sys.path.append(), os.path.exists(), os.path.join() and os.makedirs() meaning
- Vs compilation error msb6006:“ cmd.exe ” exited with code 1.
- Python – [encoding] in Python os.system Solution to Chinese garbled code when calling CMD command
- Two lines of code to solve your vs flashback problem
- [Solved] Vue Project Error: This relative module was not found
- Python server run code ModuleNotFoundError Error [How to Solve]
- OpenGL environment configuration under VS2010 / vs2012 / vs2015
- When vs2017 compiles CUDA project, “error msb6006:“ cmd.exe ”Exited with code 1 Solutions for
- Vs code solves the problem that latex does not display references and [?] is displayed in the text
- Barrier free click path source code to read
- Vs + CUDA compilation error: msb3721, return code 255