Skip to content

fix: lazy-import fcntl to prevent crash on Windows#167

Closed
kouyouqi123 wants to merge 1 commit into
Lexonight1:mainfrom
kouyouqi123:fix-fcntl-windows
Closed

fix: lazy-import fcntl to prevent crash on Windows#167
kouyouqi123 wants to merge 1 commit into
Lexonight1:mainfrom
kouyouqi123:fix-fcntl-windows

Conversation

@kouyouqi123

Copy link
Copy Markdown

Fixes #166

Problem

linux.py has import fcntl at module level. On Windows, fcntl is not available (Unix-only), so importing trcc.adapters.system (which side-effect imports all OS modules) crashes with ModuleNotFoundError: No module named 'fcntl'.

Fix

Moved import fcntl from module level to inside the methods that use it, so it's only imported on Linux where those methods are actually called.

@Lexonight1

Copy link
Copy Markdown
Owner

Thank you for catching this and taking the time to send a fix — much appreciated. Good news: it's already resolved in main and shipped in v9.7.1fcntl is now imported lazily inside the SCSI ioctl methods in linux.py, so the Linux module imports cleanly on Windows (landed while fixing #166). I'll close this as already-fixed, but thank you for diagnosing it and helping out. 🙏


If this project helps you, consider buying me a beer 🍺 or Ko-fi

@Lexonight1 Lexonight1 closed this Jun 16, 2026
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.

Windows 11 - v9.7.0 imports trcc.adapters.system.linux and crashes with ModuleNotFoundError: fcntl

2 participants