21
Июл
2021

Ошибка при запуске Flask

Ошибка при запуске flask сервера из PyCharm (In folder D:/build-market C:\Users\denis\AppData\Local\Programs\Python\Python38-32\python.exe -m flask run). А когда запускаю через консоль(python routes.py) ошибка не возникает. Как исправить?

Traceback (most recent call last):
  File "C:\Users\denis\AppData\Local\Programs\Python\Python38-32\lib\runpy.py", line 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\denis\AppData\Local\Programs\Python\Python38-32\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\denis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\flask\__main__.py", line 15, in <module>
    main(as_module=True)
  File "C:\Users\denis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\flask\cli.py", line 967, in main
    cli.main(args=sys.argv[1:], prog_name="python -m flask" if as_module else None)
  File "C:\Users\denis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\flask\cli.py", line 586, in main
    return super(FlaskGroup, self).main(*args, **kwargs)
  File "C:\Users\denis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\click\core.py", line 1062, in main
    rv = self.invoke(ctx)
  File "C:\Users\denis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\click\core.py", line 1662, in invoke
    cmd_name, cmd, args = self.resolve_command(ctx, args)
  File "C:\Users\denis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\click\core.py", line 1709, in resolve_command
    cmd = self.get_command(ctx, cmd_name)
  File "C:\Users\denis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\flask\cli.py", line 527, in get_command
    self._load_plugin_commands()
  File "C:\Users\denis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\flask\cli.py", line 523, in _load_plugin_commands
    self.add_command(ep.load(), ep.name)
  File "C:\Users\denis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pkg_resources\__init__.py", line 2443, in load
    return self.resolve()
  File "C:\Users\denis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pkg_resources\__init__.py", line 2449, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "C:\Users\denis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\flask_migrate\__init__.py", line 11, in <module>
    from alembic import __version__ as __alembic_version__
  File "C:\Users\denis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\alembic\__init__.py", line 3, in <module>
    from . import context  # noqa
  File "C:\Users\denis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\alembic\context.py", line 1, in <module>
    from .runtime.environment import EnvironmentContext
  File "C:\Users\denis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\alembic\runtime\environment.py", line 1, in <module>
    from .migration import MigrationContext
  File "C:\Users\denis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\alembic\runtime\migration.py", line 15, in <module>
    from .. import ddl
  File "C:\Users\denis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\alembic\ddl\__init__.py", line 1, in <module>
    from . import mssql  # noqa
  File "C:\Users\denis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\alembic\ddl\mssql.py", line 8, in <module>
    from .base import AddColumn
  File "C:\Users\denis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\alembic\ddl\base.py", line 11, in <module>
    from ..util.sqla_compat import _columns_for_constraint  # noqa
  File "C:\Users\denis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\alembic\util\__init__.py", line 21, in <module>
    from .pyfiles import coerce_resource_to_filename  # noqa
  File "C:\Users\denis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\alembic\util\pyfiles.py", line 5, in <module>
    from mako import exceptions
  File "C:\Users\denis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\mako\exceptions.py", line 11, in <module>
    from mako import util, compat
  File "C:\Users\denis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\mako\util.py", line 11, in <module>
    from mako import compat
  File "C:\Users\denis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\mako\compat.py", line 124, in <module>
    time_func = time.clock
AttributeError: module 'time' has no attribute 'clock'

Источник: https://ru.stackoverflow.com/questions/1307471/%D0%9E%D1%88%D0%B8%D0%B1%D0%BA%D0%B0-%D0%BF%D1%80%D0%B8-%D0%B7%D0%B0%D0%BF%D1%83%D1%81%D0%BA%D0%B5-flask

Тебе может это понравится...

Добавить комментарий