You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Assay.from_aid(2016).to_dict() fails. The reason is that a lot of 'comment' entries are absent altogether. The result is access to other records (e.g. 'target') is denied even if they do exist.
I can catch the exception, but it is a false failure (the 'target' may be there, but I can't get to it) for the records I want.
Here's the report...
KeyError Traceback (most recent call last)
Input In [36], in <cell line: 6>()
3 except Exception as x:
4 print(x)
----> 6 print(Assay.from_aid(2016).to_dict())
File ~/.conda/envs/myfastai/lib/python3.9/site-packages/pubchempy.py:1187, in Assay.to_dict(self, properties)
1185 if not properties:
1186 properties = [p for p in dir(Assay) if isinstance(getattr(Assay, p), property)]
-> 1187 return {p: getattr(self, p) for p in properties}
File ~/.conda/envs/myfastai/lib/python3.9/site-packages/pubchempy.py:1187, in (.0)
1185 if not properties:
1186 properties = [p for p in dir(Assay) if isinstance(getattr(Assay, p), property)]
-> 1187 return {p: getattr(self, p) for p in properties}
File ~/.conda/envs/myfastai/lib/python3.9/site-packages/pubchempy.py:1217, in Assay.comments(self)
1214 @Property
1215 def comments(self):
1216 """Comments and additional information."""
-> 1217 return [comment for comment in self.record['assay']['descr']['comment'] if comment]
KeyError: 'comment'
The text was updated successfully, but these errors were encountered:
Assay.from_aid(2016).to_dict() fails. The reason is that a lot of 'comment' entries are absent altogether. The result is access to other records (e.g. 'target') is denied even if they do exist.
I can catch the exception, but it is a false failure (the 'target' may be there, but I can't get to it) for the records I want.
Here's the report...
KeyError Traceback (most recent call last)
Input In [36], in <cell line: 6>()
3 except Exception as x:
4 print(x)
----> 6 print(Assay.from_aid(2016).to_dict())
File ~/.conda/envs/myfastai/lib/python3.9/site-packages/pubchempy.py:1187, in Assay.to_dict(self, properties)
1185 if not properties:
1186 properties = [p for p in dir(Assay) if isinstance(getattr(Assay, p), property)]
-> 1187 return {p: getattr(self, p) for p in properties}
File ~/.conda/envs/myfastai/lib/python3.9/site-packages/pubchempy.py:1187, in (.0)
1185 if not properties:
1186 properties = [p for p in dir(Assay) if isinstance(getattr(Assay, p), property)]
-> 1187 return {p: getattr(self, p) for p in properties}
File ~/.conda/envs/myfastai/lib/python3.9/site-packages/pubchempy.py:1217, in Assay.comments(self)
1214 @Property
1215 def comments(self):
1216 """Comments and additional information."""
-> 1217 return [comment for comment in self.record['assay']['descr']['comment'] if comment]
KeyError: 'comment'
The text was updated successfully, but these errors were encountered: