Error: No module named 'fcntl'

I get the following error:

Traceback (most recent call last): File "C:/Users/aaaa/Desktop/ttttttt.py", line 5, in <module> import reload File "C:\Users\aaa\AppData\Local\Programs\Python\Python36\lib\site- packages\reload.py", line 3, in <module> import sys, time, re, os, signal, fcntl ModuleNotFoundError: No module named 'fcntl' 

So I did a pip install, which also gets an error.

 C:\Users\aaaa>pip install fcntl Collecting fcntl Could not find a version that satisfies the requirement fcntl (from versions: ) No matching distribution found for fcntl 

Search results cPython, hacking, routing and many other words are coming out.

It's a tough answer for beginners, so I want to get a more detailed solution.

How should I solve it?

#py3 import time from selenium import webdriver import codecs import sys import reload import re import fcntl import os import signal 

4 Answers

The fcntl module is not available on Windows. The functionality it exposes does not exist on that platform.

If you're trying to lock a file, there are some other Python modules available which provide that functionality. One I've seen referenced in other answers is portalocker.

2

What you can do is install importlib with the usual:

pip install importlib 

From there use the following:

from importlib import reload 

Note that you will need to load your imports as 'modules':

from petshop import parrot as parrot 
1

I got some info from this website and installed as follows which solved the problem:

pip install micropython-fcntl 
2

The fcntl module is not available on Windows Platform.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like