Errors in python\3.8.3\Lib\nntplib.py

G Connor neothreeeight at hotmail.com
Wed Apr 29 17:06:33 EDT 2020


module: python\3.8.2\Lib\nntplib.py
lines 903-907
-------------------------------------------
for line in f:
    if not line.endswith(_CRLF):
        line = line.rstrip(b"\r\n") + _CRLF
    if line.startswith(b'.'):
        line = b'.' + line
-------------------------------------------

When I try to submit a Usenet post, I get this:


Traceback (most recent call last):
  File "D:\python\3xcode\Usenet\posting\NNTP_post.py", line 12, in <module>
    news.post(f)
  File "D:\python\3.8.2\lib\nntplib.py", line 918, in post
    return self._post('POST', data)
  File "D:\python\3.8.2\lib\nntplib.py", line 904, in _post
    if not line.endswith(_CRLF):
TypeError: endswith first arg must be str or a tuple of str, not bytes


Also, line 906:
    if line.startswith(b'.'):
 looks like it should be:
    if not line.startswith(b'.'):


More information about the Python-list mailing list