unexpectedpanda / retool

Retool: a better filter tool for Redump and No-Intro DAT files.
BSD 3-Clause "New" or "Revised" License
343 stars 22 forks source link

Fail on Windows Server 2022 #319

Closed number782 closed 3 months ago

number782 commented 3 months ago

Describe the bug fails to run on Windows Server 2022 - Traceback (most recent call last): File "retoolgui.py", line 22, in File "", line 1360, in _find_and_load File "", line 1331, in _find_and_load_unlocked File "", line 935, in _load_unlocked File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module File "retool.py", line 17, in File "", line 1360, in _find_and_load File "", line 1331, in _find_and_load_unlocked File "", line 935, in _load_unlocked File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module File "modules\utils.py", line 408, in File "modules\utils.py", line 411, in Font File "modules\utils.py", line 296, in old_windows ValueError: could not convert string to float: '2022Server' [56948] Failed to execute script 'retoolgui' due to unhandled exception!

To reproduce download and run

Expected behavior should run, but seems to get the edition rather than just a numeric (from ver command)

Operating system windows server 2022

Retool edition

Retool version retool-2.02.2

number782 commented 3 months ago

here is output from retool.py

C:\RETOOL\retool-main>python retool.py Traceback (most recent call last): File "C:\RETOOL\retool-main\retool.py", line 17, in from modules.utils import eprint File "C:\RETOOL\retool-main\modules\utils.py", line 408, in class Font: File "C:\RETOOL\retool-main\modules\utils.py", line 411, in Font if not old_windows(): ^^^^^^^^^^^^^ File "C:\RETOOL\retool-main\modules\utils.py", line 296, in old_windows if sys.platform.startswith('win') and (float(platform.release()) < 10): ^^^^^^^^^^^^^^^^^^^^^^^^^ ValueError: could not convert string to float: '2022Server'

maybe useful, ver command produces: Microsoft Windows [Version 10.0.20348.2322]

unexpectedpanda commented 3 months ago

I didn't expect to see a Windows Server user running Retool :)

The fix is slated for the next release, which is some way out. If you're okay with code and running the pure Python version of Retool, you can get it working now by replacing the old_windows function in modules\utils.py with the following code:

def old_windows() -> bool:
    """Figures out if Retool is running on a version of Windows earlier than Windows 10 or Windows Server 2019."""
    windows_version: str = platform.release()

    if sys.platform.startswith('win'):
        # Catch Windows Server
        if re.search('[A-Za-z]', windows_version):
            if int(re.sub('[A-Za-z]', '', windows_version)) < 2019:
                return True
        # Catch consumer versions of Windows
        elif (float(windows_version) < 10):
            return True
    return False
number782 commented 3 months ago

Yeah should run it in a Windows 10 vm... haha.

Thanks I'll use the code.

unexpectedpanda commented 3 months ago

Fixed in v2.03.0.