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

Added exception in set_pub_year_month_day for publications that do n… #1

Merged
merged 1 commit into from
Jan 8, 2016
Merged

Conversation

scuerda
Copy link
Contributor

@scuerda scuerda commented Jan 8, 2016

Running PubMedLookup on 25156302 returns a proper object. Passing that object to Publication raises an uncaught TypeError as follows

>>> r = PubMedLookup(25156302, 'email')
>>> Publication(r)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/home/scuerda/Projects/timi/lib/python3.4/site-packages/pubmed_lookup/pubmed_lookup.py", line 41, in __init__
    self.set_pub_year_month_day(xml_dict)
  File "/home/scuerda/Projects/timi/lib/python3.4/site-packages/pubmed_lookup/pubmed_lookup.py", line 203, in set_pub_year_month_day
    month_short, "%b").month
TypeError: must be str, not None

Added TypeError to exception handling, which properly handles missing month.

mfcovington added a commit that referenced this pull request Jan 8, 2016
Added exception in  set_pub_year_month_day for publications that do n…
@mfcovington mfcovington merged commit 7ed43be into mfcovington:develop Jan 8, 2016
@mfcovington
Copy link
Owner

Thanks!

@mfcovington
Copy link
Owner

Now released on PyPI as 0.1.5.

@scuerda
Copy link
Contributor Author

scuerda commented Jan 9, 2016

Welcome and thank you. This has saved me a lot of work.

@mfcovington
Copy link
Owner

Happy that it has been helpful. Unless it is super secret, I'd love to hear what sort of project you use it for sometime.

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

Successfully merging this pull request may close these issues.

None yet

2 participants