Skip to content

[BUG] Crash caused by cache directory not being created #45

Closed
@jnlon

Description

@jnlon

Description

Executing steamctl --user <myaccount> apps list for the first time after installing results in a crash and stacktrace that ends with AttributeError: 'SqliteDict' object has no attribute '_db'.

The problem is that the cache directory (~/.cache/steamctl/) containing app_names.sqlite3 is not created automatically, the workaround is to create this directory manually so the sqlite connection succeeds.

Steps to Reproduce the behavior
Install steamctl for the first time and execute steamctl --user myaccount apps list.

Expected behavior
I expect to be prompted for my account details and for the traceback to not occur because ~/.cache/steamctl/app_names.sqlite3 was created successfully.

What actually happend
A crash/stacktrace occurs (see 'Logs' below).

Logs

steamctl --user myaccount -l debug apps list
[DEBUG] steamctl: Parsed args: {'versions_report': None, 'log_level': 'debug', 'anonymous': False, 'user': 'myaccount', 'command': 'apps', '_cmd_func': 'steamctl.commands.apps.gcmds:cmd_apps_list', 'subcommand': 'list', 'all': False}
Traceback (most recent call last):
  File "/home/steam/.local/bin/steamctl", line 8, in <module>
    sys.exit(main())
  File "/home/steam/.local/lib/python3.9/site-packages/steamctl/__main__.py", line 59, in main
    rcode = cmd_func(args=args)
  File "/home/steam/.local/lib/python3.9/site-packages/steamctl/commands/apps/gcmds.py", line 108, in cmd_apps_list
    app_names = get_app_names()
  File "/home/steam/.local/lib/python3.9/site-packages/steamctl/commands/apps/gcmds.py", line 41, in get_app_names
    papps = SqliteDict(UserCacheFile("app_names.sqlite3").path)
  File "/home/steam/.local/lib/python3.9/site-packages/steamctl/utils/storage.py", line 167, in __init__
    self._db = sqlite3.connect(path)
sqlite3.OperationalError: unable to open database file
Exception ignored in: <function SqliteDict.__del__ at 0x7f18cc9bf280>
Traceback (most recent call last):
  File "/home/steam/.local/lib/python3.9/site-packages/steamctl/utils/storage.py", line 209, in __del__
    self.commit()
  File "/home/steam/.local/lib/python3.9/site-packages/steamctl/utils/storage.py", line 206, in commit
    self._db.commit()
AttributeError: 'SqliteDict' object has no attribute '_db'

Versions Report

steamctl --versions-report (Run steamctl --versions-report and paste the output below)
steamctl: 0.9.0

Dependencies:
               steam: 1.2.0
             appdirs: 1.4.4
         argcomplete: 1.12.3
                tqdm: 4.62.3
               arrow: 1.2.1
            pyqrcode: 1.2.1
      beautifulsoup4: 4.10.0
                 vpk: 1.3.3
                 vdf: 3.4
 gevent-eventemitter: 2.1
              gevent: 21.12.0
            greenlet: 1.1.2
              pyyaml: 5.3.1
       pycryptodomex: 3.12.0
            protobuf: 3.19.1

Python runtime:
          executable: /usr/bin/python3
             version: 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110]
            platform: linux

System info:
              system: Linux
             machine: x86_64
             release: 5.10.0-10-amd64
             version: #1 SMP Debian 5.10.84-1 (2021-12-08)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions