Я пытаюсь подключиться к базе данных, используя PyZ3950
в приложении django для извлечения данных. Этот модуль очень старый, и он работает для Python 2, но я не могу найти рабочую версию для Python 3.
https://github.com/danizen/PyZ3950 репо на github удалось портировать приложение, используя 2to3.py
и некоторые изменения вручную, но хотя эта библиотека устанавливается просто отлично, она выдает ошибку PyZ3950.asn1.EncodingError: Bad type to bytes_write
, когда я пытаюсь Connection
метод из zoom
.
Вот полный Traceback:
Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:21:23) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyZ3950 import zoom
>>> conn = zoom.Connection ('z3950.loc.gov', 7090)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "D:\Downloads\Applications\PyZ3950-danizen\PyZ3950-master\PyZ3950\zoom.py", line 276, in __init__
self.connect()
File "D:\Downloads\Applications\PyZ3950-danizen\PyZ3950-master\PyZ3950\zoom.py", line 301, in connect
self._cli = z3950.Client (self.host, self.port,
File "D:\Downloads\Applications\PyZ3950-danizen\PyZ3950-master\PyZ3950\z3950.py", line 510, in __init__
self.initresp = self.transact (
File "D:\Downloads\Applications\PyZ3950-danizen\PyZ3950-master\PyZ3950\z3950.py", line 529, in transact
b = self.encode_ctx.encode (APDU, to_send)
File "D:\Downloads\Applications\PyZ3950-danizen\PyZ3950-master\PyZ3950\asn1.py", line 622, in encode
spec.encode (self, data)
File "D:\Downloads\Applications\PyZ3950-danizen\PyZ3950-master\PyZ3950\asn1.py", line 1192, in encode
ctyp.encode (ctx, val)
File "D:\Downloads\Applications\PyZ3950-danizen\PyZ3950-master\PyZ3950\asn1.py", line 858, in encode
self.typ.encode (ctx, val)
File "D:\Downloads\Applications\PyZ3950-danizen\PyZ3950-master\PyZ3950\asn1.py", line 796, in encode
self.encode_val (ctx, val)
File "D:\Downloads\Applications\PyZ3950-danizen\PyZ3950-master\PyZ3950\asn1.py", line 1504, in encode_val
typ.encode (ctx, v)
File "D:\Downloads\Applications\PyZ3950-danizen\PyZ3950-master\PyZ3950\asn1.py", line 858, in encode
self.typ.encode (ctx, val)
File "D:\Downloads\Applications\PyZ3950-danizen\PyZ3950-master\PyZ3950\asn1.py", line 796, in encode
self.encode_val (ctx, val)
File "D:\Downloads\Applications\PyZ3950-danizen\PyZ3950-master\PyZ3950\asn1.py", line 1089, in encode_val
ctx.bytes_write (val)
File "D:\Downloads\Applications\PyZ3950-danizen\PyZ3950-master\PyZ3950\asn1.py", line 633, in bytes_write
raise EncodingError("Bad type to bytes_write")
PyZ3950.asn1.EncodingError: Bad type to bytes_write