无法从python连接到neos服务器-WinError 10060

时间:2018-11-07 08:06:36

标签: python neos-server

我正在努力将XML-RPC接口与Neos服务器一起使用。我想从Python脚本运行AMPL代码。我下载了NeosClient.py(https://github.com/NEOS-Server/PythonClient),并试图在Jupyter笔记本中运行以下代码:

!python C:/PythonClient-master/NeosClient.py example.xml

其中example.xml包含示例.mod和.dat文件的位置:

<document>
<category>milp</category>
<solver>CPLEX</solver>
<inputMethod>AMPL</inputMethod>

<model> 
<!CDATA[C:/amplide.mswin64/models/diet.mod]]> 
</model>

<data><![CDATA[C:/amplide.mswin64/models/diet.dat]]></data>

<commands><![CDATA[C:/amplide.mswin64/models/diet.run]]></commands>

</document>

我遇到错误:

Traceback (most recent call last):
  File "C:/PythonClient-master/NeosClient.py", line 45, in <module>
    alive = neos.ping()
  File "C:\.julia\v0.6\Conda\deps\usr\lib\xmlrpc\client.py", line 1112, in 
__call__
   return self.__send(self.__name, args)
  File "C:\.julia\v0.6\Conda\deps\usr\lib\xmlrpc\client.py", line 1452, in 
__request
    verbose=self.__verbose
  File "C:\.julia\v0.6\Conda\deps\usr\lib\xmlrpc\client.py", line 1154, in request
    return self.single_request(host, handler, request_body, verbose)
  File "C:\.julia\v0.6\Conda\deps\usr\lib\xmlrpc\client.py", line 1166, in single_request
    http_conn = self.send_request(host, handler, request_body, verbose)
  File "C:\.julia\v0.6\Conda\deps\usr\lib\xmlrpc\client.py", line 1279, in send_request
    self.send_content(connection, request_body)
  File "C:\.julia\v0.6\Conda\deps\usr\lib\xmlrpc\client.py", line 1309, in send_content
    connection.endheaders(request_body)
  File "C:\.julia\v0.6\Conda\deps\usr\lib\http\client.py", line 1234, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "C:\.julia\v0.6\Conda\deps\usr\lib\http\client.py", line 1026, in _send_output
    self.send(msg)
  File "C:\.julia\v0.6\Conda\deps\usr\lib\http\client.py", line 964, in send
    self.connect()
  File "C:\.julia\v0.6\Conda\deps\usr\lib\http\client.py", line 1392, in connect
    super().connect()
  File "C:\.julia\v0.6\Conda\deps\usr\lib\http\client.py", line 936, in connect
    (self.host,self.port), self.timeout, self.source_address)
 File "C:\.julia\v0.6\Conda\deps\usr\lib\socket.py", line 724, in create_connection
    raise err
  File "C:\.julia\v0.6\Conda\deps\usr\lib\socket.py", line 713, in create_connection
    sock.connect(sa)
TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

我还尝试从anaconda控制台运行脚本并单独ping服务器,效果相同。我猜可能是我的计算机阻止了连接到服务器-我该如何验证呢?我正在使用Windows 10(64位)

0 个答案:

没有答案