Debugging icatadmin for #305 reveals, the issue occurs in line 117:
if parameters and method == "POST":
conn.send(parameters)
parameters is the result of a urllib.parse.urlencode() call, which returns a string. conn is either a http.client.HTTPConnection or a http.client.HTTPSConnection, conn.send() seem to require a bytes-like object rather than a string (the official Python docu is not very clear in that point, but experiemts confirm this). So the obvious fix is to convert the string to bytes.
Fix #305.
Note that I only implemented a minimal fix. There are other lines of code that feed strings into conn.send(), as in:
icatadmin is awkward and should probably rather be rewritten from scratch.
those lines cited above are actually never executed, because the keyword arguments headers and body to _process() are never used and thus body will always be None.
Debugging
icatadmin
for #305 reveals, the issue occurs in line 117:parameters
is the result of aurllib.parse.urlencode()
call, which returns a string.conn
is either ahttp.client.HTTPConnection
or ahttp.client.HTTPSConnection
,conn.send()
seem to require a bytes-like object rather than a string (the official Python docu is not very clear in that point, but experiemts confirm this). So the obvious fix is to convert the string to bytes.Fix #305.
Note that I only implemented a minimal fix. There are other lines of code that feed strings into
conn.send()
, as in:I didn't bother to fix those, because:
icatadmin
is awkward and should probably rather be rewritten from scratch.headers
andbody
to_process()
are never used and thusbody
will always beNone
.