Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: unsupported operand type(s) for /: 'NoneType' and 'str' #10

Open
equesvasil opened this issue Jan 23, 2022 · 6 comments
Open

Comments

@equesvasil
Copy link

equesvasil commented Jan 23, 2022

Hello. When i launch protontricks with flag --gui its show not all games(only 2 of them) and when i select one of them its crashes.

pivnoi@pivnoi:~$ flatpak run com.github.Matoking.protontricks -v --gui
protontricks (INFO): Running inside Flatpak sandbox, version 1.6.5.
protontricks (WARNING): Flatpak version is too old (<1.12.1) to support sub-sandboxes. Disabling bwrap. --no-bwrap will be ignored.
protontricks (INFO): Found Steam directory at /home/pivnoi/.var/app/com.valvesoftware.Steam/data/Steam. You can also define Steam directory manually using $STEAM_DIR
protontricks (INFO): Using default Steam Runtime at /home/pivnoi/.steam/root/ubuntu12_32/steam-runtime
protontricks (INFO): WINETRICKS environment variable is not available. Searching from $PATH.
protontricks (INFO): Found 1 Steam library folders
protontricks (INFO): Currently logged-in Steam user: equesvasil
protontricks (INFO): Couldn't find custom shortcuts. Maybe none have been created yet?
protontricks (INFO): Using 'yad' as GUI provider
protontricks (INFO): Found active compatibility tool: Proton 5.13
protontricks (INFO): Active compatibility tool is a Proton installation
protontricks (INFO): WINE environment variable is not available. Setting WINE environment variable to Proton bundled version
Traceback (most recent call last):
  File "/app/bin/protontricks", line 8, in <module>
    sys.exit(cli())
  File "/app/lib/python3.9/site-packages/protontricks/cli/main.py", line 28, in cli
    main(args)
  File "/app/lib/python3.9/site-packages/protontricks/cli/util.py", line 143, in wrapper
    return cli_func(self, *args, **kwargs)
  File "/app/lib/python3.9/site-packages/protontricks/cli/main.py", line 220, in main
    run_command(
  File "/app/lib/python3.9/site-packages/protontricks/util.py", line 352, in run_command
    str(proton_app.proton_dist_path / "bin" / "wine")
TypeError: unsupported operand type(s) for /: 'NoneType' and 'str'
@Matoking
Copy link
Collaborator

Do you have two installations of Steam, one installed using Flatpak and another other than Flatpak? Protontricks found both ~/.steam/root and ~/.var/app/com.valvesoftware.Steam but in this case it should prioritize the Flatpak installation of Steam (i.e. ~/.var/app/com.valvesoftware.Steam) instead of mixing the two installations together, as it has done here and which might explain the crash. I'll prepare a fix for this.


If you are intending to use Protontricks Flatpak with the non-Flatpak version of Steam, you could either remove the other Steam installation or use the STEAM_DIR environment variable to explicitly choose the Steam installation. For example, you could use the following command:

STEAM_DIR=$HOME/.steam/steam flatpak run com.github.Matoking.protontricks -v --gui

You could also create aliases to separate the two installations. For example, you could add these to your ~/.bashrc to create two different commands, one for Flatpak and the other for your distro's own Steam installation. This could be handy if you need two installations of Steam:

alias protontricks-flat="flatpak run com.github.Matoking.protontricks"
alias protontricks="STEAM_DIR=$HOME/.steam/steam flatpak run com.github.Matoking.protontricks"

Matoking added a commit to Matoking/protontricks that referenced this issue Jan 24, 2022
When both Flatpak and non-Flatpak versions of Steam are installed for
the same user, Steam installation detection might return two paths that
correspond to two different installations of Steam.

Ensure that the two paths returned by `find_steam_path` are the same
when Flatpak sandbox is active and Flatpak installation directory is
found.

Refs flathub/com.github.Matoking.protontricks#10
@Matoking
Copy link
Collaborator

I've pushed a potential fix to the Steam installation discovery. Could you try installing the fix using the following command and check if it fixes the issue?

flatpak install --user https://dl.flathub.org/build-repo/73729/com.github.Matoking.protontricks.flatpakref

@equesvasil
Copy link
Author

STEAM_DIR=$HOME/.steam/steam flatpak run com.github.Matoking.protontricks -v --guiit's worked nicely! No crash and i can see games in my library. Thanks!
flatpak install --user https://dl.flathub.org/build-repo/73729/com.github.Matoking.protontricks.flatpakrefit's not worked. I see again wrong steam installation and its crashes with same error like before.

Matoking added a commit to Matoking/protontricks that referenced this issue Jan 25, 2022
Incomplete Proton installations where the `dist` directory does not
exist yet cause Protontricks to crash. Check for this and instruct the
user to launch a Steam app at least once to ensure the installation is
complete.

Refs flathub/com.github.Matoking.protontricks#10
@Matoking
Copy link
Collaborator

The Flatpak version of Protontricks defaulting to the Flatpak version of Steam is intentional, but the crash is not.

It seems like that Proton is installed for Flatpak Steam, but hasn't been launched yet, which is causing the crash. Proton versions except for Proton Experimental install a directory named dist the first time that Proton installation is used to launch an app, which Protontricks needs to work properly.

I've pushed another potential fix. Could you try running this command to install the newer fix:

flatpak install --user https://dl.flathub.org/build-repo/73814/com.github.Matoking.protontricks.flatpakref

After that, try running the following command:

$ flatpak run com.github.Matoking.protontricks -v --gui

Assuming everything works correctly, it should now instruct the user to launch a Steam app at least once to ensure that the Proton installation is finished. If not, the problem is probably elsewhere and needs more investigation.

@equesvasil
Copy link
Author

equesvasil commented Jan 26, 2022

flatpak install --user https://dl.flathub.org/build-repo/73814/com.github.Matoking.protontricks.flatpakref

log changes but still only 2 games and crashes...

protontricks (INFO): Running inside Flatpak sandbox, version 1.6.5.
protontricks (WARNING): Flatpak version is too old (<1.12.1) to support sub-sandboxes. Disabling bwrap. --no-bwrap will be ignored.
protontricks (INFO): Found Steam directory at /home/pivnoi/.var/app/com.valvesoftware.Steam/data/Steam. You can also define Steam directory manually using $STEAM_DIR
protontricks (INFO): Using default Steam Runtime at /home/pivnoi/.var/app/com.valvesoftware.Steam/data/Steam/ubuntu12_32/steam-runtime
protontricks (INFO): WINETRICKS environment variable is not available. Searching from $PATH.
protontricks (INFO): Found 1 Steam library folders
protontricks (INFO): Currently logged-in Steam user: equesvasil
protontricks (INFO): Couldn't find custom shortcuts. Maybe none have been created yet?
protontricks (INFO): Using 'yad' as GUI provider
protontricks (INFO): Found active compatibility tool: Proton 5.13
protontricks (INFO): Active compatibility tool is a Proton installation
protontricks (INFO): WINE environment variable is not available. Setting WINE environment variable to Proton bundled version
Traceback (most recent call last):
File "/app/bin/protontricks", line 8, in
sys.exit(cli())
File "/app/lib/python3.9/site-packages/protontricks/cli/main.py", line 28, in cli
main(args)
File "/app/lib/python3.9/site-packages/protontricks/cli/util.py", line 143, in wrapper
return cli_func(self, *args, **kwargs)
File "/app/lib/python3.9/site-packages/protontricks/cli/main.py", line 220, in main
run_command(
File "/app/lib/python3.9/site-packages/protontricks/util.py", line 286, in run_command
str(proton_app.proton_dist_path / "bin" / "wine")
TypeError: unsupported operand type(s) for /: 'NoneType' and 'str'

Matoking added a commit to Matoking/protontricks that referenced this issue Jan 29, 2022
"~/.local/share/Steam" corresponds to a different directory inside a
Steam Flatpak. Ensure Protontricks doesn't mix them and try to look for
Flatpak Steam apps in the non-Flatpak installation directory.

Refs flathub/com.github.Matoking.protontricks#10
@Matoking
Copy link
Collaborator

Investigated this problem more, and turns out that while both versions of Steam write the identical path ~/.share/local/Steam into their own configuration files, that path corresponds to two different locations depending on which Steam installation is in use. In short, Protontricks was looking for Flatpak Steam's apps in the wrong place.

Third time's the charm, hopefully. Could you try installing this fix:

$ flatpak remove com.github.Matoking.protontricks # Remove the existing installation first
$ flatpak install --user https://dl.flathub.org/build-repo/74209/com.github.Matoking.protontricks.flatpakref

and test the following command again:

$ flatpak run com.github.Matoking.protontricks -v --gui

@Matoking Matoking mentioned this issue Jan 30, 2022
Matoking added a commit to Matoking/protontricks that referenced this issue Feb 5, 2022
When both Flatpak and non-Flatpak versions of Steam are installed for
the same user, Steam installation detection might return two paths that
correspond to two different installations of Steam.

Ensure that the two paths returned by `find_steam_path` are the same
when Flatpak sandbox is active and Flatpak installation directory is
found.

Refs flathub/com.github.Matoking.protontricks#10
Matoking added a commit to Matoking/protontricks that referenced this issue Feb 5, 2022
Incomplete Proton installations where the `dist` directory does not
exist yet cause Protontricks to crash. Check for this and instruct the
user to launch a Steam app at least once to ensure the installation is
complete.

Refs flathub/com.github.Matoking.protontricks#10
Matoking added a commit to Matoking/protontricks that referenced this issue Feb 5, 2022
"~/.local/share/Steam" corresponds to a different directory inside a
Steam Flatpak. Ensure Protontricks doesn't mix them and try to look for
Flatpak Steam apps in the non-Flatpak installation directory.

Refs flathub/com.github.Matoking.protontricks#10
Matoking added a commit to Matoking/protontricks that referenced this issue Feb 5, 2022
"~/.local/share/Steam" corresponds to a different directory inside a
Steam Flatpak. Ensure Protontricks doesn't mix them and try to look for
Flatpak Steam apps in the non-Flatpak installation directory.

Refs flathub/com.github.Matoking.protontricks#10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants