Skip to content

Commit fda4959

Browse files
authored
Checking Python version
Checking python version to avoid input errors.
1 parent f1ee9f1 commit fda4959

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drive/driveapp/main.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@
1111
from googleapiclient.discovery import build
1212
import googleapiclient.http
1313
import oauth2client.client
14+
import sys
1415

16+
# Checking Python version to avoid input errors
17+
if sys.version_info<(3,5,0):
18+
sys.stderr.write("You need python 3.x or later to run this script\n")
19+
exit(1)
20+
1521
# OAuth 2.0 scope that will be authorized.
1622
# Check https://developers.google.com/drive/scopes for all available scopes.
1723
OAUTH2_SCOPE = 'https://www.googleapis.com/auth/drive'
@@ -32,7 +38,7 @@
3238
flow.redirect_uri = oauth2client.client.OOB_CALLBACK_URN
3339
authorize_url = flow.step1_get_authorize_url()
3440
print('Go to the following link in your browser: ' + authorize_url)
35-
code = raw_input('Enter verification code: ').strip()
41+
code = input('Enter verification code: ').strip()
3642
credentials = flow.step2_exchange(code)
3743

3844
# Create an authorized Drive API client.

0 commit comments

Comments
 (0)