Python2 to Python3 porting.#57
Conversation
danuker
left a comment
There was a problem hiding this comment.
Thanks for your conversion to Python 3. But since you touched the code, you now own it 😉
Please install a PEP 8 linter in your IDE or workflow (like flake8). You will find that code will become readable and consistent eventually (though you should read about and/or ignore warnings you think are misguided).
Also, I didn't like all the open().write() calls that were already in the code; the files are not closed. But I think this is outside the scope of this small change (which is why I didn't comment).
You should perhaps check out 2to3 which lets you automatically convert to Python 3.
Thanks again for the changes anyway; your code does the job!
| httpd = socketserver.ThreadingTCPServer((IP, PORT), CustomHandler) | ||
|
|
||
| print 'Serving ulogme, see it on http://localhost:' + `PORT` | ||
| print('Serving ulogme, see it on http://localhost:',str(PORT)) |
There was a problem hiding this comment.
For it to be a link in the terminal you have to use + instead of ,:
print('Serving ulogme, see it on http://localhost:'+str(PORT))or even better, with F-Strings (but they depend on Python 3.6):
print(f'Serving ulogme, see it on http://localhost:{PORT}'))| print 'error was:' | ||
| print e | ||
| except Exception as e: | ||
| print ('%s probably does not exist, setting empty events list.' % (fname, )) |
There was a problem hiding this comment.
Don't use white space "Immediately before the open parenthesis that starts the argument list of a function call:":
print('%s probably does not exist, setting empty events list.' % (fname, ))|
I tried to fiddle around with the code, but I could not get it working even using Python 2.7. Perhaps the server implementation changed, and is no longer responsive to This is why I hate inheritance - it is coupled with the implementation. I will try to fix it. |
|
Guess what is written in the README:
cp render/render_settings_example.js render/render_settings.js
2to3 -w export_events.py
rm render/events_*.json render/export_list.json
python export_events.py😆 It doesn't throw 404's anymore, and seems to work! |
But their is a issue of 404 error with export_list.json. It isn't being generated and I think the problem is with, export_events.py file on line 53.
I didn't understand what is wrong.