本文介绍了ValueError:无效的标头值"H2O Python客户端/2.7.9(默认值,2015年4月2日,15:33:21)\ n [GCC 4.9.2]"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试从Python初始化H2O.我正在使用python 2.7.9.我按照以下步骤获取了h2o python模块:
I am trying to initialize H2O from Python. I am using python 2.7.9.I followed the steps below to get h2o python module:
pip install requests
pip install tabulate
# Remove any preexisiting H2O module.
pip uninstall h2o
# Next, use pip to install this version of the H2O Python module.
pip install http://h2o-release.s3.amazonaws.com/h2o-dev/master/1109/Python/h2o-0.3.0.1109-py2.py3-none-any.whl
调用h2o.init()时出现此错误.
I get this error when I call h2o.init().
No instance found at ip and port: localhost:54321. Trying to start local jar...
No jar file found. Could not start local instance.
Traceback (most recent call last):
File "abc.py", line 3, in <module>
h2o.init()
File "/usr/local/lib/python2.7/dist-packages/h2o/h2o.py", line 229, in init
H2OConnection(ip=ip, port=port)
File "/usr/local/lib/python2.7/dist-packages/h2o/connection.py", line 64, in __init__
cld = self._connect(size)
File "/usr/local/lib/python2.7/dist-packages/h2o/connection.py", line 113, in _connect
cld = H2OConnection.get_json(url_suffix="Cloud")
File "/usr/local/lib/python2.7/dist-packages/h2o/connection.py", line 324, in get_json
return __H2OCONN__._rest_json(url_suffix, "GET", None, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/h2o/connection.py", line 333, in _rest_json
raw_txt = self._do_raw_rest(url_suffix, method, file_upload_info, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/h2o/connection.py", line 366, in _do_raw_rest
http_result = self._attempt_rest(url, method, post_body, file_upload_info)
File "/usr/local/lib/python2.7/dist-packages/h2o/connection.py", line 394, in _attempt_rest
return requests.get(url, headers=headers)
File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 69, in get
return request('get', url, params=params, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 50, in request
response = session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 468, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 576, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 370, in send
timeout=timeout
File "/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py", line 559, in urlopen
body=body, headers=headers)
File "/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py", line 353, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/lib/python2.7/httplib.py", line 1048, in request
self._send_request(method, url, body, headers)
File "/usr/lib/python2.7/httplib.py", line 1087, in _send_request
self.putheader(hdr, value)
File "/usr/lib/python2.7/httplib.py", line 1026, in putheader
raise ValueError('Invalid header value %r' % (one_value,))
ValueError: Invalid header value 'H2O Python client/2.7.9 (default, Apr 2 2015, 15:33:21) \n[GCC 4.9.2]'
请帮助我.预先感谢.
Please help me.Thanks in advance.
推荐答案
感谢Spencer Aiello帮助解决该问题.我正在使用旧版本的H2O.现在,我使用的是最新版本的H2O:
Thanks Spencer Aiello for helping to fix the problem.I was using an older version of H2O. Now I got the latest version of H2O using:
pip install http://h2o-release.s3.amazonaws.com/h2o/rel-slater/9/Python/h2o-3.2.0.9-py2.py3-none-any.whl
它修复了该错误.
这篇关于ValueError:无效的标头值"H2O Python客户端/2.7.9(默认值,2015年4月2日,15:33:21)\ n [GCC 4.9.2]"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!