Jump to content

Photo

Python qt4-designer - pyuic4 - No module named DLFCN [Solution Found]


  • Please log in to reply
3 replies to this topic

#1 PatE

PatE

    Member

  • Members
  • 4 posts
  • LocationNSW, Australia

Posted 15 February 2012 - 03:10 AM

Hi
I've installed qt4-designer qt4-doc-html pyqt4-dev-tools with apt-get.
When I try to run pyuic4 I get:

tal:~/prog/sc$ pyuic4 -d form-main.ui
< snipped>
File "/usr/lib/pymodules/python2.6/PyKDE4/__init__.py", line 1, in <module>
import sys,DLFCN
ImportError: No module named DLFCN

From the python prompt, import DLFCN or sys.DLFCN reports No module named DLFCN

This may?? be related to:
http://bugs.python.org/issue12571
http://bugs.python.org/issue12326

Any ideas would be appreciated.
Thanks

Python 2.6.6 (r266:84292, Jan 3 2012, 04:14:00)
pyuic4 --version : Python User Interface Compiler 4.7.2 for Qt version 4.6.2
Linux f9 3.2.0-11-generic-pae



A big thank you to everyone who contributes to Bodhi Linux


#2 ylee

ylee

    King of the Software Page

  • Moderators
  • 1585 posts
  • LocationSouth Carolina, USA

Posted 15 February 2012 - 03:39 PM

What a mess :unsure:

It does seem this is probably related to the links you give. Spending too much time googling around it seems this module DLFCN should be installed but is not built properly building python using a 3.x kernel. I have limited experience here and this is out of my comfort zone, so I may not know what I am talking about.

A possible work around:

I noticed in the python documentation:

If DLFCN is not available, it can be generated from /usr/include/dlfcn.h using the h2py script.


Sounds very promising until I check my system out and the only h2py.py script I have is on my windows partition (for python 2.7) :blink: Since I have 2.6.6 I wasn't sure this was the same file I needed so I looked around and found the source code for python 2.6.6 and the script is in /Python-2.6.6/Tools/scripts/

I extracted it and then ran

./h2py.py /usr/include/dlfcn.h

and that created the file DLFCN.py which I moved to /usr/share/pyshared

Now at least I can do the import DLFCN in python with no errors.

However: I am not familiar with the qt4-designer stuff nor the pyuic4 command (script ?) So I make no promises that pyuic4 will run correctly after doing this. Please let us know if this works for you.

Note: I consider this a bug with our python2.6 package so I am moving this to Bug Reports as I want to ensure Jeff sees it. Maybe Jeff can fix the python 2.6 package. If Jeff or other mods do not consider this a bug then feel free to move it back to support.

"No technology can ever be too arcane or complicated for the black t-shirt crowd."


#3 PatE

PatE

    Member

  • Members
  • 4 posts
  • LocationNSW, Australia

Posted 16 February 2012 - 02:32 AM

You are a champion, Thanks!

I followed your instructions and pyuic4 works.The only difference was that I copied module the into /usr/lib/python2.6/plat-linux3/DLFCN.py as it seemed appropriate when compared with other distros (see below).
My Bodhi has had a 3 kernel since birth, I suppose this is why I don't have a plat-linux2 dir in lib/python.
By the way, this is what I've found on some other boxes:
Debian Squeeze - 2.6 kernel - /usr/lib/python2.6/plat-linux2/DLFCN.py
Debian wheezy - 3.0 kernel, was 2.6 at install - /usr/lib/python2.7/plat-linux2/DLFCN.py and /usr/lib/python2.6/plat-linux2/DLFCN.py
Thanks again for your time.
Pat

#4 ylee

ylee

    King of the Software Page

  • Moderators
  • 1585 posts
  • LocationSouth Carolina, USA

Posted 16 February 2012 - 02:23 PM

You are a champion, Thanks!

I followed your instructions and pyuic4 works.The only difference was that I copied module the into /usr/lib/python2.6/plat-linux3/DLFCN.py as it seemed appropriate when compared with other distros ...


Fantastic :P

You are right as to the location, that does seem more standard. I just stuck the module someplace I knew python would find it to make sure it in fact worked and didn't throw any errors on import ;)

"No technology can ever be too arcane or complicated for the black t-shirt crowd."





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users