Sirmentio / protontricks

A simple wrapper that does winetricks things for Proton enabled games, requires Winetricks.
GNU General Public License v3.0
183 stars 26 forks source link

Protontricks failing with AttributeError: 'NoneType' object has no attribute 'group' #42

Open Kilinor opened 5 years ago

Kilinor commented 5 years ago

After running the command: protontricks 359320 dotnet40 win7

I get the following response: [INFO] Found Steam directory at /home/$USER/.steam/steam. You can also define Steam directory manually using $STEAM_DIR [INFO] WINETRICKS environment variable is not available. Falling back to /usr/bin/winetricks [INFO] Found 1 Steam library folders Traceback (most recent call last): File "/usr/bin/protontricks", line 310, in steam_apps = get_steam_apps(steam_lib_dirs) File "/usr/bin/protontricks", line 250, in get_steam_apps steam_app = SteamApp.from_appmanifest(path) File "/usr/bin/protontricks", line 93, in from_appmanifest appid = int(re.search(r'(\t"appid"\s+")([0-9]+)', content).group(2)) AttributeError: 'NoneType' object has no attribute 'group'

Kilinor commented 5 years ago

This error occurs when one of the library paths is on an NTFS mount.

cv-shiyanshi commented 5 years ago

@Kilinor Hi,Can you share how do you solved it?

nonchip commented 5 years ago

this error just occured to me with none of the library paths being on an ntfs mount.

$ protontricks 551770 shell
[INFO] Found Steam directory at /home/kyra/.steam/steam. You can also define Steam directory manually using $STEAM_DIR
[INFO] WINETRICKS environment variable is not available. Falling back to /usr/bin/winetricks
[INFO] Found 0 Steam library folders
Traceback (most recent call last):
  File "/usr/local/bin/protontricks", line 316, in <module>
    steam_dir=steam_dir, steam_apps=steam_apps)
  File "/usr/local/bin/protontricks", line 163, in find_current_proton_app
    proton_appid = re.search(appid_regex, appinfo).group(2)
AttributeError: 'NoneType' object has no attribute 'group'

$ ls .steam/steam/steamapps/compatdata/551770/
pfx  pfx.lock  tracked_files  version

$ mount
(...)
/dev/mapper/vg_pool-lv_root on / type ext4 (rw,relatime)
(...)

interestingly it worked perfectly fine about a week ago.

if i had to guess i'd say valve might be updating their proprietary binary appinfo.vdf format from time to time, breaking compatibility? why do you need to parse that anyway? looks like you're just getting the proton version to use from there, and that's already in plain text in config.vdf (which btw you're also parsing wrong, but at least according to the comment you know that) under "CompatToolMapping"...

cyro666 commented 5 years ago

Yup, just happened to me as well. Used to work a few weeks ago. I just did a protontricks -c "pwd" 2100. Seems to only happen with some of the games, not all. Weird.

Judging by the fact that it just started to happen without me updating protontricks, I'd say the fault is probably in the way Steam works. They must have changed something. Or maybe it's because of python 3.7.3, but I doubt it.

nonchip commented 5 years ago

@cyro666 turns out just using the fork from https://github.com/Matoking/protontricks fixed it :P this repo is not maintained anymore anyway, that's the one @Sirmentio recommends.

as for the reason: they have changed the way their appinfo.vdf cache file works, and this version essentially just greps (not really, but the equivalent in python) it and has a hardcoded offset it reads and then assumes automatic success, while the forked version parses that file a bit more robust.