-
-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when update data to Windows client #257
Comments
It looks like your change to pywwt is the correct one to make. After you have done that, I suspect that WWT's internal code is unable to handle the Chinese characters in your text overlay, which is causing an error that causes it to close the connection to your Python program. If you are able to launch WWT with logging enabled, you may be able to get some more information about where exactly the problem is. But this might require a debugger to figure out. |
Thanks for your reply. I will try it later. |
when I update this data
Geometry
——————
TEXT("你好",2,121 -69)
to a layer in Windows client use
WWTLayer.update()
, I encounter the following Error:`UnicodeEncodeError: 'latin-1' codec can't encode characters in position 311-312: Body ('你好') is not valid Latin-1. Use body.encode('utf-8') if you want to send it encoded in UTF-8.
But it's OK when I use English data.
Geometry
———————
TEXT("hello",2,121 -69)
`
I try to modified the
updat function
in 'Lib\site-packages\pywwt\windows\layer.py'u = requests.post(self.wwt.wwt_url, params=params, data=data_string)
to
u = requests.post(self.wwt.wwt_url, params=params, data=data_string.encode('utf-8'))
Then run my code. It will stuck for a while and encounter another Error:
Traceback (most recent call last):
File "D:\Tools\Visual Studio 2017\Shared\Python36_64\lib\site-packages\urllib3\connectionpool.py", line 672, in urlopen
chunked=chunked,
File "D:\Tools\Visual Studio 2017\Shared\Python36_64\lib\site-packages\urllib3\connectionpool.py", line 421, in _make_request
six.raise_from(e, None)
File "", line 3, in raise_from
File "D:\Tools\Visual Studio 2017\Shared\Python36_64\lib\site-packages\urllib3\connectionpool.py", line 416, in _make_request
httplib_response = conn.getresponse()
File "D:\Tools\Visual Studio 2017\Shared\Python36_64\lib\http\client.py", line 1331, in getresponse
response.begin()
File "D:\Tools\Visual Studio 2017\Shared\Python36_64\lib\http\client.py", line 297, in begin
version, status, reason = self._read_status()
File "D:\Tools\Visual Studio 2017\Shared\Python36_64\lib\http\client.py", line 258, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "D:\Tools\Visual Studio 2017\Shared\Python36_64\lib\socket.py", line 586, in readinto
return self._sock.recv_into(b)
ConnectionResetError: [WinError 10054] remote host forced closed an occoured connection.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\Tools\Visual Studio 2017\Shared\Python36_64\lib\site-packages\requests\adapters.py", line 449, in send
timeout=timeout
File "D:\Tools\Visual Studio 2017\Shared\Python36_64\lib\site-packages\urllib3\connectionpool.py", line 720, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "D:\Tools\Visual Studio 2017\Shared\Python36_64\lib\site-packages\urllib3\util\retry.py", line 400, in increment
raise six.reraise(type(error), error, _stacktrace)
File "D:\Tools\Visual Studio 2017\Shared\Python36_64\lib\site-packages\urllib3\packages\six.py", line 734, in reraise
raise value.with_traceback(tb)
File "D:\Tools\Visual Studio 2017\Shared\Python36_64\lib\site-packages\urllib3\connectionpool.py", line 672, in urlopen
chunked=chunked,
File "D:\Tools\Visual Studio 2017\Shared\Python36_64\lib\site-packages\urllib3\connectionpool.py", line 421, in _make_request
six.raise_from(e, None)
File "", line 3, in raise_from
File "D:\Tools\Visual Studio 2017\Shared\Python36_64\lib\site-packages\urllib3\connectionpool.py", line 416, in _make_request
httplib_response = conn.getresponse()
File "D:\Tools\Visual Studio 2017\Shared\Python36_64\lib\http\client.py", line 1331, in getresponse
response.begin()
File "D:\Tools\Visual Studio 2017\Shared\Python36_64\lib\http\client.py", line 297, in begin
version, status, reason = self._read_status()
File "D:\Tools\Visual Studio 2017\Shared\Python36_64\lib\http\client.py", line 258, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "D:\Tools\Visual Studio 2017\Shared\Python36_64\lib\socket.py", line 586, in readinto
return self._sock.recv_into(b)
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(10054, 'remote host forced closed an occoured connection.', None, 10054, None))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "", line 2, in
File "D:\Tools\Visual Studio 2017\Shared\Python36_64\lib\site-packages\pywwt\windows\layer.py", line 167, in update
u = requests.post(self.wwt.wwt_url, params=params, data=data_string.encode('utf-8'))
File "D:\Tools\Visual Studio 2017\Shared\Python36_64\lib\site-packages\requests\api.py", line 116, in post
return request('post', url, data=data, json=json, **kwargs)
File "D:\Tools\Visual Studio 2017\Shared\Python36_64\lib\site-packages\requests\api.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "D:\Tools\Visual Studio 2017\Shared\Python36_64\lib\site-packages\requests\sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "D:\Tools\Visual Studio 2017\Shared\Python36_64\lib\site-packages\requests\sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "D:\Tools\Visual Studio 2017\Shared\Python36_64\lib\site-packages\requests\adapters.py", line 498, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(10054, 'remote host forced closed an occoured connection.', None, 10054, None))
The text was updated successfully, but these errors were encountered: