Repository: lutris/lutris

Issue:
Cannot run WINE games error get_wine_version(path).lower() returns None
until recently running WINE games has worked really well
but now whenever i press on the "launch" button, it gets permanently greyed out with "Launching" on the button.
when running Lutris from a terminal and trying to launch a game, I get:

```
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/lutris/exceptions.py", line 57, in wrapper
    return function(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/lutris/game.py", line 420, in configure_game
    gameplay_info = self.get_gameplay_info()
  File "/usr/lib/python3/dist-packages/lutris/game.py", line 398, in get_gameplay_info
    gameplay_info = self.runner.play()
  File "/usr/lib/python3/dist-packages/lutris/runners/wine.py", line 840, in play
    wine_ver = is_version_esync(self.get_executable())
  File "/usr/lib/python3/dist-packages/lutris/util/wine/wine.py", line 293, in is_version_esync
    wine_version = get_wine_version(path).lower()
AttributeError: 'NoneType' object has no attribute 'lower'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 153, in apport_excepthook
    with os.fdopen(os.open(pr_filename,
FileNotFoundError: [Errno 2] No such file or directory: '/var/crash/_usr_games_lutris.1000.crash'

Original exception was:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/lutris/exceptions.py", line 57, in wrapper
    return function(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/lutris/game.py", line 420, in configure_game
    gameplay_info = self.get_gameplay_info()
  File "/usr/lib/python3/dist-packages/lutris/game.py", line 398, in get_gameplay_info
    gameplay_info = self.runner.play()
  File "/usr/lib/python3/dist-packages/lutris/runners/wine.py", line 840, in play
    wine_ver = is_version_esync(self.get_executable())
  File "/usr/lib/python3/dist-packages/lutris/util/wine/wine.py", line 293, in is_version_esync
    wine_version = get_wine_version(path).lower()
AttributeError: 'NoneType' object has no attribute 'lower'

```

i know for a fact that i have WINE installed, because Lutris used to work and I can run games from the command line using wine
Cannot run WINE games error get_wine_version(path).lower() returns None
until recently running WINE games has worked really well
but now whenever i press on the "launch" button, it gets permanently greyed out with "Launching" on the button.
when running Lutris from a terminal and trying to launch a game, I get:

```
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/lutris/exceptions.py", line 57, in wrapper
    return function(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/lutris/game.py", line 420, in configure_game
    gameplay_info = self.get_gameplay_info()
  File "/usr/lib/python3/dist-packages/lutris/game.py", line 398, in get_gameplay_info
    gameplay_info = self.runner.play()
  File "/usr/lib/python3/dist-packages/lutris/runners/wine.py", line 840, in play
    wine_ver = is_version_esync(self.get_executable())
  File "/usr/lib/python3/dist-packages/lutris/util/wine/wine.py", line 293, in is_version_esync
    wine_version = get_wine_version(path).lower()
AttributeError: 'NoneType' object has no attribute 'lower'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 153, in apport_excepthook
    with os.fdopen(os.open(pr_filename,
FileNotFoundError: [Errno 2] No such file or directory: '/var/crash/_usr_games_lutris.1000.crash'

Original exception was:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/lutris/exceptions.py", line 57, in wrapper
    return function(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/lutris/game.py", line 420, in configure_game
    gameplay_info = self.get_gameplay_info()
  File "/usr/lib/python3/dist-packages/lutris/game.py", line 398, in get_gameplay_info
    gameplay_info = self.runner.play()
  File "/usr/lib/python3/dist-packages/lutris/runners/wine.py", line 840, in play
    wine_ver = is_version_esync(self.get_executable())
  File "/usr/lib/python3/dist-packages/lutris/util/wine/wine.py", line 293, in is_version_esync
    wine_version = get_wine_version(path).lower()
AttributeError: 'NoneType' object has no attribute 'lower'

```

i know for a fact that i have WINE installed, because Lutris used to work and I can run games from the command line using wine


Discussion:

Resolving patch:
diff --git a/lutris/util/wine/wine.py b/lutris/util/wine/wine.py
--- a/lutris/util/wine/wine.py
+++ b/lutris/util/wine/wine.py
@@ -290,8 +290,11 @@ def is_version_esync(path):
     for esync_version in esync_compatible_versions:
         if esync_version in version_prefix or esync_version in version_suffix:
             return True
-    wine_version = get_wine_version(path).lower()
-    return "esync" in wine_version or "staging" in wine_version
+    wine_version = get_wine_version(path)
+    if wine_version:
+        wine_version = wine_version.lower()
+        return "esync" in wine_version or "staging" in wine_version
+    return False
 
 
 def is_version_fsync(path):
@@ -313,7 +316,10 @@ def is_version_fsync(path):
     for fsync_version in fsync_compatible_versions:
         if fsync_version in version_prefix or fsync_version in version_suffix:
             return True
-    return "fsync" in get_wine_version(path).lower()
+    wine_version = get_wine_version(path)
+    if wine_version:
+        return "fsync" in wine_version.lower()
+    return False
 
 
 def get_real_executable(windows_executable, working_dir=None):


Test patch: