Open-event-server: Fix Python 3 SyntaxError

Created on 22 Sep 2016  路  9Comments  路  Source: fossasia/open-event-server

Running flake8 on this repo, found some syntax errors on Python 3.x:

./config.py:37:60: E999 SyntaxError: invalid syntax
./create_db.py:14:40: E999 SyntaxError: invalid syntax
./manage.py:22:19: E999 SyntaxError: invalid syntax
./populate_db.py:130:30: E999 SyntaxError: invalid syntax
./app/api/helpers/custom_fields.py:31:70: E999 SyntaxError: invalid syntax
./app/api/helpers/import_helpers.py:206:22: E999 SyntaxError: invalid syntax
./app/api/helpers/tasks.py:29:24: E999 SyntaxError: invalid syntax
./app/helpers/data.py:557:19: E999 SyntaxError: invalid syntax
./app/helpers/helpers.py:94:29: E999 SyntaxError: invalid syntax
./app/helpers/notification_email_triggers.py:27:31: E999 SyntaxError: invalid syntax
./app/views/api_v1_views.py:568:41: E999 SyntaxError: invalid syntax
./app/views/admin/home.py:201:21: E999 SyntaxError: invalid syntax
./app/views/admin/models_views/events.py:324:24: E999 SyntaxError: invalid syntax
./app/views/admin/models_views/settings.py:84:23: E999 SyntaxError: invalid syntax
./app/views/admin/models_views/speakers.py:71:23: E999 SyntaxError: invalid syntax
./app/views/admin/super_admin/permissions.py:55:38: E999 SyntaxError: invalid syntax
./app/views/public/explore.py:86:23: E999 SyntaxError: invalid syntax
./tests/unittests/test_db_performance.py:37:23: E999 SyntaxError: invalid syntax
./tests/unittests/api/test_export_import.py:133:26: E999 SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 0-1: truncated \uXXXX escape
./tests/unittests/functionality/test_pages.py:29:34: E999 SyntaxError: invalid syntax

Most of them are print statements that are using Python 2 syntax, without parenthesis. This is an error in Python 3.x, as its syntax requires wrapping the arguments in function call with parenthesis : https://docs.python.org/3/whatsnew/3.0.html (see: Print is a function)

hacktoberfest

All 9 comments

@thegalang Open Event is supposed to run on Python 2.7 and has not been coded for Python 3. That is the reason why you get this error. Are there any particular advantages in using Python 3 ?
Should we port Open Event to Python 3 ?

@aviaryan we have to port Open Event to Python 3 because PSF has declared that it would withdraw all support for Python 2 in less than 1000 days. Though I agree that it is not a High:Priority Task now but finally we will have to port it to Python 3.

We should start to port to Python 3 before too late. The code base will be bigger and bigger and it will be difficult to port this project to Python 3, when Python 2 approaches its end-of-life.

:+1: for porting to Python 3. It also has better unicode support which I think is an important factor for our project.

@hongquan what I thought was porting to python 3 once the project reaches production stage. Since the project is still not in a stable production stage so this is not a very high priority task. What are your opinions @niranjan94 @mariobehling ?

@SaptakS I have created issue #2447 for it.

what I thought was porting to python 3 once the project reaches production stage. Since the project is still not in a stable production stage so this is not a very high priority task

Your opinion sounds reasonable. I myself am not sure what to do next. So I have added a "later" label for now in #2447. Let's see what others think.

@aviaryan I guess we should not mark it for "hacktoberfest" if it's labelled as "later" because hacktoberfest is only for the month of October.

Yes, agree. Get to production first and change to Python 3 in a concerted effort later.

This issue will be fixed once this issue is done with. Since this is not a high priority issue right now, we will work on it later. So closing this issue as this will be solved once the project is ported for the Python 3 release.

Was this page helpful?
0 / 5 - 0 ratings