A simple Flask server with connexion cannot be distribuate with pyinstaller

46 Views Asked by At

Context

I’m trying to distribute my python server that uses connexion with pyinstaller.

Unfortunately, the executable product not pyinstaller does not work. Of the first request an error 500 is issued while it is not in "normal" mode.

INFO:     Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "uvicorn/protocols/http/httptools_impl.py", line 419, in run_asgi
  File "uvicorn/middleware/proxy_headers.py", line 84, in __call__
  File "connexion/middleware/main.py", line 497, in __call__
    self.app, self.middleware_stack = self._build_middleware_stack()
  File "connexion/middleware/main.py", line 338, in _build_middleware_stack
    app.add_api(
  File "connexion/apps/flask.py", line 141, in add_api
    self.app.register_blueprint(api.blueprint)
  File "flask/sansio/scaffold.py", line 46, in wrapper_func
  File "flask/sansio/app.py", line 599, in register_blueprint
  File "flask/sansio/blueprints.py", line 310, in register
ValueError: The name '/swagger' is already registered for a different blueprint. Use 'name=' to provide a unique name.
INFO:     127.0.0.1:56490 - "GET /swagger/ui/ HTTP/1.1" 500 Internal Server Error

I created a simple server available on GitHub: repository

The question

Does anyone know why I have this error and how I can correct it?

I tried changing the server url and changing when the API is initialized, but it didn't change anything.

The aim would be to be able to distribute a server with a simple executable on any linux system.

0

There are 0 best solutions below