Can't import fLASK
romainkarpinski (0)

Hi, when i try to import flask, it says that the current flask version is not compatible with the current repl version.. what should i do? is it possible to fix this? ty for your help

You are viewing a single comment. View All
xfinnbar (134)

THe replit package includes it's own Flask fork. Instead of using from flask import Flask use from replit.web import App and use app = App(__name__) instead of app = Flask(__name__). This flask fork adds a few new features like login with replit for your site. See its docs here

romainkarpinski (0)

@xfinnbar it fixed most of my problems ty, but now i get this error mesage: ValueError: signal only works in main thread .. How can i fix this?

romainkarpinski (0)

@xfinnbar File "/usr/lib/python3.8/", line 47, in signal
handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler)), this is the last file mentionned in the log before the error message

romainkarpinski (0)

@xfinnbar full log:

  • Running on (Press CTRL+C to quit)
    Exception in thread Thread-1:
    Traceback (most recent call last):
    File "/usr/lib/python3.8/", line 932, in _bootstrap_inner
    File "/usr/lib/python3.8/", line 870, in run
    self._target(self._args, self._kwargs)
    File "/home/runner/BOT/", line 11, in run
    File "/opt/virtualenvs/python3/lib/python3.8/site-packages/replit/web/", line 147, in run
    super().run(host="localhost" if localhost else "", port=port,
    File "/opt/virtualenvs/python3/lib/python3.8/site-packages/flask/", line 990, in run
    run_simple(host, port, self, **options)
    File "/opt/virtualenvs/python3/lib/python3.8/site-packages/werkzeug/", line 1050, in run_simple
    run_with_reloader(inner, extra_files, reloader_interval, reloader_type)
    File "/opt/virtualenvs/python3/lib/python3.8/site-packages/werkzeug/", line 330, in run_with_reloader
    signal.signal(signal.SIGTERM, lambda
    args: sys.exit(0))
    File "/usr/lib/python3.8/", line 47, in signal
    handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
    ValueError: signal only works in main thread
xfinnbar (134)

@romainkarpinski I forked the repl and fixed it, copy across my pyproject.toml file and file.

romainkarpinski (0)

@xfinnbar it works perfectly, ty so much for helping me :)