ChenLiu-1996/CitationMap

Circular import issue

Closed this issue · 3 comments

Hi there,

Thanks a lot for building this wonderful project. I tried running your demo but unfortunately got an error on python import. I tried on both my mac and a linux workstation and neither worked. Please see the error message below.

> cat citation_map.py
from citation_map import generate_citation_map

# This is my Google Scholar ID. Replace this with your ID.
scholar_id = '3rDjnykAAAAJ'
generate_citation_map(scholar_id)
> python citation_map.py
Traceback (most recent call last):
  File "/home/qiyan/Downloads/citation_map.py", line 1, in <module>
    from citation_map import generate_citation_map
  File "/home/qiyan/Downloads/citation_map.py", line 1, in <module>
    from citation_map import generate_citation_map
ImportError: cannot import name 'generate_citation_map' from partially initialized module 'citation_map' (most likely due to a circular import) (/home/qiyan/Downloads/citation_map.py)

Any help is greatly appreciated. Thanks!

Hi qiyan98,

Oh I perhaps know what the problem is. It is probably because the name of your script and the name of the package are the same. Try renaming your citation_map.py to something else.

Also, you probably want to use your own scholar ID instead of mine. Unfortunately with the current version, you won't get many chances to run this before you get blocked by Google Scholar.

Please let me know if this fixes your problem. If so I will close the issue.

Thank you so much! It works perfectly now.