collective / collective.checkdocs

Distutils command to view and validate restructured text in package's long_description
10 stars 5 forks source link

python3 issue #7

Open sobolevn opened 7 years ago

sobolevn commented 7 years ago

python setup.py showdocs

running showdocs reST to HTML conversion available at at http://localhost:6969/ - press CTRL+C to interrupt 127.0.0.1 - - [04/Apr/2017 10:17:37] "GET /0.551963301487 HTTP/1.1" 200 -

Exception happened during processing of request from ('127.0.0.1', 58713) Traceback (most recent call last): File "/usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 290, in _handle_request_noblock self.process_request(request, client_address) File "/usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 318, in process_request self.finish_request(request, client_address) File "/usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 331, in finish_request self.RequestHandlerClass(request, client_address, self) File "/usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 652, in init self.handle() File "/usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/BaseHTTPServer.py", line 340, in handle self.handle_one_request() File "/usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/BaseHTTPServer.py", line 328, in handle_one_request method() File "/Users/sobolev/.virtualenvs/django_split_settings/lib/python2.7/site-packages/collective/checkdocs/init.py", line 41, in do_GET print(self.value.encode('utf-8'), file=f) TypeError: unicode argument expected, got 'str'

I can send a PR with the fix, if it's fine.

ArneBachmann commented 6 years ago

I get something similar, a typical Python 3 issue:

running showdocs
<string>:52: (ERROR/3) Unexpected indentation.
<string>:53: (WARNING/2) Block quote ends without a blank line; unexpected unindent.
reST to HTML conversion available at at http://localhost:6969/ - press CTRL+C to interrupt
127.0.0.1 - - [19/Dec/2017 13:24:08] "GET / HTTP/1.1" 200 -
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 58805)
Traceback (most recent call last):
  File "D:\apps\Miniconda3\lib\socketserver.py", line 317, in _handle_request_noblock
    self.process_request(request, client_address)
  File "D:\apps\Miniconda3\lib\socketserver.py", line 348, in process_request
    self.finish_request(request, client_address)
  File "D:\apps\Miniconda3\lib\socketserver.py", line 361, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "D:\apps\Miniconda3\lib\socketserver.py", line 696, in __init__
    self.handle()
  File "D:\apps\Miniconda3\lib\http\server.py", line 418, in handle
    self.handle_one_request()
  File "D:\apps\Miniconda3\lib\http\server.py", line 406, in handle_one_request
    method()
  File "D:\apps\Miniconda3\lib\site-packages\collective\checkdocs\__init__.py", line 45, in do_GET
    self.copyfile(f, self.wfile)
  File "D:\apps\Miniconda3\lib\http\server.py", line 800, in copyfile
    shutil.copyfileobj(source, outputfile)
  File "D:\apps\Miniconda3\lib\shutil.py", line 82, in copyfileobj
    fdst.write(buf)
  File "D:\apps\Miniconda3\lib\socketserver.py", line 775, in write
    self._sock.sendall(b)
TypeError: a bytes-like object is required, not 'str'
----------------------------------------