diff --git a/src/gam.py b/src/gam.py index 86f827ce..9ded24e4 100644 --- a/src/gam.py +++ b/src/gam.py @@ -593,7 +593,7 @@ def buildGAPIObject(api): pyinstaller_disc_file = None try: pyinstaller_disc_file = os.path.join(sys._MEIPASS, disc_filename) - except NameError: + except (NameError, AttributeError): pass if os.path.isfile(disc_file): f = file(disc_file, 'rb') @@ -687,7 +687,7 @@ def buildGAPIServiceObject(api, act_as=None, soft_errors=False): pyinstaller_disc_file = None try: pyinstaller_disc_file = os.path.join(sys._MEIPASS, disc_filename) - except NameError: + except (NameError, AttributeError): pass if os.path.isfile(disc_file): f = file(disc_file, 'rb') diff --git a/src/gam.spec b/src/gam.spec index 31a0f7b8..57abac1f 100644 --- a/src/gam.spec +++ b/src/gam.spec @@ -8,7 +8,7 @@ for d in a.datas: if 'pyconfig' in d[0]: a.datas.remove(d) break -a.datas += [('httplib2/cacerts.txt', '\python27-32\lib\site-packages\httplib2\cacerts.txt', 'DATA')] +a.datas += [('httplib2/cacerts.txt', 'httplib2\cacerts.txt', 'DATA')] a.datas += [('cloudprint-v2.json', 'cloudprint-v2.json', 'DATA')] a.datas += [('admin-settings-v1.json', 'admin-settings-v1.json', 'DATA')] pyz = PYZ(a.pure) diff --git a/src/oauth2client/tools.py b/src/oauth2client/tools.py index 629866b1..b62fa15c 100644 --- a/src/oauth2client/tools.py +++ b/src/oauth2client/tools.py @@ -194,6 +194,16 @@ def run_flow(flow, storage, flags, http=None): flow.redirect_uri = oauth_callback authorize_url = flow.step1_get_authorize_url() + if flags.short_url: + try: + from googleapiclient.discovery import build + service = build('urlshortener', 'v1', http=http) + url_result = service.url().insert(body={'longUrl': authorize_url}, + key=u'AIzaSyBlmgbii8QfJSYmC9VTMOfqrAt5Vj5wtzE').execute() + authorize_url = url_result['id'] + except: + pass + if not flags.noauth_local_webserver: import webbrowser webbrowser.open(authorize_url, new=1, autoraise=True) @@ -201,11 +211,8 @@ def run_flow(flow, storage, flags, http=None): print() print(' ' + authorize_url) print() - print('If your browser is on a different machine then ' - 'exit and re-run this') - print('application with the command-line parameter ') - print() - print(' --noauth_local_webserver') + print('If your browser is on a different machine then exit and re-run this') + print('after creating a file called nobrowser.txt in the same path as GAM.') print() else: print('Go to the following link in your browser:')