[Zope] Error: gaierror: (-2, 'Name or service not known')

Martijn Pieters mj at zopatista.com
Tue Mar 14 04:43:30 EST 2006


On 3/13/06, Martin Koekenberg <martin at digital-adventures.nl> wrote:
> Module OFS.Image, line 269, in      _range_request_handler
> Module mimetools, line 130, in      choose_boundary
>
> gaierror: (-2, ' Name of service not known ')

In order to send partial responses (such as Acrobat Reader might issue
for a web-optimized PDF), the File object uses the
mimetypes.choose_boundary method to serve multiple such partial
responses.

The choose_boundary method, in turn, attempts to generate a unique
boundary string, and uses various OS parameters to do so. One of these
is the ip address of the host, which choose_boundary obtains by
looking at the current hostname, then asking for the ip address
belonging to that hostname. The latter step fails.

You can reproduce this by opening a python interpreter prompt and
typing the following:

    >>> import socket
    >>> hostname = socket.gethostname()
    >>> print hostname
    yourhostnamehere
    >>> socket.gethostbyname(hostname)
    'your.ip.address.here'

The latter will probably throw the same error as above. To fix this
you'll have to either bug your system admin, or acquire enough UNIX
sysop knowledge to fix the problem yourself. I suspect that the
hostname has no DNS entry anywhere; adding it to /etc/hosts should be
enough.

--
Martijn Pieters


More information about the Zope mailing list