0

so i went through the workaround in order to be able to run bpython on a windows 10 PC (64 bit, Python 3.10.2). installed the necessary curses from http://www.lfd.uci.edu/~gohlke/pythonlibs/#curses

installed bpython (pip install bpython)

and ran bpython-curses.exe. I still get the long error ending with " from fcntl import ioctl ModuleNotFoundError: No module named 'fcntl'"

Any ideas?

  • Why would you hope it to work? It is advertised to work on Linux and possibly on Mac. Why do you expect the only problem in Windows to be curses? There are far more differences between Linux and Windows... – Serge Ballesta Jan 18 '22 at 15:46
  • @Serge Ballesta The bpython page does say "... and Windows (with some work)". – William McBrine Jan 19 '22 at 14:29
  • 1
    All is in the *some work* ;-) ... More seriously the error says that some module want to use an `ioctl` system call. It works fine on Linux and can work on Mac because the underlying OS is Darwin which is a BSD Unix. It is not even present in the Python library on Windows because the low level io system is implemented in a completely different way. As you got no help here, you will have to dig in the source of bpython to find where and why `ioctl` is used, and try to port those calls to Windows. If you are brave enough, it is certainly possible... – Serge Ballesta Jan 19 '22 at 15:02

1 Answers1

0
pip install -U windows-curses bpython

Then comment/remove lines 35 and 221 from %APPDATA\..\Local\Programs\Python\Python38\Lib\site-packages\bpython\args.py or similar location. Those will be the lines with the string curtsies in them, (see below for sample).

Then run

bpython-curses

Problem Solved

Technical details...: args.py:

import argparse
from typing import Tuple, List, Optional, NoReturn, Callable
import code
# import curtsies  ### REMOVE
import cwcwidth
...
    logger.info("Python %s: %s", sys.executable, sys.version_info)
    # versions of required dependencies
    #  logger.info("curtsies: %s", curtsies.__version__)  ### REMOVE
    logger.info("cwcwidth: %s", cwcwidth.__version__)
Orwellophile
  • 13,235
  • 3
  • 69
  • 45