Ram Rachum Ram Rachum - 1 year ago 203
Linux Question

fcntl substitute on Windows

I received a Python project (which happens to be a Django project, if that matters,) that uses the

module from the standard library, which seems to be available only on Linux. When I try to run it on my Windows machine, it stops with an
, because this module does not exist here.

Is there any way for me to make a small change in the program to make it work on Windows?

Answer Source

The substitute of fcntl on windows are win32api calls. The usage is completely different. It is not some switch you can just flip.

In other words, porting a fcntl-heavy-user module to windows is not trivial. It requires you to analyze what exactly each fcntl call does and then find the equivalent win32api code, if any.

There's also the possibility that some code using fcntl has no windows equivalent, which would require you to change the module api and maybe the structure/paradigm of the program using the module you're porting.

If you provide more details about the fcntl calls people can find windows equivalents.