python sqlAlchemy: got InvalidRequestError after change class location

后端 未结 1 1607
予麋鹿
予麋鹿 2021-02-15 16:49

If I put the CapacityMin class and unittest class in same .py file, every things fine. But after I move CapacityMin class to a separa

相关标签:
1条回答
  • 2021-02-15 17:47

    You are using the module, not the class within the module.

    I suspect that you are using it like this:

    from Entities import CapacityMin
    

    while you meant to use:

    from Entities.CapacityMin import CapacityMin
    

    This kind of confusion is one of the reasons that the Python styleguide (PEP 8) recommends using lowercase names for your modules; your import would then be:

    from entities.capacitymin import CapacityMin
    

    and your error would have been easier to spot.

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