I use elpy and I am not able to use relative paths to access files because the PYTHONPATH doesn't include the directory I'm in by default. I may have set it up wrong in elpy-config. Here are my paths by default after using pprint.pprint(sys.path):
['',
'/usr/lib/python310.zip',
'/usr/lib/python3.10',
'/usr/lib/python3.10/lib-dynload',
'/home/steve/.virtualenvs/venv/lib/python3.10/site-packages',
'/home/steve/Python/']
I was adding the path every project using os.chdir() but this didn't work for modules so
I have been manually appending the path that I'm working in every new project I start by using sys.path.append() and this works fine. How can I have the current directory I'm in added to the path's without having to append it every time?
Emacs.............: 27.1
Elpy..............: 1.35.0
Virtualenv........: venv (/home/steve/.virtualenvs/venv/)
Interactive Python: python3 3.10.4 (/home/steve/.virtualenvs/venv/bin/python3)
RPC virtualenv....: rpc-venv (/home/steve/.emacs.d/.local/etc/elpy/rpc-venv)
Python...........: python 3.10.4 (/home/steve/.emacs.d/.local/etc/elpy/rpc-venv/bin/python)
Jedi.............: 0.18.1
Autopep8.........: 1.6.0
Yapf.............: 0.32.0
Black............: 22.3.0
Syntax checker....: flake8 (/home/steve/.virtualenvs/venv/bin/flake8)
elpy, but usingPYTHONPATHis quite out of fashion these days. Almost everyone I know uses a tool likepipenvorpoetryto run their project in a "virtual environment", and I know that there are Emacs packages to support that style of work.