newbie needs help building Python 2.5 for Fedora Core 6

Discussion in 'Python' started by bobmon, Feb 24, 2007.

  1. bobmon

    bobmon Guest

    Hello, and please be gentle...

    I'm trying to build Python 2.5 on my Fedora Core 6 installation. I
    think I've resolved most of my problems, but "make test" reports an
    error for test_socket.py, shown below.

    I suppose my FC6 installation is missing something, but I have no idea
    what. Any ideas, directions, pointers would be most appreciated.



    ======================================================================
    ERROR: testSockName (__main__.GeneralModuleTests)

    ----------------------------------------------------------------------
    Traceback (most recent call last):
    File "./Lib/test/test_socket.py", line 456, in testSockName
    my_ip_addr = socket.gethostbyname(socket.gethostname())
    gaierror: (-2, 'Name or service not known')


    ----------------------------------------------------------------------
    Ran 66 tests in 35.478s

    FAILED (errors=1)
    Traceback (most recent call last):
    File "./Lib/test/test_socket.py", line 962, in <module>
    test_main()
    File "./Lib/test/test_socket.py", line 958, in test_main
    test_support.run_unittest(*tests)
    File "/home/Installer/Python/Python-2.5/Lib/test/test_support.py",
    line 441, in run_uni
    ttest
    run_suite(suite, testclass)
    File "/home/Installer/Python/Python-2.5/Lib/test/test_support.py",
    line 426, in run_sui
    te
    raise TestFailed(err)
    test.test_support.TestFailed: Traceback (most recent call last):
    File "./Lib/test/test_socket.py", line 456, in testSockName
    my_ip_addr = socket.gethostbyname(socket.gethostname())
    gaierror: (-2, 'Name or service not known')
    bobmon, Feb 24, 2007
    #1
    1. Advertising

  2. bobmon

    Tony Nelson Guest

    In article <>,
    "bobmon" <> wrote:

    > Hello, and please be gentle...
    >
    > I'm trying to build Python 2.5 on my Fedora Core 6 installation. I
    > think I've resolved most of my problems, but "make test" reports an
    > error for test_socket.py, shown below.
    >
    > I suppose my FC6 installation is missing something, but I have no idea
    > what. Any ideas, directions, pointers would be most appreciated.
    >
    >
    >
    > ======================================================================
    > ERROR: testSockName (__main__.GeneralModuleTests)
    >
    > ----------------------------------------------------------------------
    > Traceback (most recent call last):
    > File "./Lib/test/test_socket.py", line 456, in testSockName
    > my_ip_addr = socket.gethostbyname(socket.gethostname())
    > gaierror: (-2, 'Name or service not known')
    >
    >
    > ----------------------------------------------------------------------
    > Ran 66 tests in 35.478s
    >
    > FAILED (errors=1)
    > Traceback (most recent call last):
    > File "./Lib/test/test_socket.py", line 962, in <module>
    > test_main()
    > File "./Lib/test/test_socket.py", line 958, in test_main
    > test_support.run_unittest(*tests)
    > File "/home/Installer/Python/Python-2.5/Lib/test/test_support.py",
    > line 441, in run_uni
    > ttest
    > run_suite(suite, testclass)
    > File "/home/Installer/Python/Python-2.5/Lib/test/test_support.py",
    > line 426, in run_sui
    > te
    > raise TestFailed(err)
    > test.test_support.TestFailed: Traceback (most recent call last):
    > File "./Lib/test/test_socket.py", line 456, in testSockName
    > my_ip_addr = socket.gethostbyname(socket.gethostname())
    > gaierror: (-2, 'Name or service not known')


    OK, so this fails:

    my_ip_addr = socket.gethostbyname(socket.gethostname())

    Try it from the python command line. This is what happens when I try it
    on FC6 w/ Python 2.5 (retyped, tho):

    >>> import socket
    >>> socket.gethostname()

    'localhost.localdomain'
    >>> socket.gethostbyname(_)

    '127.0.0.1'
    >>>

    ________________________________________________________________________
    TonyN.:' *firstname*nlsnews@georgea*lastname*.com
    ' <http://www.georgeanelson.com/>
    Tony Nelson, Feb 24, 2007
    #2
    1. Advertising

  3. bobmon

    bobmon Guest

    WOW. I'm gobsmacked...

    On Feb 24, 6:13 pm, Tony Nelson
    <*firstname*nlsnews@georgea*lastname*.com> wrote:
    >
    > Try it from the python command line. This is what happens when I try it



    Okay, that was interesting...

    Apparently there's a subtlety of /etc/hosts that affects this!
    Originally it had this line:
    127.0.0.1 localhost localhost.localdomain foobar
    and I get this result for my machine ("foobar.foodomain.com"):
    >>>
    >>> import socket
    >>> socket.gethostname()

    'foobar.foodomain.com'
    >>> socket.gethostbyname(_)

    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    socket.gaierror: (-2, 'Name or service not known')
    >>>
    >>>
    >>> socket.gethostbyname('localhost')

    '127.0.0.1'
    >>> socket.gethostbyname('localhost.localdomain')

    '127.0.0.1'
    >>>


    Whe I change /etc/hosts to this:
    127.0.0.1 foobar foobar.foodomain.net
    localhost.localdomain localhost
    Python is happy and I get;
    >>>
    >>> import socket
    >>> socket.gethostname()

    'foobar.foodomain.net'
    >>> socket.gethostbyname(_)

    '127.0.0.1'
    >>>



    So, problem "fixed" although I have no real understanding of what was
    wrong or what's right now.
    Only that "gethostbyname()" seems to be really sensitive to the format
    of the /etc/hosts file.

    Thank you, Tony Nelson.
    -Bob Montante, -bob,mon.
    bobmon, Feb 25, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Trent

    JAR help in FEDORA CORE 2

    Trent, May 27, 2004, in forum: Java
    Replies:
    1
    Views:
    395
    David Lesaffre
    May 28, 2004
  2. Thomas
    Replies:
    1
    Views:
    387
    Rob Renaud
    Nov 19, 2003
  3. Logan
    Replies:
    4
    Views:
    464
  4. J Dubal
    Replies:
    2
    Views:
    317
    J Dubal
    Oct 2, 2004
  5. Replies:
    0
    Views:
    301
Loading...

Share This Page