Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Run in a system service / without configuration #20122

Closed
@piegamesde

Description

@piegamesde

Problem

I'm trying to run a python service that transitively depends on matplotlib. When starting, matplotlib crashes on the try to somehow get a configuration directory, because neither $HOME nor $XDG_CONFIG_HOME are set (of course, why would they be in a system service?). I tried working around by setting MPLCONFIGDIR, but to no effect – it still crashes on line 415. This too makes sense when looking at the code, because _get_config_or_cache_dir already takes in xdg_base as an input – even though it may not necessarily be used.

This is not the only problematic place. I see that the font loading handler also tries to access $HOME, and there are probably even more places

Proposed Solution

I don't know matplotlib, and what it needs config/cache for. Ideally, this would somehow be an optional feature. It seems that there already is some code to handle the case where the specified directories are not writable, which falls back to some temporary directories. It would be cool if this fallback was also used when $HOME or some other environment variables are not set.

Additional context and prior art

My service is a Flask application, running with gunicorn as a systemd service.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions