I have a python script saved in a directory. When I run it from its folder it works as expected. However, when I run it through an interface (Unraid's User Script plug-in's "Run Script" button) it fails.
While troubleshooting I found that the command os.system("pwd")
returns the script's directory when I run it from the directory, but \root
when ran through the interface.
The script is failing as imported modules are looking for files in the directory the script is in.
I'm unable to change the modules, but is there a way to make the script think it is running in a specific directory regardless of where it is executed?