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
sch.get_authors(['2148555752']) returns a NoneType error because the SS API returns None for this author id and the module does not seem to account for this. A NoneType error is then generated when trying to complete an Author object.
TypeError Traceback (most recent call last)
Cell In [286], line 1
----> 1 sch.get_authors(['2148555752'])
File ~/anaconda3/envs/py39/lib/python3.9/asyncio/tasks.py:256, in Task.__step(failed resolving arguments)
252 try:
253 if exc is None:
254 # We use the send method directly, because coroutines
255 # don't have __iter__ and __next__ methods.
--> 256 result = coro.send(None)
257 else:
258 result = coro.throw(exc)
This issue is similar to #80 regarding the get_papers() method. The solution implemented for that problem has also been applied to the get_authors() method.
This fix will be included in the next release. In the meantime, you can try installing directly from the source.
sch.get_authors(['2148555752']) returns a NoneType error because the SS API returns None for this author id and the module does not seem to account for this. A NoneType error is then generated when trying to complete an Author object.
TypeError Traceback (most recent call last)
Cell In [286], line 1
----> 1 sch.get_authors(['2148555752'])
File ~/anaconda3/envs/py39/lib/python3.9/site-packages/semanticscholar/SemanticScholar.py:397, in SemanticScholar.get_authors(self, author_ids, fields)
385 '''Get details for multiple authors at once
386
387 :calls: `POST /author/batch <https://api.semanticscholar.org/api-docs/\
(...)
393 :raises: BadQueryParametersException: if no author was found.
394 '''
396 loop = asyncio.get_event_loop()
--> 397 authors = loop.run_until_complete(
398 self._AsyncSemanticScholar.get_authors(
399 author_ids=author_ids,
400 fields=fields
401 )
402 )
404 return authors
File ~/anaconda3/envs/py39/lib/python3.9/site-packages/nest_asyncio.py:89, in _patch_loop..run_until_complete(self, future)
86 if not f.done():
87 raise RuntimeError(
88 'Event loop stopped before Future completed.')
---> 89 return f.result()
File ~/anaconda3/envs/py39/lib/python3.9/asyncio/futures.py:201, in Future.result(self)
199 self.__log_traceback = False
200 if self._exception is not None:
--> 201 raise self._exception
202 return self._result
File ~/anaconda3/envs/py39/lib/python3.9/asyncio/tasks.py:256, in Task.__step(failed resolving arguments)
252 try:
253 if exc is None:
254 # We use the
send
method directly, because coroutines255 # don't have
__iter__
and__next__
methods.--> 256 result = coro.send(None)
257 else:
258 result = coro.throw(exc)
File ~/anaconda3/envs/py39/lib/python3.9/site-packages/semanticscholar/AsyncSemanticScholar.py:543, in AsyncSemanticScholar.get_authors(self, author_ids, fields)
539 payload = { "ids": author_ids }
541 data = await self._requester.get_data_async(
542 url, parameters, self.auth_header, payload)
--> 543 authors = [Author(item) for item in data]
545 return authors
File ~/anaconda3/envs/py39/lib/python3.9/site-packages/semanticscholar/AsyncSemanticScholar.py:543, in (.0)
539 payload = { "ids": author_ids }
541 data = await self._requester.get_data_async(
542 url, parameters, self.auth_header, payload)
--> 543 authors = [Author(item) for item in data]
545 return authors
File ~/anaconda3/envs/py39/lib/python3.9/site-packages/semanticscholar/Author.py:57, in Author.init(self, data)
55 self._papers = None
56 self._url = None
---> 57 self._init_attributes(data)
File ~/anaconda3/envs/py39/lib/python3.9/site-packages/semanticscholar/Author.py:131, in Author._init_attributes(self, data)
129 def _init_attributes(self, data):
130 self._data = data
--> 131 if 'affiliations' in data:
132 self._affiliations = data['affiliations']
133 if 'authorId' in data:
TypeError: argument of type 'NoneType' is not iterable
The text was updated successfully, but these errors were encountered: