How to fix AttributeError:partially initialized module?

后端 未结 2 1571
南方客
南方客 2020-12-21 03:48

I am trying to run my script but keep getting this error:

File ".\\checkmypass.py", line 1, in 
    import requests line 3, in 

        
相关标签:
2条回答
  • 2020-12-21 03:58

    Have you checked the name of the file? it should not be as same as the module you are importing (circular). Also check the URL and the package you are using. "Most likely due to a circular import" refers to a file (module) which has got a dependency on something else and is trying to be imported while it's already been imported. Then while checked, you should have something like this:

    import requests
    
    r = requests.get("http://google.com")       
    print(r.status_code)
    
    # 200
    
    0 讨论(0)
  • 2020-12-21 04:12

    I had the same issue, I had a file I created in the same folder called requests.py. So it was actually importing that file and not the actually requests you install with pip. Then I had another issue with a file i created called logging.py. I renamed both and issue resolved. sounds like the same issue...

    0 讨论(0)
提交回复
热议问题