Fix Unicode encoding error on Windows in build_usb_creator.py

- Replace Unicode checkmark characters (✓) with ASCII [OK] text
- Replace Unicode X marks (✗) with ASCII [ERROR] text
- Fixes UnicodeEncodeError with 'charmap' codec on Windows systems
- Updated both build_usb_creator.py and BUILD_INSTRUCTIONS.md files
parent 4dc65b5e
......@@ -62,14 +62,14 @@ dist\MBetterUSBCreator.exe
## Features
- Cross-platform (Linux/Windows)
- ISO file selection and validation
- USB device auto-detection
- Optional root password configuration
- Optional OpenVPN config integration
- Progress indicators and logging
- Safe USB device selection (prevents system disk selection)
- Standalone executable (no Python installation required)
- [OK] Cross-platform (Linux/Windows)
- [OK] ISO file selection and validation
- [OK] USB device auto-detection
- [OK] Optional root password configuration
- [OK] Optional OpenVPN config integration
- [OK] Progress indicators and logging
- [OK] Safe USB device selection (prevents system disk selection)
- [OK] Standalone executable (no Python installation required)
## Usage
......
......@@ -32,9 +32,9 @@ def check_dependencies():
try:
import_name = import_tests.get(package_name, package_name)
__import__(import_name)
print(f" {package_name} found")
print(f"[OK] {package_name} found")
except ImportError:
print(f" {package_name} missing")
print(f"[ERROR] {package_name} missing")
missing_packages.append(package_name)
if missing_packages:
......@@ -45,7 +45,7 @@ def check_dependencies():
print(" pip3 install -r requirements.txt")
return False
print(" All dependencies satisfied")
print("[OK] All dependencies satisfied")
return True
def create_spec_file():
......@@ -118,7 +118,7 @@ if sys.platform == 'darwin':
with open('usb_creator.spec', 'w') as f:
f.write(spec_content)
print(" PyInstaller spec file created")
print("[OK] PyInstaller spec file created")
def build_executable():
"""Build the standalone executable using PyInstaller"""
......@@ -132,7 +132,7 @@ def build_executable():
subprocess.run(cmd, check=True)
print(" Build completed successfully!")
print("[OK] Build completed successfully!")
# Show output location
dist_dir = Path("dist")
......@@ -142,13 +142,13 @@ def build_executable():
exe_path = dist_dir / "MBetterUSBCreator"
if exe_path.exists():
print(f" Executable created: {exe_path}")
print(f"[OK] Executable created: {exe_path}")
print(f" Size: {exe_path.stat().st_size / 1024 / 1024:.1f} MB")
else:
print(" Executable not found in expected location")
print("[ERROR] Executable not found in expected location")
except subprocess.CalledProcessError as e:
print(f" Build failed: {e}")
print(f"[ERROR] Build failed: {e}")
return False
return True
......@@ -164,7 +164,7 @@ pyinstaller>=5.0.0
with open('requirements.txt', 'w') as f:
f.write(requirements)
print(" requirements.txt created")
print("[OK] requirements.txt created")
def create_build_instructions():
"""Create build instructions for different platforms"""
......@@ -233,14 +233,14 @@ dist\\MBetterUSBCreator.exe
## Features
- Cross-platform (Linux/Windows)
- ISO file selection and validation
- USB device auto-detection
- Optional root password configuration
- Optional OpenVPN config integration
- Progress indicators and logging
- Safe USB device selection (prevents system disk selection)
- Standalone executable (no Python installation required)
- [OK] Cross-platform (Linux/Windows)
- [OK] ISO file selection and validation
- [OK] USB device auto-detection
- [OK] Optional root password configuration
- [OK] Optional OpenVPN config integration
- [OK] Progress indicators and logging
- [OK] Safe USB device selection (prevents system disk selection)
- [OK] Standalone executable (no Python installation required)
## Usage
......@@ -261,7 +261,7 @@ The created USB will:
with open('BUILD_INSTRUCTIONS.md', 'w') as f:
f.write(instructions)
print(" BUILD_INSTRUCTIONS.md created")
print("[OK] BUILD_INSTRUCTIONS.md created")
def main():
print("MBetter USB Creator - Build Script")
......@@ -270,9 +270,9 @@ def main():
if len(sys.argv) > 1 and sys.argv[1] == "--check-deps":
print("Checking dependencies only...")
if check_dependencies():
print(" All dependencies available")
print("[OK] All dependencies available")
else:
print(" Missing dependencies found")
print("[ERROR] Missing dependencies found")
return
# Create build files
......@@ -288,13 +288,13 @@ def main():
# Build executable
if build_executable():
print("\n" + "=" * 40)
print(" BUILD SUCCESSFUL!")
print(" Standalone executable created in dist/ directory")
print(" See BUILD_INSTRUCTIONS.md for usage details")
print("[OK] BUILD SUCCESSFUL!")
print("[OK] Standalone executable created in dist/ directory")
print("[OK] See BUILD_INSTRUCTIONS.md for usage details")
else:
print("\n" + "=" * 40)
print(" BUILD FAILED!")
print(" Check error messages above")
print("[ERROR] BUILD FAILED!")
print("[ERROR] Check error messages above")
if __name__ == '__main__':
main()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment