UpendraSingh / analytics-issues

Automatically exported from code.google.com/p/analytics-issues
0 stars 0 forks source link

Python HelloAnalytics: file() argument 1 must be encoded string without NULL bytes #904

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
---------------------------------------------------------------------------
NOTE: This tool is not designed to request help. It is only for reporting
issues and requesting features for the Google Analytics libraries.

If you are a developer and you need help, visit:
https://developers.google.com/analytics/help/

If you are not a developer and you need help, visit:
https://support.google.com/analytics
---------------------------------------------------------------------------
Name of affected component: Analytics Management API

Python

Issue summary:
Hello, today I moved on to install the Python API so I can use its features for 
some application I am developing.
I followed the tutorial "Hello Analytics API: Python quickstart for service 
accounts" and I found some inconsistencies.The e-mail generated on the service 
account does not match the <projectId>-<uniqueId>@developer.gserviceaccount.com 
as stated. Moving on I copied the sample code, replaced the placeholder 
contents of the service_account_email and key_file_location with the email that 
was generated and the path of the clients_secrets.p12 that i have in the same 
folder as my script. I have also given the permissions in the account level of 
my Analytics account.

Expected output:
I was expecting to see the program running correctly, although what i saw is an 
error described below.

Actual results:
After running the file I got this error. I have tried many things that might 
help but nothing seems to have an effect. There is also an issue on 
stackoverflow describing the same thing that I experienced.

Traceback (most recent call last):
  File "HelloAnalytics.py", line 112, in <module>
    main()
  File "HelloAnalytics.py", line 106, in main
    service_account_email)
  File "HelloAnalytics.py", line 35, in get_service
    service_account_email, key, scopes=scope)
  File "/usr/local/lib/python2.7/dist-packages/oauth2client/service_account.py", line 274, in from_p12_keyfile
    with open(filename, 'rb') as file_obj:
TypeError: file() argument 1 must be encoded string without NULL bytes, not str

Original issue reported on code.google.com by pet...@growth.gr on 8 Mar 2016 at 4:17

GoogleCodeExporter commented 8 years ago

Original comment by mcoh...@google.com on 8 Mar 2016 at 4:23

GoogleCodeExporter commented 8 years ago
This seems to be an issue with the underlying client libraries: 
https://github.com/google/google-api-python-client

I will update this thread when the underlying issue is resolved.

Original comment by mcoh...@google.com on 8 Mar 2016 at 4:29

GoogleCodeExporter commented 8 years ago

Original comment by mcoh...@google.com on 15 Mar 2016 at 9:50