etherscan-python icon indicating copy to clipboard operation
etherscan-python copied to clipboard

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

Open kubesqrt opened this issue 2 years ago • 7 comments

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.

kubesqrt avatar Feb 16 '22 19:02 kubesqrt

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

github-actions[bot] avatar Feb 16 '22 19:02 github-actions[bot]

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

quidverse avatar Apr 05 '22 18:04 quidverse

still not working , what we have to rename?

gowa-coder avatar Apr 22 '22 05:04 gowa-coder

@Terkey7762 Try:

import etherscan
eth = etherscan.Client('CU3GAMEJKER5MVUKJ4Z3NVTIK5Y2A75D58')

merlinmary avatar May 10 '22 06:05 merlinmary

@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

kieran-mackle avatar May 22 '22 23:05 kieran-mackle

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

Robert-ZLF avatar Jun 04 '22 07:06 Robert-ZLF

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.

EmperorMew avatar Aug 03 '22 17:08 EmperorMew