所以我想为我的python项目制作一个菜单,我制作了一个包装使其更加有条理 但是当我尝试导入名为src的程序包时,出现语法错误,说它不可调用
这是我的工作树:
.
├── Ideas
│ └── OSINT
│ └── Whitepages
├── LICENSE
├── src
│ ├── __init__.py
│ ├── menu
│ │ ├── __init__.py
│ │ ├── mainMenu.py
│ │ └── __pycache__
│ │ └── logo.cpython-36.pyc
│ └── __pycache__
│ └── __init__.cpython-36.pyc
└── watchmen.py
这是mainMenu.py:
from colorama import Fore, Style
import colorama
class Menu1:
def __init__ (self):
choice ='0'
while choice =='0':
print(Fore.WHITE + u"""
Main Choice: Choose 1 of 4 choices
1.begin
2.Check for updates
3.TrAiN)
4.exit""")
choice = input ("Please make a choice: ")
if choice == "4":
print()
exit(Fore.WHITE + u"thanks for stalking by")
elif choice == "3":
print("Do Something 3")
elif choice == "2":
print("Do Something 2")
elif choice == "1":
print("Do Something 1")
else:
print("I don't understand your choice.")
错误消息:
Traceback (most recent call last):
File "watchmen.py", line 37, in <module>
src.menu.mainMenu()
TypeError: 'module' object is not callable
老实说,我不知道如何解决