Hide Forgot
Description of problem: the import DLFCN has been removed from python 3.6 How reproducible: 100 % Steps to Reproduce: 1. run a python pgm that uses PyKde4 Actual results: Traceback (most recent call last): File "./ksokoban-ng.py", line 17, in <module> from PyKDE4.kdecore import ki18n, i18n, KAboutData, KCmdLineArgs, KStandardDirs, KConfig File "/usr/lib64/python3.6/site-packages/PyKDE4/__init__.py", line 1, in <module> import sys,DLFCN ModuleNotFoundError: No module named 'DLFCN' Expected results: ksokoban-ng runs Additional info: DLFCN was removed from python 3.3, as it was undocumented. It contains constant values for dlopen flag values. see: https://bugs.launchpad.net/ubuntu/+source/python3.3/+bug/1075891 I hit it after running Fedora 26 alpha. It did not appear in Fedora 25. ksokoban-ng is a game I like.
This has broken one of my local applications. Ugh. DLFCN was actually removed from python 3.6 upstream, but it can still be generated with h2py. It seems to me as if that should be done as part of the main python package build process, but that would be up to the python maintainers. I guess it they don't want to do so, the python3-pykde4 package could do so. Until then I guess I can stub in a small package which contains it so that I can get my local application working again.
Hacked it in by copying DLFCN.py into /usr/lib64/python3.6, and removing L from some integer constants, because integers default to long in python 3. Now I have a "RuntimeError: PyKDE4.kdeui cannot import type 'QList<QPair<QString,QString> >' from PyQt4.QtCore" to chase.
Yes, that's https://bugzilla.redhat.com/show_bug.cgi?id=1480727
So now that this is the only thing which appears to be holding me back from using PyKDE4 again, I tried to find a reasonable solution. This package could simply generate and include DLFCN.py directly. I guess it would work, but it's mildly hacky. But actually looking at the code, we really only need two things. This is the relevant __init__.py: import sys,DLFCN # This is needed to ensure that dynamic_cast and RTTI works inside kdelibs. sys.setdlopenflags(DLFCN.RTLD_NOW|DLFCN.RTLD_GLOBAL) So, why not just hardcode those two constants? RTLD_NOW = 0x00002 RTLD_GLOBAL = 0x00100 Yeah, it's a hack. You could extract them from /usr/include/bits/dlfcn.h during the build process if there was some concern that they would change, but the entire system would have far bigger problems if that happened. Will attach a patch.
Created attachment 1348657 [details] Patch which should hack around this issue Note that I did test this, but only with python3 as I don't have any python2 code which uses pykde4. I also can't actually build PyKDE4 in mock currently, with or without this patch. I guess I need things from testing.
it's fixed in pykde4-4.14.3-21.fc28. I will push it as update for f26/f27
Thank you, Ngo. I will read the update. I am sure it is better than my hack to __init__.py
Ah, so just removing the change to the ldopen flags is sufficient? I wasn't ever sure if it could break some other component.
It doesn't appear that an update was ever pushed. I see that the change was committed to git (along with another one related to sip-4.19.5) and that a build was done but I don't see any actual update.
pykde4-4.14.3-21.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2018-7ff28c3a4c
pykde4-4.14.3-21.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2018-f91ef4dd4f
pykde4-4.14.3-21.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-f91ef4dd4f
pykde4-4.14.3-21.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-7ff28c3a4c
pykde4-4.14.3-21.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.
pykde4-4.14.3-21.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.
bug has re-appeared in Fedora 30. [hcmeyer@madmax ~]$ ksokobanNg.sh Traceback (most recent call last): File "./ksokoban-ng.py", line 17, in <module> from PyKDE4.kdecore import ki18n, i18n, KAboutData, KCmdLineArgs, KStandardDirs, KConfig File "/usr/lib64/python3.7/site-packages/PyKDE4/__init__.py", line 1, in <module> import sys,DLFCN ModuleNotFoundError: No module named 'DLFCN'
Re-closing as F30 reached EOL on 2020-05-26. This bug got missed because the version was never updated. If the behavior still exists in a supported version of Fedora Linux, please re-open and update the version. If you cannot update the version, please needinfo the assignee.