david.am...@digital.beis.gov.uk wrote, on Saturday, February 04, 2017 3:39 PM > > Hello All, > > I'm a newbie to python programming - got into it > predominately for the purposes of machine learning and data > mining and even though I've committed several weeks to > learning the scripting language, I have struggled to fully > grasp how it works. > > I'm looking to scrape title, video Id, view Count, like > Count, dislike Count, comment Count, favourite Count etc off > YouTube using a python script I found via an online tutorial. > > I have installed 'unidecode' and 'google-api-python-client' > packages via my terminal. I have also enabled YouTube Data > Api V3 and I'm getting the error below each time I run the script. > > Could anyone please point me in the right direction? > > Thanks a lot in advance for your help > > **** > Traceback (most recent call last): > File "/Users/*Path*/ML with Python/youtube_search.py", line > 73, in <module> > youtube_search(args) > File "/Users/*Path*/ML with Python/youtube_search.py", line > 21, in youtube_search > youtube = build(YOUTUBE_API_SERVICE_NAME, > YOUTUBE_API_VERSION, developerKey=DEVELOPER_KEY) > File > "/Users/*Path*/anaconda/lib/python3.5/site-packages/oauth2clie > nt/_helpers.py", line 133, in positional_wrapper > return wrapped(*args, **kwargs) > File > "/Users/*Path*/anaconda/lib/python3.5/site-packages/googleapic > lient/discovery.py", line 226, in build > credentials=credentials) > File > "/Users/*Path*/anaconda/lib/python3.5/site-packages/oauth2clie > nt/_helpers.py", line 133, in positional_wrapper > return wrapped(*args, **kwargs) > File > "/Users/*Path*/anaconda/lib/python3.5/site-packages/googleapic > lient/discovery.py", line 358, in build_from_document > credentials = _auth.default_credentials() > File > "/Users/*Path*/anaconda/lib/python3.5/site-packages/googleapic > lient/_auth.py", line 41, in default_credentials > return > oauth2client.client.GoogleCredentials.get_application_default() > File > "/Users/*Path*/anaconda/lib/python3.5/site-packages/oauth2clie > nt/client.py", line 1264, in get_application_default > return GoogleCredentials._get_implicit_credentials() > File > "/Users/*Path*/anaconda/lib/python3.5/site-packages/oauth2clie > nt/client.py", line 1254, in _get_implicit_credentials > raise ApplicationDefaultCredentialsError(ADC_HELP_MSG) > oauth2client.client.ApplicationDefaultCredentialsError: The > Application Default Credentials are not available. They are > available if running in Google Compute Engine. Otherwise, the > environment variable GOOGLE_APPLICATION_CREDENTIALS must be > defined pointing to a file defining the credentials. See > https://developers.google.com/accounts/docs/application-defaul t-credentials for more information.
-- Communications with the Department for Business, Innovation and Skills may be automatically logged, monitored and/or recorded for legal purposes. -- I'm also a relatively new python coder (little over a year), but it seems plain to me that "The Application Default Credentials ... are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials. See https://developers.google.com/accounts/docs/application-default-credenti als for more information." If you're not running in Google Compute Engine, you need to make a file defining the credentials, and supposedly there are instructions or requirements in the link above. Looks like Anaconda tried to get the credentials by calling its _auth.default_credentials() function: credentials = _auth.default_credentials() from "python3.5/site-packages/googleapiclient/discovery.py", but it failed. I think you need to read that link and make the file it wants to find. Deborah -- https://mail.python.org/mailman/listinfo/python-list