Magic.py "wrong type" error on Windows 10
Closed this issue · 4 comments
OS: Windows 10 22H2 (19045)
Python Version: 3.11.0
First of all thank you massively for developing this solution, I started getting really suspicious of the original Gamma launcher after finding out it was heavily obfuscated on top of the "Disable AV and run as admin" stuff.
Every time gamma-launcher needs to extract an archive, it throws a TypeError. I've tried both the pre-packaged executable and my own venv (with Python 3.11). I've tried to investigate the issue myself but have had issues setting up a debugging environment and catching the exception, will keep trying.
Let me know if there's any additional information I could provide or tests I could perform.
(env) PS D:\Games\gamma-launcher> gamma-launcher gamma-setup --gamma .\GAMMA\
[+] Installing base setup for GAMMA
- Downloading Mod.Organizer-2.4.4.7z: 85.9MiB [00:02, 37.7MiB/s]
Traceback (most recent call last):
File "D:\Games\gamma-launcher\env\Scripts\gamma-launcher-script.py", line 33, in <module>
sys.exit(load_entry_point('gamma-launcher==1.7', 'console_scripts', 'gamma-launcher')())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Games\gamma-launcher\env\Lib\site-packages\launcher\cli.py", line 68, in main
args.cobject().run(args)
File "D:\Games\gamma-launcher\env\Lib\site-packages\launcher\commands\install.py", line 167, in run
self._install_mod_organizer(args.mo_version)
File "D:\Games\gamma-launcher\env\Lib\site-packages\launcher\commands\install.py", line 151, in _install_mod_organizer
extract_archive(mo_archive, self._gamma_dir)
File "D:\Games\gamma-launcher\env\Lib\site-packages\launcher\archive.py", line 60, in extract_archive
mime = mime or magic.from_file(filename, mime=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Games\gamma-launcher\env\Lib\site-packages\magic\magic.py", line 135, in from_file
return m.from_file(filename)
^^^^^^^^^^^^^^^^^^^^^
File "D:\Games\gamma-launcher\env\Lib\site-packages\magic\magic.py", line 89, in from_file
return maybe_decode(magic_file(self.cookie, filename))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Games\gamma-launcher\env\Lib\site-packages\magic\magic.py", line 255, in magic_file
return _magic_file(cookie, coerce_filename(filename))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ctypes.ArgumentError: argument 2: <class 'TypeError'>: wrong type
Hey ! No idea of what is happening, it seems to be an error in magic
module.
To be fair, I was focusing on Linux dev .... Not sure if Windows is fully supported.
I've made a quick branch to solve your issue .. Can you give it a test ? (expect more errors)
The fix worked, I'll test more tomorrow with a full install.
I tried v1.5 as a workaround and ran into other errors with mod downloading, I'll make a separate issue when I get around to reinstalling.
full-install
tested on Linux without magic module, everything went fine.
@GeneralBison did you have to check Win32 install ? No more errors ?