I'm using pymatgen, which has a class BaderAnalysis (https://github.com/materialsproject/pymatgen/blob/v2020.4.29/pymatgen/command_line/bader_caller.py). This class needs a executable called bader (binary from another source), so it checks if the file is there or not using which(). I do have the file and i can run the bader program manually, but I always get the error that the file isn't there. If I try the which() command manually it turns out that it only finds it with the prefix ./
print(which('bader'))
print(which('./bader'))
Output: None
./bader
How can I make it in a way that the which command finds it without the prefix? (because the pymatgen class literally runs if not which("bader") or which("bader.exe"): 'error message...'
when initializing the class.
You would need to add your current directory to your PATH
environment variable. You can do it in your program invocation. E.g.,
PATH=$PATH:$PWD python my_script.py