Skip to content
This repository has been archived by the owner on May 5, 2021. It is now read-only.

LookupError: unknown encoding: cesu-8 #149

Closed
DanieleMele opened this issue Mar 29, 2021 · 7 comments
Closed

LookupError: unknown encoding: cesu-8 #149

DanieleMele opened this issue Mar 29, 2021 · 7 comments

Comments

@DanieleMele
Copy link

Trying to connect to SAP HANA give error:
Traceback (most recent call last):
File "C:\Users\u210990\IdeaProjects\wp3_daten_transfer\lesen_daten_hana.py", line 22, in
connection(host, port, user, pwd, sql)
File "C:\Users\u210990\IdeaProjects\wp3_daten_transfer\lesen_daten_hana.py", line 16, in connection
connection_parameter = pyhdb.connect(host=host_conn, port=port_conn, user=user_conn,
File "c:\devsbb\eaio\python3\lib\site-packages\pyhdb_init_.py", line 30, in connect
conn.connect()
File "c:\devsbb\eaio\python3\lib\site-packages\pyhdb\connection.py", line 141, in connect
agreed_auth_part = self._auth_manager.perform_handshake()
File "c:\devsbb\eaio\python3\lib\site-packages\pyhdb\auth.py", line 50, in perform_handshake
response = self.connection.send_request(request)
File "c:\devsbb\eaio\python3\lib\site-packages\pyhdb\connection.py", line 83, in send_request
payload = message.pack() # obtain BytesIO instance
File "c:\devsbb\eaio\python3\lib\site-packages\pyhdb\protocol\message.py", line 55, in pack
self.build_payload(payload)
File "c:\devsbb\eaio\python3\lib\site-packages\pyhdb\protocol\message.py", line 45, in build_payload
segment.pack(payload, commit=self.autocommit)
File "c:\devsbb\eaio\python3\lib\site-packages\pyhdb\protocol\segments.py", line 94, in pack
self.build_payload(payload)
File "c:\devsbb\eaio\python3\lib\site-packages\pyhdb\protocol\segments.py", line 80, in build_payload
part_payload = part.pack(remaining_size)
File "c:\devsbb\eaio\python3\lib\site-packages\pyhdb\protocol\parts.py", line 103, in pack
arguments_count, payload = self.pack_data(remaining_size - self.header_size)
File "c:\devsbb\eaio\python3\lib\site-packages\pyhdb\protocol\parts.py", line 591, in pack_data
payload = Fields.pack_data(fields)
File "c:\devsbb\eaio\python3\lib\site-packages\pyhdb\protocol\parts.py", line 48, in pack_data
field = field.encode('cesu-8')
LookupError: unknown encoding: cesu-8

I'm not sure if it is related to the python version 3.9?

@julymartiinez
Copy link

I'm also getting the same error.
LookupError: unknown encoding: cesu-8

@skaistory
Copy link

Related with this issue, I opened the PR.
#150
Simple changing the encoding name 'cesu-8' to 'cesu8' might help you.

@yangjinglean
Copy link

I'm also getting the same error, Mac OS Mojave + Python 3.9.0
LookupError: unknown encoding: cesu-8

@ChethanChandra
Copy link

I'm also getting the same error, Mac OS Big Sur 11.2.3 + Python 3.9.0
LookupError: unknown encoding: cesu-8

I dont get where to simply change the encoding name from 'cesu-8' to 'cesu8'.
If its the DB server, my DBA will not budge.

@skaistory
Copy link

@ChethanChandra
You can find what to be changed from this link:
507a105
Apply these changes onto your local repository. And then, install this modified package from your local repo.

@akdor1154
Copy link

workaround without patching:

import pyhdb.cesu8
import codecs
codecs.register(lambda s: (
	pyhdb.cesu8.CESU8_CODEC_INFO
	if s in {'cesu-8', 'cesu_8'}
	else None
))

@bsrdjan
Copy link
Contributor

bsrdjan commented May 4, 2021

Closing due to the sunset of the project. Please check active maintained alternative: https://pypi.org/project/hdbcli/

@bsrdjan bsrdjan closed this as completed May 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants