问题
I have an AWS EC2 machine that has been running nightly google analytics scripts to load into a database. It has been working fine up for months until this weekend. I have not made any changes to the code.
These are the two errors that are showing up in my logs:
/venv/lib/python3.5/site-packages/oauth2client/_helpers.py:256: UserWarning: Cannot access analytics.dat: No such file or directory warnings.warn(_MISSING_FILE_MESSAGE.format(filename))
Failed to start a local webserver listening on either port 8080 or port 8090. Please check your firewall settings and locally running programs that may be blocking or using those ports.
Falling back to --noauth_local_webserver and continuing with authorization.
It looks like it is missing my analytics.dat file but I have checked and the file is in the same folder as the script that calls the GA API. I have been searching for hours trying to figure this out but there are very little resources on the above errors for GA.
Does anyone know what might be going on here? Any ideas on how to troubleshoot more?
回答1:
I am not sure why this is happening, But I have a list of steps which might help you.
- check if this issue is caused by google analytics API version, google generally deprecates the previous versions of their API.
- I am guessing that you are running this code on cron on your EC2 serv, make sure that you include the path to the folder where the
.dat
file is. 3.check whether you have the latest credentials in the.dat
file.
Authentication to the API will happen through the .dat
file.
Hope this solves your issue.
来源:https://stackoverflow.com/questions/43787699/google-analytics-dat-file-missing-falling-back-to-noauth-local-webserver