Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Traceback on journal['last_comment_meta'] in backup.py #10

Open
zetasyanthis opened this issue Jul 16, 2016 · 1 comment
Open

Traceback on journal['last_comment_meta'] in backup.py #10

zetasyanthis opened this issue Jul 16, 2016 · 1 comment
Assignees
Labels

Comments

@zetasyanthis
Copy link

zetasyanthis commented Jul 16, 2016

This is from the 0.2 release. Looks like the journal['last_comment_meta'] field occasionally comes back None, which blows up backup.py.

Traceback (most recent call last):
  File "./src/myarchive/main.py", line 156, in <module>
    main()
  File "./src/myarchive/main.py", line 146, in main
    ljapi.download_journals_and_comments()
  File "/mnt/bulk/repos/projects/myarchive/src/myarchive/ljlib.py", line 39, in download_journals_and_comments
    nc = update_journal_comments(server=self._server, journal=self.journal)
  File "/usr/local/lib/python2.7/dist-packages/lj/backup.py", line 148, in update_journal_comments
    if len(journal['comments']) == 0 or days_ago(journal['last_comment_meta']) > 30:
  File "/usr/local/lib/python2.7/dist-packages/lj/backup.py", line 61, in days_ago
    return (datetime.datetime.today() - datetime_from_string(s)).days
  File "/usr/local/lib/python2.7/dist-packages/lj/backup.py", line 57, in datetime_from_string
    return datetime.datetime.strptime(s, "%Y-%m-%d %H:%M:%S")
TypeError: must be string, not None
@zetasyanthis
Copy link
Author

zetasyanthis commented Jul 16, 2016

I'm guessing that if statement needs have this additional condition added?

Original:
if len(journal['comments']) == 0 or days_ago(journal['last_comment_meta']) > 30:

New:
if journal['last_comment_meta'] is None or len(journal['comments']) == 0 or days_ago(journal['last_comment_meta']) > 30:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants