Python 2.7 синтаксическая ошибка при импорте модуля - PullRequest
0 голосов
/ 06 мая 2020

Прежде всего, спасибо за прочтение этого вопроса.

Я пытаюсь импортировать модуль в новый скрипт.

Я использую следующую команду:

import mosaic.qdfTrajIO as qdf 

Это возвращает следующую синтаксическую ошибку:

runfile('C:/Users/reneb/projects/mosaic/mosaic/utilities/mosaicLogging.py',
wdir='C:/Users/reneb/projects/mosaic/mosaic/utilities')


File "C:/Users/reneb/projects/mosaic/mosaic/utilities/mosaicLogging.py", line 50
class mosaicLogging(object, metaclass=metaSingleton):
                                     ^

SyntaxError: недопустимый синтаксис

Это код со строк 42 по 59:

class MessageFormatter(logging.Formatter):
def format(self, record):
    try:
        record.msg = record.msg.strip()
    except:
        pass
    return super(MessageFormatter, self).format(record)

class mosaicLogging(object, metaclass=metaSingleton): #this is where the error takes place

"""A custom logging class that uses the Python logging facility. Logs are automatically saved to a metaMDIO instance,
    and to a file log when DeveloperMode is active.
"""

_loggers = {}

log=logging.getLogger()
log.setLevel(logging.DEBUG)
...