Python异常:错误:[Errno 10054]远程主机强制关闭现有连接

时间:2015-01-26 02:35:32

标签: python exception error-handling prediction

我最近安装了预测有关流浪盒的建议。我对它很新。当我尝试运行其python示例文件import_eventserver时,我遇到以下错误:

C:\HashiCorp\Vagrant\PredictionIO-Vagrant-0.8.2\MyRecommendation>python data/imp
ort_eventserver.py --access_key some_access_key
Namespace(access_key='some_access_key', file='./data/sample_movielens_data.txt', url='http://localhost:7070')

导入数据......

Traceback (most recent call last):
  File "data/import_eventserver.py", line 76, in <module>
    import_events(client, args.file)
  File "data/import_eventserver.py", line 45, in import_events
    target_entity_id=data[1]
  File "C:\Anaconda\lib\site-packages\predictionio-0.8.3-py2.7.egg\predictionio\
__init__.py", line 243, in create_event
    event_time).get_response()
  File "C:\Anaconda\lib\site-packages\predictionio-0.8.3-py2.7.egg\predictionio\
connection.py", line 113, in get_response
    self._response = self.rfunc(tmp_response)
  File "C:\Anaconda\lib\site-packages\predictionio-0.8.3-py2.7.egg\predictionio\
__init__.py", line 120, in _acreate_resp
    (response.error, response.request))
predictionio.NotCreatedError: Exception happened: [Errno 10054] An existing conn
ection was forcibly closed by the remote host for request POST /events.json?acce
ssKey=some_access_key {'eventTime': '2015-01-26T02:16:36.285+0000', 'entityType': 'user', 'targetEntityType': '
item', 'targetEntityId': '2', 'entityId': '0', 'event': 'buy'} /events.json?acce
ssKey=enFymhjuV3ighOz9R3u3FuiWSHNgWch241WbaTaXpdXyNJbKp5tYWO5IplkxUvR7?eventTime
=2015-01-26T02%3A16%3A36.285%2B0000&entityType=user&targetEntityType=item&target
EntityId=2&entityId=0&event=buy

关于如何知道这里错误的任何想法?任何帮助表示赞赏。

2 个答案:

答案 0 :(得分:0)

此错误与Prediction IO API无关。您收到的错误消息显示从连接池中提取连接,并且与服务器的连接已丢失。 错误是否可重现?你有没有网络问题?请检查组件之间的网络连接。 我刚尝试并在Mac上安装了带有Python的Vagrant,一切都运行良好..

答案 1 :(得分:0)

我认为需要以下命令才能解决此错误。当您在VM中运行PIO事件服务器或部署引擎时,您需要指定“--ip 0.0.0.0”以便从主机访问事件服务器和已部署的引擎:

运行eventserver: $ pio eventserver --ip 0.0.0.0

部署引擎: $ pio deploy --ip 0.0.0.0