Skip to content

Only load kernel32 on Windows - #1

Open
MrPaulAR wants to merge 1 commit into
CaffeinatedFunctionality:mainfrom
MrPaulAR:fix-ext4-nonwindows-import
Open

MrPaulAR wants to merge 1 commit into
CaffeinatedFunctionality:mainfrom
MrPaulAR:fix-ext4-nonwindows-import

Conversation

@MrPaulAR

Copy link
Copy Markdown

ext4.py calls ctypes.WinDLL("kernel32", ...) at import time. WinDLL only exists on Windows, so importing ext4 on Linux or macOS raises:

AttributeError: module 'ctypes' has no attribute 'WinDLL'

Because fpp_recover.py imports ext4 unconditionally, the tool cannot start on Linux or macOS at all. For example, python3 fpp_recover.py scan fails before doing anything.

fpp_recover.py already guards its own WinDLL use with if sys.platform == "win32":. This change applies the same guard to ext4.py, so FileReader/Ext4Volume work on POSIX while WinDeviceReader stays Windows-only.

Tested on Linux: python3 fpp_recover.py scan now runs and detects the card (given read access to the device).

ext4.py called ctypes.WinDLL at import time, which only exists on
Windows. Importing ext4 on Linux or macOS raised AttributeError, so
the tool could not start outside Windows.

Guard the kernel32 setup with sys.platform, matching fpp_recover.py.
This lets fpp_posix.py use ext4.FileReader and Ext4Volume on Linux and
macOS.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant