Skip to content

[BUG] SyntaxError: Invalid magic, got b')DV\x07' #462

Description

@WinterPhoenix

Description
Steam Client Beta seems to be rolling out a new format again.

Steps to Reproduce the behavior

>>> from steam.utils.appcache import parse_appinfo
>>> header, apps = parse_appinfo(open(r"C:\Users\Winter\Desktop\WIP\appinfo.vdf", "rb"))

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\Python311_64\Lib\site-packages\steam\utils\appcache.py", line 73, in parse_appinfo
    raise SyntaxError("Invalid magic, got %s" % repr(magic))
SyntaxError: Invalid magic, got b')DV\x07'

Example appinfo.vdf, like last time:
appinfo.zip

Versions Report

steam: 1.4.4

Dependencies:
                 vdf: 3.4
            protobuf: 4.21.11
            requests: 2.31.0
          cachetools: 5.2.0
              gevent: Not Installed
 gevent-eventemitter: Not Installed
       pycryptodomex: 3.16.0
              enum34: Not Installed
       win-inet-pton: Not Installed

Python runtime:
          executable: D:\Python311_64\python.exe
             version: 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)]
            platform: win32

System info:
              system: Windows
             machine: AMD64
             release: 10
             version: 10.0.19045

Activity

  1. sonic2kk commented on Jun 28, 2024

    @sonic2kk

    Looks like the magic changed again for appinfo.vdf, happened a little while ago as well: #418.

  2. Matoking commented on Jun 28, 2024

    @Matoking

    Had a look at the new appinfo.vdf format. Not a case of just the magic number being changed:

    #463 (comment)

  3. WinterPhoenix commented on Jul 8, 2024

    @WinterPhoenix
    Author

    @rossengeorgiev Please review the relevant PRs. This should really be fixed sooner rather than later.

  4. WinterPhoenix commented on Jul 25, 2024

    @WinterPhoenix
    Author

    I made a fork that incorporates the PR that fixes this, as well as several other pending PRs in this repo. I don't really particularly want to be the new maintainer for this, but if I'm still using it I may as well. PRs on the fork welcome.

    https://github.com/solsticegamestudios/steam

  5. Matoking commented on Jul 29, 2024

    @Matoking

    One option would be to vendor the relevant code and/or libraries, though I don't know if that is possible for projects using GPL and other similar licenses like Protontricks. Debian also doesn't like vendored code to my knowledge.

    I've instead opted to push a version to Flathub beta branch with the fix. For pip users I've instructed to install the libraries from GitHub directly. Other than that, the current options are limited as vdf and steam libraries are packaged by upstream distros.

    @rossengeorgiev has had some sporadic activity on GitHub, but these two ValvePython projects haven't had any activity in a while. I have to emphasize that they're not obligated to work on these libraries - open source development is often a thankless job and maintainers are prone to burnout, after all - though it would be appreciated if they could state whether these projects are in maintenance mode or abandoned.

  6. added a commit that references this issue on Aug 3, 2024
    052a6ae
  7. ample-samples commented on Nov 15, 2024

    @ample-samples

    I would post this on @WinterPhoenix 's fork (https://github.com/solsticegamestudios/steam) but it doesn't allow issues:

    I've installed the package with this command:
    python -m pip install -U "git+https://github.com/solsticegamestudios/steam#egg=steam"

    Running this code:

    from steam.utils.appcache import parse_appinfo
    header, apps = parse_appinfo(open('c:\\Steam\\appcache\\appinfo.vdf', 'rb'))
    print(next(apps))
    

    raises a TypeError:

    Traceback (most recent call last):
      File "c:\Projects\tests\appinfo_test.py", line 3, in <module>
        print(next(apps))
              ^^^^^^^^^^
      File "C:\Users\{my_name}\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\steam\utils\appcache.py", line 137, in apps_iter
        app['data'] = binary_load(fp, key_table=key_table, mapper=mapper)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\{my_name}\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\vdf\__init__.py", line 326, in binary_load
        if not issubclass(mapper, Mapping):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "<frozen abc>", line 123, in __subclasscheck__
    TypeError: issubclass() arg 1 must be a class
    

    Printing the header comes back fine:
    {'magic': b')DV\x07', 'universe': 1}

    Could the Valve have broken this again?

    Nevermind, running:
    header, apps = parse_appinfo(open('c:\\Steam\\appcache\\appinfo.vdf', 'rb'), mapper=dict)
    works completely fine

  8. WinterPhoenix commented on Nov 15, 2024

    @WinterPhoenix
    Author

    Issues are enabled… What does it say when you try to create one, specifically?

  9. ample-samples commented on Nov 15, 2024

    @ample-samples

    Nevermind it actually does, I was looking at another steam fork

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions