With the help of evanjs on IRC, I packaged a simple Python script. It is an IRC welcoming bot. It expects a bot_settings.py file, but I am unable to point it to the file I want. So for import bot_settings as settings it says ModuleNotFoundError: No module named 'bot_settings' in the journal.
Below is the expression. You can see that I also tried makeWrapperArgs.
Do I interpret correctly that bot_settings.py is supposed to be supplied in the working directory? This cannot work because Python imports relative to the source path, not CWD. You can of course do something like this. For a toy application that is probably good enough.
I just saw the environment settings you have there - pretty sure PYTHONPATH should be a directory, not the file you are targeting.
Oh, do you have an example of buildPythonApplication and referencing it in a unit? The only info I found about the difference with buildPythonPackage was in an SO comment: “The main difference is that buildPythonApplication doesn’t add the interpreter version to the resulting output name apparently”
There’s more to it, it also wont propagate it’s python packages when included as a dependency in another derivation. That way you could have an application packaged with python2 be used in a python3 environment
Not to hijack the thread, but I’m creating a package using buildPythonApplication and was curious about the recommended way to add the directory of the compiled binary to PATH. At the moment, I get the following warning when the package builds:
WARNING: The script MyPythonApp is installed in '/nix/store/blahblahblah-MyPythonApp/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.