It fails signing when looking message lines in python3
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
dkimpy |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
>>> import dkim
>>> dkim_header = dkim.sign('hola', 'asd', 'pablo.com', 'asd')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/
d = DKIM(message,
File "/usr/local/
self.
File "/usr/local/
self.headers, self.body = rfc822_
File "/usr/local/
lines = re.split(b"\r?\n", message)
File "/usr/local/
return _compile(pattern, flags).
TypeError: can't use a bytes pattern on a string-like object
>>> lines = re.split(b"\r?\n", 'hola')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/
return _compile(pattern, flags).
TypeError: can't use a bytes pattern on a string-like object
The problem seems that line:
lines = re.split(b"\r?\n", message)
while this doesn't fails:
>>> import re
>>> lines = re.split("\r?\n", 'hola')
>>> print(lines)
I've already testes this:
dkim_header = dkim.sign(b'hola', 'asd', 'pablo.com', 'asd')
but it gives me the following error:
>>> dkim_header = dkim.sign(b'hola', 'asd', 'pablo.com', 'asd') lib/python3. 4/site- packages/ dkim/__ init__. py", line 591, in sign logger= logger) lib/python3. 4/site- packages/ dkim/__ init__. py", line 294, in __init__ set_message( message) lib/python3. 4/site- packages/ dkim/__ init__. py", line 334, in set_message parse(message) lib/python3. 4/site- packages/ dkim/__ init__. py", line 211, in rfc822_parse ror("Unexpected characters in RFC822 header: %s" % lines[i]) matError: Unexpected characters in RFC822 header: b'hola'
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/
d = DKIM(message,
File "/usr/local/
self.
File "/usr/local/
self.headers, self.body = rfc822_
File "/usr/local/
raise MessageFormatEr
dkim.MessageFor
what's wrong in a simple string like 'hola'?