[英]Python3 No Module Named Config
When running python3 app.py I get error:运行 python3 app.py 时出现错误:
File "app.py", line 5, in <module>
from Config import config
ModuleNotFoundError: No module named 'Config'
Here's the contents of app.py:这是app.py的内容:
'<cross-domain-policy><allow-access-from domain="*" to-ports="*" /></cross-domain-policy>'
import logging, sys, json, os, signal, logging
from logging.handlers import TimedRotatingFileHandler
from colorlog import ColoredFormatter
from Config import config
from Utils.EventManeger import EventHandler
#from Handlers import Login
from Engine.Engine import CJSnowFactory
from twisted.internet import protocol, reactor, task
from twisted.python import log
log.startLogging(sys.stdout)
def InitiateColorLogger(name='cjsnow'):
cjsnow_logger = logging.getLogger("cjsnow")
cjsnow_stream = logging.StreamHandler()
LogFormat = " %(reset)s%(log_color)s%(levelname)-8s%(reset)s | %(log_color)s%(message)s"
cjsnow_stream.setFormatter(ColoredFormatter(LogFormat, log_colors={
'DEBUG': 'white',
'INFO': 'cyan',
'WARNING': 'yellow',
'ERROR': 'red',
'CRITICAL': 'black,bg_red',
'TAG': 'white',
}))
cjsnow_logger.addHandler(cjsnow_stream)
cjsnow_logger.setLevel(logging.DEBUG)
return cjsnow_logger
CjsnowLogger = InitiateColorLogger()
logger = logging.getLogger("cjsnow")
def onExitSignal(*a):
logger.warning("closing?")
if not reactor.running:
os._exit(1)
else:
reactor.callFromThread(reactor.stop)
for sig in (signal.SIGABRT, signal.SIGILL, signal.SIGINT, signal.SIGSEGV, signal.SIGTERM):
signal.signal(sig, onExitSignal)
server = CJSnowFactory(server="Login")
server.start()
I have already tried: pip3 install Config
我已经尝试过:
pip3 install Config
python3 --version: Python 3.6.9
python3 --版本:
Python 3.6.9
pip3 --version: pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)
pip3 --version:
pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)
Other files refer to the config - here is the github page for them if that helps: https://github.com/klabacher/Tusk - so editing the config lines out isn't an option.其他文件是指配置 - 如果有帮助,这里是 github 页面: https://github.com/klabacher/Tusk - 所以编辑配置行不是一个选项。
Config is not a module, it's a python file that is missing from this github repository. Config 不是一个模块,它是一个 python 文件,此 github 存储库中缺少该文件。
If you go into the repository's .gitignore
, you can see Config.py
in the last line.如果您将 go 放入存储库的
.gitignore
,您可以在最后一行看到Config.py
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.