+++ This bug was initially created as a clone of Bug #1358339 +++ Please see Bug #1358339 for full history.
A workaround in some previous versions used to be to install python2-dnf. Now (FC26) it's not any more. Idan Shaby reported that installing "*python2-dnf*" is enough.
Looked at this some more. Still not sure what made comment 1 work. Fedora 26 ships with dnf-2, that is not supported by otopi yet, see bug 1455452. So even if it "works", it works with (the now deprecated) yum, not dnf. I think that in itself might be a bug in dnf, didn't try to investigate further yet. Might be related to: https://github.com/rpm-software-management/dnf/pull/641
Closing old bugs. Please reopen if still relevant. Patches are welcomed.