Skip to content

Update main.py for Python2 and Python3 user input support#71

Merged
erickoledadevrel merged 5 commits intogoogleworkspace:masterfrom
rmccorm4:patch-2
Mar 8, 2019
Merged

Update main.py for Python2 and Python3 user input support#71
erickoledadevrel merged 5 commits intogoogleworkspace:masterfrom
rmccorm4:patch-2

Conversation

@rmccorm4
Copy link
Copy Markdown
Contributor

Add support for both Python2/Python3 rather than asking user to manually change the code as suggested in this comment: # If you can't use Python 3.x, please change "input" to "raw_input"

Add support for both Python2/Python3 rather than asking user to manually change the code as suggested in this comment: # If you can't use Python 3.x, please change "input" to "raw_input"
@erickoledadevrel erickoledadevrel self-requested a review January 17, 2019 18:10
@erickoledadevrel erickoledadevrel self-assigned this Jan 17, 2019
@erickoledadevrel
Copy link
Copy Markdown

Thanks for the contribution? Looks like they are some linting errors reported by Travis. Can you please resolve those?

Update to follow proper linting/style by using `six` library, because it is against standards to redefine builtin `input()`
Update to use `builtins` instead of `six`, but might require `pip install future`
Back to `six` library
third party import "import six" should be placed before "import httplib2" (wrong-import-order)
@rmccorm4
Copy link
Copy Markdown
Contributor Author

Yes sorry, had to run to a meeting before checking the Travis results. Turns out most accepted methods go against "redefining builtin input", so I used six.moves.input() instead to keep Python2/Python3 support.

@erickoledadevrel
Copy link
Copy Markdown

Awesome, thanks for doing the work to find a compatible solution. Should the six package be added to the install instructions in the README? I think it's a dependency of the Google API Client library, but probably not safe to rely on that.

@rmccorm4
Copy link
Copy Markdown
Contributor Author

rmccorm4 commented Jan 17, 2019

I ran it inside of an Ubuntu18.04 Docker container that only installs python and pip, and then does pip3 install google-api-python-client oauth2client - So it should be okay without it. It wouldn't hurt to add it to the README, but that's up to you.

@erickoledadevrel erickoledadevrel merged commit b245f84 into googleworkspace:master Mar 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants