Python + PyCharm File Structure issue: AttributeError: 'module' object has no attribute 'X'

前端 未结 1 1849
轻奢々
轻奢々 2021-01-24 03:40

I\'m having the following file structure:

  • main.py
  • Crypto
    • GetGenerators.py
  • Utils
    • RecHash.py
    • ToInteger.py
相关标签:
1条回答
  • 2021-01-24 04:47

    I haven't had your exact problem before, but I think I've had one like it. When I use PyCharm, I find that if open and use files that I've created in a project in PyCharm, then everything works fine. I can import them, can run them; no problems. The problems I run into (which are similar to yours) are when I open a file that was not created within a PyCharm project. I can't import them, and sometimes can't even run them correctly. Maybe it's just me being stupid or maybe a real bug with PyCharm, but whatever the case is. It might be worth (if you haven't already), create a project in PyCharm and copy and paste the file contents into files you create within PyCharm. For some reason, that has worked for me in the past.

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