mnamer icon indicating copy to clipboard operation
mnamer copied to clipboard

Container running under Podman errors with sqlite3.OperationalError: unable to open database file

Open wadebee opened this issue 2 years ago • 2 comments

Similar error to Issue #133 however the suggested --no-cache workaround does not work.

Podman is a drop-in replacement for Docker however it does not permit containers to run as root. Wondering if this issue is related to that?

Here is how I launch the container session: podman run -it --rm --name b3vis-mnamer -v /home/wade/Movies:/mnt --entrypoint "/bin/sh" b3vis/mnamer:latest

Here is the mnamer command I used: python -m mnamer -v --no-cache -r /mnt

system

  • date = 2023-01-02
  • platform = Linux-5.15.0-56-generic-x86_64-with
  • arguments = ['-v', '--no-cache', '-r', '/mnt']
  • cache location = /root/.cache/mnamer-py3.9.sql
  • python version = 3.9.9
  • mnamer version = 2.5.2
  • appdirs version = 1.4.4
  • babelfish version = 0.5.5-dev
  • guessit version = 3.2.0
  • requests version = 2.26.0
  • requests cache version = 0.5.2
  • teletype version = 1.1.0

settings

  • targets = [PosixPath('/mnt')]
  • batch = False
  • lower = False
  • recurse = True
  • scene = False
  • verbose = True
  • hits = 5
  • ignore = ['.sample.', '^RARBG.*']
  • language = None
  • mask = ['.avi', '.m4v', '.mp4', '.mkv', '.ts', '.wmv', '.srt', '.idx', '.sub']
  • no_guess = False
  • no_overwrite = False
  • no_style = False
  • movie_api = tmdb
  • movie_directory = None
  • movie_format = {name} ({year}).{extension}
  • episode_api = tvmaze
  • episode_directory = None
  • episode_format = {series} - S{season:02}E{episode:02} - {title}.{extension}
  • version = False
  • clear_cache = False
  • config_dump = False
  • config_ignore = False
  • config_path = None
  • id_imdb = None
  • id_tmdb = None
  • id_tvdb = None
  • id_tvmaze = None
  • no_cache = True
  • media = None
  • test = False
  • api_key_omdb = None
  • api_key_tmdb = None
  • api_key_tvdb = None
  • api_key_tvmaze = None
  • replace_before = {}
  • replace_after = {'&': 'and', '@': 'at', ';': ','}

targets

  • /mnt/SNL_SEASON_1_VOL_2/Saturday Night Live S1 E4.mkv
  • /mnt/SNL_SEASON_1_VOL_2/Saturday Night Live S1 V2 E2.mkv
  • /mnt/SNL_SEASON_1_VOL_2/Saturday Night Live S1 V2 E3.mkv Starting mnamer

Processing Episode "Saturday Night Live S1 E4.mkv" (2.26GB) /mnt/SNL_SEASON_1_VOL_2/Saturday Night Live S1 E4.mkv using tvmaze

search parameters

  • container = .mkv
  • group = None
  • language = None
  • language_sub = None
  • quality = None
  • synopsis = None
  • media = episode
  • series = Saturday Night Live
  • season = 1
  • episode = 4
  • date = None
  • title = None
  • id_tvdb = None
  • id_tvmaze = None
  • extension = .mkv

============================== CRASH REPORT BEGIN ==============================

--------------------------------- environment ----------------------------------

  • date = 2023-01-02
  • platform = Linux-5.15.0-56-generic-x86_64-with
  • arguments = ['-v', '--no-cache', '-r', '/mnt']
  • cache location = /root/.cache/mnamer-py3.9.sql
  • python version = 3.9.9
  • mnamer version = 2.5.2
  • appdirs version = 1.4.4
  • babelfish version = 0.5.5-dev
  • guessit version = 3.2.0
  • requests version = 2.26.0
  • requests cache version = 0.5.2
  • teletype version = 1.1.0

--------------------------------- stack trace ----------------------------------

Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/mnamer/main.py", line 23, in main frontend.launch() File "/usr/local/lib/python3.9/site-packages/mnamer/frontends.py", line 80, in launch self._process_targets() File "/usr/local/lib/python3.9/site-packages/mnamer/frontends.py", line 97, in _process_targets matches = target.query() File "/usr/local/lib/python3.9/site-packages/mnamer/target.py", line 233, in query for idx, result in enumerate(results, start=1): File "/usr/local/lib/python3.9/site-packages/mnamer/providers.py", line 374, in search yield from self._search_with_season_and_episode( File "/usr/local/lib/python3.9/site-packages/mnamer/providers.py", line 437, in _search_with_season_and_episode series_data = tvmaze_show_search(series) File "/usr/local/lib/python3.9/site-packages/mnamer/endpoints.py", line 466, in tvmaze_show_search status, content = request_json(url, parameters, cache=cache) File "/usr/local/lib/python3.9/site-packages/mnamer/utils.py", line 264, in request_json session = get_session() File "/usr/local/lib/python3.9/site-packages/mnamer/utils.py", line 188, in get_session get_session.session = requests_cache.CachedSession( File "/usr/local/lib/python3.9/site-packages/requests_cache/core.py", line 73, in init self.cache = backends.create_backend(backend, cache_name, backend_options) File "/usr/local/lib/python3.9/site-packages/requests_cache/backends/init.py", line 63, in create_backend return registry[backend_name](cache_name, **options) File "/usr/local/lib/python3.9/site-packages/requests_cache/backends/sqlite.py", line 28, in init self.responses = DbPickleDict(location + extension, 'responses', fast_save=fast_save) File "/usr/local/lib/python3.9/site-packages/requests_cache/backends/storage/dbdict.py", line 62, in init with self.connection() as con: File "/usr/local/lib/python3.9/contextlib.py", line 119, in enter return next(self.gen) File "/usr/local/lib/python3.9/site-packages/requests_cache/backends/storage/dbdict.py", line 74, in connection con = sqlite.connect(self.filename) sqlite3.OperationalError: unable to open database file

=============================== CRASH REPORT END ===============================

Dang, it looks like mnamer crashed! Please consider filling an issue at https://github.com/jkwill87/mnamer/issues along with this report.

wadebee avatar Jan 02 '23 00:01 wadebee

I was able to work around this issue after noticing that the /root/.cache folder does not exist in this container.

mkdir /root/.cache

wadebee avatar Jan 02 '23 14:01 wadebee

I also just happened to find this problem. Apparently, requests_cache looks for the XDG_CACHE_HOME env var, so it will also fail for other users when the respective path is non-existent.

But I think the root of this problem lays in --no-cache being ignored by either mnamer or requests_cache itself (as you already wrote, @wadebee). It must have worked before, because I only stumbled upon this after re-building an older Docker image in which I installed mnamer (without using a pinned version, sadly, so I can't really tell since when it is broken). :thinking:

c4tz avatar Apr 14 '24 15:04 c4tz