#2 No module named DenyHosts.python_version


I followed all of the steps for installation from this
site (except the `update-rc.d denyhosts defaults`
command since I'm using CentOS):

I get an error when I try to run DenyHosts:

root@duck [/usr/local/bin]# /etc/init.d/denyhosts start
starting DenyHosts: /usr/bin/env python
/usr/local/bin/denyhosts.py --daemon
Traceback (most recent call last):
File "/usr/local/bin/denyhosts.py", line 5, in ?
import DenyHosts.python_version
ImportError: No module named DenyHosts.python_version

in my /usr/local/bin/denyhosts.py the first line is:

I tried changing this (even to incorrect paths) and I
still get the same error. I know this is the correct path:

root@duck [/usr/local/bin]# ls -la
total 16188
drwxr-xr-x 2 root root 4096 Oct 2 11:13 ./
drwxr-xr-x 21 root root 4096 Sep 29 12:38 ../
-rwxr-xr-x 1 root root 6587 Oct 2 12:17
lrwxrwxrwx 1 root root 19 Jun 18 2005
freshclam -> ../../bin/freshclam*
-rwxr-xr-x 1 root root 96 Sep 5 21:46
-rwxr-xr-x 1 root root 1198 Sep 29 14:05
-rwxr-xr-x 1 root root 28064 Sep 29 14:05
-rwxr-xr-x 1 root root 40349 Sep 29 14:05
-rwxr-xr-x 1 root root 666 Jun 16 2005
lrwxrwxrwx 1 root root 13 Jun 16 2005
perl -> /usr/bin/perl*
-rwxr-xr-x 1 root root 9895926 Jun 17 2005
-rwxr-xr-x 1 root root 1148 Jun 17 2005
-rwxr-xr-x 1 root root 593 Jun 17 2005
-rwxr-xr-x 1 root root 3060 Jun 17 2005
-rwxr-xr-x 1 root root 81 Sep 5 21:46
-rwxr-xr-x 2 root root 2416740 Sep 5 21:46
-rwxr-xr-x 2 root root 2416740 Sep 5 21:46
-rwxr-xr-x 1 root root 18017 Sep 5 21:46
-rwxr-xr-x 1 root root 1673506 Sep 29 14:06

I also tried with /usr/local/bin/python2.4 and get the
same error.

I'm stuck with this error. Any advice would be great.


  • Nobody/Anonymous

    Logged In: NO

    I have the same error. Using Centos with Cpanel.

  • Nobody/Anonymous

    Logged In: NO

    Well, I fixed the problem. Apparently, I had to do this:

    In the daemon-control file, I edited it with this line

    PYTHON_BIN = "/usr/bin/env python"

    changed to

    PYTHON_BIN = "/usr/bin/env python2.4"

    That's all I had to do. No other editing.

    Oh, and a nonrelated issue is in denyhosts.cfg where in stock
    configuration the SECURE_LOG declaration for the Macintosh wasn't
    uncommented. Just added a # to comment out. if you don't,
    you'll get an error that isn't of the focus of this discussion.

  • Apollo

    Apollo - 2006-11-25

    Logged In: YES
    Originator: NO

    I had the same problem, I solved it by executing denyhosts.py explicity "/usr/local/bin/python2.3 /usr/local/bin/denyhosts.py" and that worked then.

  • Mike Robinson

    Mike Robinson - 2006-11-25

    Logged In: YES
    Originator: YES

    Using the suggestion made on 2006-11-08, I got this to work. Thanks for all your comments.

  • Ecki77

    Ecki77 - 2007-05-17

    Logged In: YES
    Originator: NO

    I have the same Problem!
    Installed Python 2.5 and denyhosts 2.6.
    When ich will get started, i became this error:

    starting DenyHosts: /usr/local/bin/python /usr/bin/denyhosts.py --daemon --config=/usr/share/denyhosts/denyhosts.cfg
    Traceback (most recent call last):
    File "/usr/bin/denyhosts.py", line 6, in <module>
    import DenyHosts.python_version
    ImportError: No module named DenyHosts.python_version

    I have changed Line 1&18 to the correkt Files:

    It will not correctly works:(
    The suggestion made on 2006-11-08 will not help me.

    Excuse me for my english;)

  • Paul Franz

    Paul Franz - 2009-03-04

    The error is caused from not having the denyhosts files in the correct directory

    Using the install script provided when you have multiple python installations won't work. For example it did this:


    When it should have done this:


    I have modified the README.txt file to reflect what worked for me.
    and modified the answer to FAQ question 1.9:

    I also wrote the author but have not received a response.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks