Some errors when running code in diveintopython: (

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • iclinux@gmail.com

    #1

    Some errors when running code in diveintopython: (

    Environment:
    WinXP SP2 + Python 2.4.2, with SOAPpy-0.11.6.zip, fpconst-0.7.2.zip,
    and PyXML-0.8.4.win32-py2.4.exe installed.

    Problem:
    I'm reading DiveIntoPython these days. When running code of "Example
    12.11. Calling A Web Service Through A WSDL Proxy", I got some errors
    as follow. Will you please give me some suggestion?

    IDLE 1.1.2's Output:[color=blue][color=green][color=darkred]
    >>> from SOAPpy import WSDL
    >>> wsdlFile = 'http://www.xmethods.ne t/sd/2001/TemperatureServ ice.wsdl'
    >>> server = WSDL.Proxy(wsdl File)
    >>> server.methods. keys()[/color][/color][/color]
    [u'getTemp'][color=blue][color=green][color=darkred]
    >>> server.getTemp( '90210')[/color][/color][/color]

    Traceback (most recent call last):
    File "<pyshell#4 >", line 1, in -toplevel-
    server.getTemp( '90210')
    File "E:\Program Files\Python\Li b\site-packages\SOAPpy \Client.py",
    line 453, in __call__
    return self.__r_call(* args, **kw)
    File "E:\Program Files\Python\Li b\site-packages\SOAPpy \Client.py",
    line 475, in __r_call
    self.__hd, self.__ma)
    File "E:\Program Files\Python\Li b\site-packages\SOAPpy \Client.py",
    line 347, in __call
    config = self.config)
    File "E:\Program Files\Python\Li b\site-packages\SOAPpy \Client.py",
    line 187, in call
    r.endheaders()
    File "E:\Program Files\Python\li b\httplib.py", line 795, in
    endheaders
    self._send_outp ut()
    File "E:\Program Files\Python\li b\httplib.py", line 676, in
    _send_output
    self.send(msg)
    File "E:\Program Files\Python\li b\httplib.py", line 643, in send
    self.connect()
    File "E:\Program Files\Python\li b\httplib.py", line 611, in connect
    socket.SOCK_STR EAM):
    gaierror: (11001, 'getaddrinfo failed')[color=blue][color=green][color=darkred]
    >>>[/color][/color][/color]

  • Fredrik Lundh

    #2
    Re: Some errors when running code in diveintopython: (

    iclinux@gmail.c om wrote:
    [color=blue]
    > I'm reading DiveIntoPython these days. When running code of "Example
    > 12.11. Calling A Web Service Through A WSDL Proxy", I got some errors
    > as follow. Will you please give me some suggestion?[/color]
    [color=blue]
    > gaierror: (11001, 'getaddrinfo failed')[/color]

    this usually means that your computer (or your nameserver) have problems
    looking up the host name. it's not a python problem.

    have you checked your firewall settings (and/or firewall logs) ?

    can you reach www.xmethods.net and services.xmetho ds.net from your
    browser?

    what happens if you do
    [color=blue][color=green][color=darkred]
    >>> import socket
    >>> socket.getaddri nfo("www.xmetho ds.net", 80)
    >>> socket.getaddri nfo("services.x methods.net", 80)[/color][/color][/color]

    ?

    </F>



    Comment

    • iclinux@gmail.com

      #3
      Re: Some errors when running code in diveintopython: (

      I can visit those two websites above, but when I run your code, I get
      those errors(BTW,I have closed my firewall
      ):
      [color=blue][color=green][color=darkred]
      >>> import socket
      >>> socket.getaddri nfo("www.xmetho ds.net", 80)[/color][/color][/color]

      Traceback (most recent call last):
      File "<pyshell#1 >", line 1, in -toplevel-
      socket.getaddri nfo("www.xmetho ds.net", 80)
      gaierror: (11001, 'getaddrinfo failed')[color=blue][color=green][color=darkred]
      >>> socket.getaddri nfo("services.x methods.net", 80)[/color][/color][/color]

      Traceback (most recent call last):
      File "<pyshell#2 >", line 1, in -toplevel-
      socket.getaddri nfo("services.x methods.net", 80)
      gaierror: (11001, 'getaddrinfo failed')[color=blue][color=green][color=darkred]
      >>>[/color][/color][/color]

      what can I do?

      Comment

      • Istvan Albert

        #4
        Re: Some errors when running code in diveintopython: (


        must be something with your settings ...

        I remeber once I had truly puzzling problem that manifested itself the
        same way ... Firefox and cygwin python would work fine but the windows
        python would raise errors when trying to connect via http ...

        .... finally I realized that the day before IE was set to use a proxy
        server ( to capture traffic for testing but the proxy was not on that
        moment) ... I know little on how Windows works but it was quite a
        surprise that setting IE to work some way had some unwanted
        reprecussions somewhere else ...

        Comment

        • David  Wahler

          #5
          Re: Some errors when running code in diveintopython: (

          Istvan Albert wrote:[color=blue]
          > I remeber once I had truly puzzling problem that manifested itself the
          > same way ... Firefox and cygwin python would work fine but the windows
          > python would raise errors when trying to connect via http ...
          >
          > ... finally I realized that the day before IE was set to use a proxy
          > server ( to capture traffic for testing but the proxy was not on that
          > moment) ... I know little on how Windows works but it was quite a
          > surprise that setting IE to work some way had some unwanted
          > reprecussions somewhere else ...[/color]

          See the documentation for urllib.urlopen:

          """
          In a Windows environment, if no proxy environment variables are set,
          proxy settings are obtained from the registry's Internet Settings
          section.
          """

          -- David

          Comment

          • beryan

            #6
            Re: Some errors when running code in diveintopython: (

            El Fri, 23 Dec 2005 05:18:30 -0800, iclinux escribió:
            [color=blue]
            > I can visit those two websites above, but when I run your code, I get
            > those errors(BTW,I have closed my firewall
            > ):
            >[color=green][color=darkred]
            >>>> import socket
            >>>> socket.getaddri nfo("www.xmetho ds.net", 80)[/color][/color]
            >
            > Traceback (most recent call last):
            > File "<pyshell#1 >", line 1, in -toplevel-
            > socket.getaddri nfo("www.xmetho ds.net", 80)
            > gaierror: (11001, 'getaddrinfo failed')[color=green][color=darkred]
            >>>> socket.getaddri nfo("services.x methods.net", 80)[/color][/color]
            >
            > Traceback (most recent call last):
            > File "<pyshell#2 >", line 1, in -toplevel-
            > socket.getaddri nfo("services.x methods.net", 80)
            > gaierror: (11001, 'getaddrinfo failed')[color=green][color=darkred]
            >>>>[/color][/color]
            >
            > what can I do?[/color]


            Have you got a Firewall ?
            Take a look over firewall settings and give Python rights for accesing
            port 80

            Comment

            • Heiko Wundram

              #7
              Re: Some errors when running code in diveintopython: (

              beryan wrote:[color=blue]
              > El Fri, 23 Dec 2005 05:18:30 -0800, iclinux escribió:[color=green]
              >> gaierror: (11001, 'getaddrinfo failed')[/color]
              > Take a look over firewall settings and give Python rights for accesing
              > port 80[/color]

              Well, rather he should take a look at allowing Python to resolve host names.
              That's what this error is about.

              --- Heiko.

              Comment

              • iclinux@gmail.com

                #8
                Re: Some errors when running code in diveintopython: (

                thanks all ! I've solved this problem:

                Let me show my net environment first. My pc is in a local network, and
                through a proxy server can I reach the Internet, so I changed my
                Internet Settings.

                It seems that everything goes well, I can surf Internet, etc, but what
                a pity, I can't resolve a host's address by its name by gethostbyname()
                in C Language; in python, socket.getaddri nfo() will fail.

                So today, I installed MSFireWallClien t which will connect to the ISA
                server. and after that, everything works: )

                Thanks again, Merry Christmas and a Happy New Year!!

                Comment

                Working...