pcko1 / etherscan-python

A minimal, yet complete, python API for Etherscan.io.
MIT License
408 stars 111 forks source link

ImportError: cannot import name 'Etherscan' from 'etherscan' #32

Open kubesqrt opened 2 years ago

kubesqrt commented 2 years ago

from etherscan import Etherscan eth = Etherscan('CU3GAMEJKER5MVUKJ4Z3NVTIK5Y2A75D58')

eth.get_gas_oracle()

Terminal: ImportError: cannot import name 'Etherscan' from 'etherscan'

I am running python 3.9.7 on windows 10.

github-actions[bot] commented 2 years ago

Thanks for reporting this issue, we are on it :)

quidverse commented 2 years ago

@kubesqrt this happens because your code is inside a file named etherscan.py. If you rename it, the error will go away

gowa-coder commented 2 years ago

still not working , what we have to rename?

merlinmary commented 2 years ago

@Terkey7762 Try:

import etherscan
eth = etherscan.Client('CU3GAMEJKER5MVUKJ4Z3NVTIK5Y2A75D58')
kieran-mackle commented 2 years ago

@kubesqrt I think this is because you have installed etherscan instead of etherscan-python - as per the installation guide of this repo.

pip uninstall etherscan
pip install etherscan-python
Robert-ZLF commented 2 years ago

You may need to check where actually the etherscan lib installed if you have different python versions install on your computer. For my case somehow the lib installed in my conda envriments, however, I was run install command in another python enviroment. I just found this when I try to uninstall etherscan-python

EmperorMew commented 2 years ago

from etherscan import Etherscan eth = Etherscan('CU3GAMEJKER5MVUKJ4Z3NVTIK5Y2A75D58')

eth.get_gas_oracle()

Terminal: ImportError: cannot import name 'Etherscan' from 'etherscan'

I am running python 3.9.7 on windows 10.

I encountered this problem yesterday. Incorrectly, I use pip install etherscan rather than pip install etherscan-python. Moreover, if both are placed in the same environment, they will clash.