fcpihtr
fcpihtr

Reputation: 175

Python3 No Module Named Config

When running python3 app.py I get error:

File "app.py", line 5, in <module>
    from Config import config
ModuleNotFoundError: No module named 'Config'

Here's the contents of 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

python3 --version: Python 3.6.9

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.

Upvotes: 0

Views: 8307

Answers (2)

Marto
Marto

Reputation: 31

To solve this issue, you have to install the config module using the following command on the terminal

pip3 install config

and reload the code editor if it doesn't correct the error

Upvotes: 0

Henrique Andrade
Henrique Andrade

Reputation: 991

Config is not a module, it's a python file that is missing from this github repository.

If you go into the repository's .gitignore, you can see Config.py in the last line.

Upvotes: 3

Related Questions