-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate to Python3 #17
Comments
I have done the migration in python3 branch, yet I get this error: Traceback (most recent call last): can you help ? |
I haven't looked at the whole code yet but it looks like it is because of the division (hashlen*3/4) which comes out as a float, not an integer. May be convert it to an int first? |
I changed the line to: Now I get this error: |
urandom() is probably returning bytes rather than a string. Try decode instead of encode. |
from base64 import b64encode
b64encode(os.urandom(int(hashlen*3/4)))[:hashlen] |
After applying your fix, another error appeared:
```
Exception happened during processing of request from ('127.0.0.1', 60638)
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/okasha/baseWebApp.py", line 605, in __call__
try: r=f(rq, *a)
File "/usr/share/thawab/Thawab/webApp.py", line 88, in _root
raise redirectException(rq.script+'/index/')
okasha.baseWebApp.webAppBaseException
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/paste/httpserver.py", line 304, in wsgi_execute
self.wsgi_start_response)
File "/usr/lib/python3/dist-packages/okasha/baseWebApp.py", line 608, in __call__
return self._handleException(rq, e)
File "/usr/lib/python3/dist-packages/okasha/baseWebApp.py", line 503, in _handleException
return getattr(self, s)(rq, e)
File "/usr/lib/python3/dist-packages/okasha/baseWebApp.py", line 521, in _302
return ("Redirect to "+ e.kw['location'],)
TypeError: must be str, not bytes
During handling of the above exception, another exception occurred:
```
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/paste/httpserver.py", line 1085, in process_request_in_thread
self.finish_request(request, client_address)
File "/usr/lib/python3.6/socketserver.py", line 364, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python3.6/socketserver.py", line 724, in __init__
self.handle()
File "/usr/lib/python3/dist-packages/paste/httpserver.py", line 459, in handle
BaseHTTPRequestHandler.handle(self)
File "/usr/lib/python3.6/http/server.py", line 418, in handle
self.handle_one_request()
File "/usr/lib/python3/dist-packages/paste/httpserver.py", line 454, in handle_one_request
self.wsgi_execute()
File "/usr/lib/python3/dist-packages/paste/httpserver.py", line 324, in wsgi_execute
self.wsgi_write_chunk("Internal Server Error\n")
File "/usr/lib/python3/dist-packages/paste/httpserver.py", line 167, in wsgi_write_chunk
self.wfile.write(chunk)
File "/usr/lib/python3.6/socketserver.py", line 803, in write
self._sock.sendall(b)
TypeError: a bytes-like object is required, not 'str'
----------------------------------------
```
|
I modified baseWebApp.py in okasha as follows: return ("Redirect to "+ str(e.kw['location']),) So the first 2 exceptions are gone, yet the last exception occurs twice but
although netstat reports that thawab-gtk is listening to port 18080. |
I modified baseWebApp.py (again) in okasha as follows: return (("Redirect to "+ str(e.kw['location'])).encode('utf-8'),) So the exception occurs only once. |
@muayyad-alsadi I am stuck here. Please help |
Please try to fix this as soon as possible. |
Thawab doesn't open in Ubuntu 20.04. |
@ehabsas I see you've been working on this issue, is it fixed yet ? |
Python 2 end-of-life date is on 2020: http://legacy.python.org/dev/peps/pep-0373/
please migrate thawab to Python3.
The text was updated successfully, but these errors were encountered: