Search code examples
python-2.7importerror

Import error for asynchat and asyncore in Python 2.7.3


I am using ARM Cortex-A9 processor with Linux Ångström distribution. I have Python 2.7.3 which I have built using Openembedded project.

I am trying to use Supervisord process monitor on my system, but when I try to run the same, it gives following error:

root@myDevice:~# supervisord Traceback (most recent call last): File "/usr/lib/python2.7/asynchat.py", line 52, in ImportError: No module named asyncore

I understand that my installed python package is probably incomplete and I will need to install packages to take care of this. I have opkg and pip which I use to install packages.

The question is:

Which package do I need to install so that the asyncore and asynchat modules will become available to my system.


Solution

  • assuming that you already have asynchat.py in you lib module just try to make a new file in /usr/lib/python2.7 name it asyncore.py and insert this: https://hg.python.org/cpython/file/2.7/Lib/asyncore.py inside it.

    note that you need to be system administrator. use it in bash terminal like:

    $ cd /usr/lib/python2.7
    $ ls => to check if you are in the correct lib
    $ nano asyncore.py => you can use any other text editor available in your system.
    copy paste the module inside it and save.

    Note:

    Check again if there is asynchat.py and asyncore.py in your lib using:
    $ ls