tarbell-project / tarbell

A Flask-based static site authoring tool.
https://tarbell.readthedocs.io/en/latest/index.html
BSD 3-Clause "New" or "Revised" License
165 stars 32 forks source link

Add a "you need to create credentials.json" hint to cron tarbell publish EOFError #425

Closed jheasly closed 8 years ago

jheasly commented 8 years ago

I don't know where Tarbell figures out that it's being called via cron, but when it sees that this is the case and that there is no credentials.json file around, it might be nice if the error included a hint along the lines of:

It appears that you're publishing via cron but Tarbell isn't finding a credentials.json file. Please see the documentation on how to create one.

Currently, this is the EOFError that gets thrown when calling publish via cron and there is no credentials.json:

Enter verification code: Traceback (most recent call last):
 File "/Users/someuser/.virtualenvs/tarbell_env/bin/tarbell", line 9, in <module>
   load_entry_point('tarbell==1.0.5', 'console_scripts', 'tarbell')()
 File "/Users/someuser/.virtualenvs/tarbell_env/lib/python2.7/site-packages/tarbell/cli.py", line 74, in main
   command.__call__(command, args)
 File "/Users/someuser/.virtualenvs/tarbell_env/lib/python2.7/site-packages/tarbell/cli.py", line 931, in __call__
   return self.fn(*args, **kw_args)
 File "/Users/someuser/.virtualenvs/tarbell_env/lib/python2.7/site-packages/tarbell/cli.py", line 336, in tarbell_publish
   with ensure_settings(command, args) as settings, ensure_project(command, args) as site:
 File "/Users/someuser/.virtualenvs/tarbell_env/lib/python2.7/site-packages/tarbell/contextmanagers.py", line 58, in __enter__
   return self.ensure_site()
 File "/Users/someuser/.virtualenvs/tarbell_env/lib/python2.7/site-packages/tarbell/contextmanagers.py", line 79, in ensure_site
   site = TarbellSite(path)
 File "/Users/someuser/.virtualenvs/tarbell_env/lib/python2.7/site-packages/tarbell/app.py", line 279, in __init__
   self.project, self.base = self.load_project(path)
 File "/Users/someuser/.virtualenvs/tarbell_env/lib/python2.7/site-packages/tarbell/app.py", line 407, in load_project
   self.client = get_drive_api()
 File "/Users/someuser/.virtualenvs//lib/python2.7/site-packages/tarbell/oauth.py", line 34, in get_drive_api
   return get_drive_api_from_client_secrets(settings.client_secrets_path)
 File "/Users/someuser/.virtualenvs/tarbell_env/lib/python2.7/site-packages/tarbell/oauth.py", line 50, in get_drive_api_from_client_secrets
   credentials = tools.run_flow(flow, storage, flags)
 File "/Users/someuser/.virtualenvs/tarbell_env/lib/python2.7/site-packages/oauth2client/util.py", line 140, in positional_wrapper
   return wrapped(*args, **kwargs)
 File "/Users/someuser/.virtualenvs/tarbell_env/lib/python2.7/site-packages/oauth2client/tools.py", line 228, in run_flow
   code = input('Enter verification code: ').strip()
EOFError: EOF when reading a line