diff --git a/Python/stylua.py b/Python/stylua.py index f19f093a..221e8cfe 100644 --- a/Python/stylua.py +++ b/Python/stylua.py @@ -23,7 +23,8 @@ def run(input_folder_path, output_folder_path): elif os.name == "posix": # If the OS is Linux stylua_path = utils.path("Lib/stylua/Linux/stylua") - result = subprocess.run([stylua_path, output_path], capture_output=True, text=True) + # Setting stdin to subprocess.DEVNULL is necessary for the EXE not to throw "OSError: [WinError 6] The handle is invalid" + result = subprocess.run([stylua_path, output_path], capture_output=True, text=True, stdin=subprocess.DEVNULL) if result.stderr: raise WronglyFormattedLuaFile(result.stderr) diff --git a/main.py b/main.py index 52cfdc2e..ad7a5a12 100644 --- a/main.py +++ b/main.py @@ -1,6 +1,9 @@ # Run manually: python main.py -# Build EXE: pyinstaller --noconsole --onefile --icon="Media/legacy-mod-converter.ico" --add-data="Media/github-icon.png;Media" --add-data="Media/discord-icon.png;Media" --add-data="Media/finish.wav;Media" --name="Legacy Mod Converter" main.py +# This is giving the error `pyinstaller: error: argument --add-binary: invalid add_data_or_binary value: 'Lib/stylua/Linux/stylua:Lib/stylua/Linux'` +# Build EXE: pyinstaller --noconsole --onefile --icon="Media/legacy-mod-converter.ico" --add-data="Media/github-icon.png;Media" --add-data="Media/discord-icon.png;Media" --add-data="Media/finish.wav;Media" --add-binary="Lib/stylua/Linux/stylua:Lib/stylua/Linux" --add-data="Lib/stylua/Windows/stylua.exe;Lib/stylua/Windows" --name="Legacy Mod Converter" main.py + +# Build EXE: pyinstaller --noconsole --onefile --icon="Media/legacy-mod-converter.ico" --add-data="Media/github-icon.png;Media" --add-data="Media/discord-icon.png;Media" --add-data="Media/finish.wav;Media" --add-binary="Lib/stylua/Windows/stylua.exe;Lib/stylua/Windows" --name="Legacy Mod Converter" main.py import traceback import PySimpleGUI as sg