'"File not found" error with PyCharm in Ubuntu 20.04
I am migrating from Windows to Ubuntu 20.04 desktop, and I am migrating from Wing IDE to PyCharm. I'm very familiar with Linux, and Linux file paths, as I have used it in the cloud for several years, but I'm new to desktop.
My problem is this: in the terminal, I can navigate to ~/Software_Projects/NT_Test_Projects/Px_Lib, but with the following Python lines in PyCharm I get "FileNotFound" error.
dest = r"~/Software_Projects/NT_Test_Projects/" + py_input_file[1:-3]
dir_files = os.listdir(dest)
Those lines produce the same file path as I see in the terminal -- ~/Software_Projects/NT_Test_Projects/Px_Lib -- so I don't know why I am getting this error.
I have tried numerous permutations (I even left off the leading ~) but I keep getting the same error.
I'm using PyCharm 2021.3.2 (Community Edition) on Ubuntu 20.04 desktop.
Thanks for any help with this.
Solution 1:[1]
The answer to this question turns out to be:
"/home/myxtc/Software_Projects/NT_Test_Projects/" + py_input_file[1:-3]
You can see the full project path in "Run - Edit Configurations." PyCharm needs the full path, not the familiar ~ to specify the home directory.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | RTC222 |
