Errors in python\3.8.3\Lib\nntplib.py

2020-04-29 Thread G Connor
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 
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'.'):
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Errors in python\3.8.3\Lib\nntplib.py

2020-04-29 Thread G Connor
On 4/29/2020 5:29 PM, Chris Angelico wrote:


> Try opening the file in binary mode instead.


Changed:  f = open(postfile,'r')to :  f = open(postfile,'rb')
and it worked.

Thanks man!





-- 
https://mail.python.org/mailman/listinfo/python-list