librenews icon indicating copy to clipboard operation
librenews copied to clipboard

Code updates for Python 3

Open lisbonjoker opened this issue 4 years ago • 7 comments

lisbonjoker avatar Jun 21 '21 00:06 lisbonjoker

After this changes most from https://github.com/milesmcc/LibreNews-Server/issues/26 is fixed except:

ERROR:tornado.application:Uncaught exception GET / (removed)
HTTPServerRequest(protocol='http', host='removed:8888', method='GET', uri='/', version='HTTP/1.1', remote_ip='removed')
Traceback (most recent call last):
  File ".local/lib/python3.6/site-packages/tornado/web.py", line 1702, in _execute
    result = method(*self.path_args, **self.path_kwargs)
  File "webserver.py", line 39, in get
    say("Received INDEX request (" + req_resp + ")")
UnboundLocalError: local variable 'req_resp' referenced before assignment
ERROR:tornado.access:500 GET / (removed) 4.67ms

lisbonjoker avatar Jun 21 '21 00:06 lisbonjoker

Got it running now, but a bit unstable still. Now it's working on Python3.

lisbonjoker avatar Jun 21 '21 02:06 lisbonjoker

@milesmcc?

lisbonjoker avatar Jul 08 '21 19:07 lisbonjoker

Hi! Thanks for making these fixes. Happy to merge shortly.

Got it running now, but a bit unstable still. Now it's working on Python3.

Is there anything in particular that's still unstable?

milesmcc avatar Jul 08 '21 19:07 milesmcc

Hi! Thanks for making these fixes. Happy to merge shortly. Hi, glad to be of help. Is there anything in particular that's still unstable?

On entering website:

[LibreNews Server] [ERR] Errored while handling request IP -- still served... 
[LibreNews Server] [ERR] Errored while handling request IP -- still served... 
[LibreNews Server] [ERR] Errored while handling request IP -- still served... 

no exact error shown

when subscribing:

Failed to load resource: the server responded with a status of 500 ()
base.js:96 Uncaught (in promise) Error: Bad status code from server.
    at base.js:96
ERROR:tornado.application:Uncaught exception POST /push (127.0.0.1)
HTTPServerRequest(protocol='http', host='librenews.servicosradicais.tech', method='POST', uri='/push', version='HTTP/1.1', remote_ip='127.0.0.1')
Traceback (most recent call last):
  File "/home/*/.local/lib/python3.8/site-packages/tornado/web.py", line 1702, in _execute
    result = method(*self.path_args, **self.path_kwargs)
  File "webserver.py", line 158, in post
    say("Receiving new subscription: " + self.request.body)
TypeError: can only concatenate str (not "bytes") to str
ERROR:tornado.access:500 POST /push (127.0.0.1) 99.61ms
ERROR:tornado.application:Uncaught exception POST /push (127.0.0.1)
HTTPServerRequest(protocol='http', host='librenews.servicosradicais.tech', method='POST', uri='/push', version='HTTP/1.1', remote_ip='127.0.0.1')
Traceback (most recent call last):
  File "/home/*/.local/lib/python3.8/site-packages/tornado/web.py", line 1702, in _execute
    result = method(*self.path_args, **self.path_kwargs)
  File "webserver.py", line 158, in post
    say("Receiving new subscription: " + self.request.body)
TypeError: can only concatenate str (not "bytes") to str
ERROR:tornado.access:500 POST /push (127.0.0.1) 0.92ms

On a Detected flash

[LibreNews Server] [ERR] Encountered an exception while processing a flash: name 'thread' is not defined

lisbonjoker avatar Jul 08 '21 22:07 lisbonjoker

Tornado is not getting the real IPs from nginx and it's getting two errors when a new subscription appears and when a new flash shows up. resulting in not sending browser notifications.

lisbonjoker avatar Jul 09 '21 22:07 lisbonjoker

@lisbonjoker looks like you just need to make sure the data send to tornado is wrapped as string not bytes. Prob leftover 2-3 conversion crap. TypeError: can only concatenate str (not "bytes") to str

james-see avatar Mar 27 '22 13:03 james-see