Louis
Louis

Reputation: 321

Nuitka compilation error: No keyring backend available

I’m trying to compile a small python file which sends email based on the yagmail library, which itself relies on the keyring library.

Compiling works fine. Executing with dry-run options works fine. However, when I actually try it, it prompts for the password (as the yagmail library normally does), but once the password entered, it comes back with an error telling me that there was no keyring backend found.

Obviously, there is a keyring backend (on Windows it’s Credentials manager I believe) and it works fine when I use the same program in the python form using the python runtime.

How can I package a keyring backend in the exe file using Nuitka (or pyinstaller, for that matter)?

Upvotes: 1

Views: 225

Answers (1)

MatCat
MatCat

Reputation: 77

I'm not familiar with keyring, but here are a few suggestions on getting outside code/files to work with Nuitka.

  1. Test your code using normal python processes. Don't proceed to Nuitka until everything is working.
  2. Compile your code using Nuitka without --standalone or --onefile options. (I assume this is what you were referring to as a dry run option.)
  3. Test resulting .bin or .exe
  4. Compile your code with --standalone option.
  5. Test resulting .bin or .exe. Make sure you are testing the new file in the .dist folder, not the file you tested in step 3.

If your test results from steps 3 and 5 are different, you are likely not properly including all necessary files. You can manually copy and paste files into the .dist folder, or you can use the following Nuitka options to have them added at the time of the build.

--include-data-files=/AbsolutePathToCurrentFile/file.txt=relativePathInDistFolder/file.txt
--include-data-dir=/AbsolutePathToCurent/myDirectory=relativePathInDistFolder/myDirectory
--include-module=myModule
--include-package=myPackage

If you have absolute file paths for non-py files in your code, you will probably need to modify them to look at the copy in the .dist folder.

Upvotes: -2

Related Questions