Mime type check of file uploaded

Dear Sir ,

I am trying to check mime type of file uploaded at time of abstract. in orde to address this installed python-magic in indico virtual enviornment but when i compile below error message:your server socket listen backlog is limited to 100 connections
Feb 12 10:32:00 decadeofastrosat indico-uwsgi[363266]: your mercy for graceful operations on workers is 60 seconds
Feb 12 10:32:00 decadeofastrosat indico-uwsgi[363266]: mapped 446520 bytes (436 KB) for 4 cores
Feb 12 10:32:00 decadeofastrosat indico-uwsgi[363266]: *** Operational MODE: preforking ***
Feb 12 10:32:02 decadeofastrosat indico-uwsgi[363266]: /opt/indico/.venv/lib/python3.12/site-packages/indico/core/config.py:218: UserWarning: Ignoring unknown config key PROPAGATE_EXCEPTIONS
Feb 12 10:32:02 decadeofastrosat indico-uwsgi[363266]: config = _sanitize_data(_parse_config(path))
Feb 12 10:32:02 decadeofastrosat indico-uwsgi[363266]: Traceback (most recent call last):
Feb 12 10:32:02 decadeofastrosat indico-uwsgi[363266]: File “/opt/indico/web/indico.wsgi”, line 9, in
Feb 12 10:32:02 decadeofastrosat indico-uwsgi[363266]: application = make_app()
Feb 12 10:32:02 decadeofastrosat indico-uwsgi[363266]: ^^^^^^^^^^
Feb 12 10:32:02 decadeofastrosat indico-uwsgi[363266]: File “/opt/indico/.venv/lib/python3.12/site-packages/indico/web/flask/app.py”, line 418, in make_app
Feb 12 10:32:02 decadeofastrosat indico-uwsgi[363266]: init_sentry(app)
Feb 12 10:32:02 decadeofastrosat indico-uwsgi[363266]: File “/opt/indico/.venv/lib/python3.12/site-packages/indico/core/sentry.py”, line 38, in init_sentry
Feb 12 10:32:02 decadeofastrosat indico-uwsgi[363266]: sentry_sdk.init(
Feb 12 10:32:02 decadeofastrosat indico-uwsgi[363266]: File “/opt/indico/.venv/lib/python3.12/site-packages/sentry_sdk/hub.py”, line 103, in _init
Feb 12 10:32:02 decadeofastrosat indico-uwsgi[363266]: client = Client(*args, **kwargs) # type: ignore
Feb 12 10:32:02 decadeofastrosat indico-uwsgi[363266]: ^^^^^^^^^^^^^^^^^^^^^^^
Feb 12 10:32:02 decadeofastrosat indico-uwsgi[363266]: File “/opt/indico/.venv/lib/python3.12/site-packages/sentry_sdk/client.py”, line 186, in init
Feb 12 10:32:02 decadeofastrosat indico-uwsgi[363266]: self._init_impl()
Feb 12 10:32:02 decadeofastrosat indico-uwsgi[363266]: File “/opt/indico/.venv/lib/python3.12/site-packages/sentry_sdk/client.py”, line 306, in _init_impl
Feb 12 10:32:02 decadeofastrosat indico-uwsgi[363266]: self.integrations = setup_integrations(
Feb 12 10:32:02 decadeofastrosat indico-uwsgi[363266]: ^^^^^^^^^^^^^^^^^^^
Feb 12 10:32:02 decadeofastrosat indico-uwsgi[363266]: File “/opt/indico/.venv/lib/python3.12/site-packages/sentry_sdk/integrations/init.py”, line 135, in setup_integrations
Feb 12 10:32:02 decadeofastrosat indico-uwsgi[363266]: type(integration).setup_once()
Feb 12 10:32:02 decadeofastrosat indico-uwsgi[363266]: File “/opt/indico/.venv/lib/python3.12/site-packages/sentry_sdk/integrations/flask.py”, line 66, in setup_once
Feb 12 10:32:02 decadeofastrosat indico-uwsgi[363266]: version = package_version(“flask”)
Feb 12 10:32:02 decadeofastrosat indico-uwsgi[363266]: ^^^^^^^^^^^^^^^^^^^^^^^^
Feb 12 10:32:02 decadeofastrosat indico-uwsgi[363266]: File “/opt/indico/.venv/lib/python3.12/site-packages/sentry_sdk/utils.py”, line 1715, in package_version
Feb 12 10:32:02 decadeofastrosat indico-uwsgi[363266]: installed_packages = _get_installed_modules()
Feb 12 10:32:02 decadeofastrosat indico-uwsgi[363266]: ^^^^^^^^^^^^^^^^^^^^^^^^
Feb 12 10:32:02 decadeofastrosat indico-uwsgi[363266]: File “/opt/indico/.venv/lib/python3.12/site-packages/sentry_sdk/utils.py”, line 1709, in _get_installed_modules
Feb 12 10:32:02 decadeofastrosat indico-uwsgi[363266]: _installed_modules = dict(_generate_installed_modules())
Feb 12 10:32:02 decadeofastrosat indico-uwsgi[363266]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Feb 12 10:32:02 decadeofastrosat indico-uwsgi[363266]: File “/opt/indico/.venv/lib/python3.12/site-packages/sentry_sdk/utils.py”, line 1678, in _generate_installed_modules
Feb 12 10:32:02 decadeofastrosat indico-uwsgi[363266]: name = dist.metadata[“Name”]
Feb 12 10:32:02 decadeofastrosat indico-uwsgi[363266]: ~~~~~~~~~~~~~^^^^^^^^
Feb 12 10:32:02 decadeofastrosat indico-uwsgi[363266]: File “/opt/indico/.venv/lib/python3.12/site-packages/importlib_metadata/_adapters.py”, line 54, in getitem
Feb 12 10:32:02 decadeofastrosat indico-uwsgi[363266]: raise KeyError(item)
Feb 12 10:32:02 decadeofastrosat indico-uwsgi[363266]: KeyError: ‘Name’
Feb 12 10:32:02 decadeofastrosat indico-uwsgi[363266]: unable to load app 0 (mountpoint=‘’) (callable not found or import error)
Feb 12 10:32:02 decadeofastrosat indico-uwsgi[363266]: *** no app loaded. going in full dynamic mode ***
Feb 12 10:32:02 decadeofastrosat indico-uwsgi[363266]: spawned uWSGI master process (pid: 363266)
Feb 12 10:32:02 decadeofastrosat systemd[1]: Started Indico uWSGI.

I am not getting help any where hence posting here . please help and guide how to enforce only pdf upload for attachement (mime type check) extension checking i am able to do

Show your actual code changes instead of (only) an unformatted traceback…

Also, simply installing a library won’t help. In fact, you do not need magic file type detection to get a mime type. The errors you get actually look like you somehow messed up your Python environment. Seeing the output from when you installed the library might help.

PS: You’re expected to have a local dev setup if you want to do development where you usually get more useful errors and better formatted tracebacks, and could share a git diff of the changes you made.