Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NameError: name fcntl is not defined on Windows 10 with Python 3.8 #23

Open
mloskot opened this issue Oct 23, 2020 · 2 comments
Open

NameError: name fcntl is not defined on Windows 10 with Python 3.8 #23

mloskot opened this issue Oct 23, 2020 · 2 comments

Comments

@mloskot
Copy link

mloskot commented Oct 23, 2020

TL;TR: Does jpterm support Windows?

I tried it on Windows 10 with built-in installation of Python inside PowerShell console and it failed:

❯ python -c 'import jpterm; print(jpterm.__version__)'
0.2.1
❯ python
Python 3.8.6 (tags/v3.8.6:db45529, Sep 23 2020, 15:52:53) [MSC v.1927 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import jpterm
>>> jpterm.main()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\mateuszl\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\jpterm.py", line 226, in main
    screen = urwid.raw_display.Screen()
  File "C:\Users\mateuszl\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\urwid\raw_display.py", line 85, in __init__
    fcntl.fcntl(self._resize_pipe_rd, fcntl.F_SETFL, os.O_NONBLOCK)
NameError: name 'fcntl' is not defined
❯ az vm list --output json | python -c 'import jpterm; jpterm.main()'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\mateuszl\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\jpterm.py", line 221, in main
    input_json = _load_input_json(getattr(args, 'input-json', None))
  File "C:\Users\mateuszl\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\jpterm.py", line 189, in _load_input_json
    sys.stdin = open(os.ctermid(), 'r')
AttributeError: module 'os' has no attribute 'ctermid'
@Fabioamd87
Copy link

I have this issue trying to install on Windows 10 with python 3.10.2:

`PS C:\Users\fabio.sasso> pip install jmespath-terminal
Collecting jmespath-terminal
Using cached jmespath-terminal-0.2.1.tar.gz (6.3 kB)
Preparing metadata (setup.py) ... done
Collecting jmespath<=1.0.0,>=0.4.1
Using cached jmespath-0.10.0-py2.py3-none-any.whl (24 kB)
Collecting Pygments<3.0,>=2.0
Using cached Pygments-2.11.2-py3-none-any.whl (1.1 MB)
Collecting urwid==1.2.2
Using cached urwid-1.2.2.tar.gz (585 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [27 lines of output]
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.752.0_x64__qbz5n2kfra8p0\lib\distutils\core.py", line 108, in setup
_setup_distribution = dist = klass(attrs)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.752.0_x64__qbz5n2kfra8p0\lib\site-packages\setuptools\dist.py", line 453, in init
_Distribution.init(
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.752.0_x64__qbz5n2kfra8p0\lib\distutils\dist.py", line 292, in init
self.finalize_options()
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.752.0_x64__qbz5n2kfra8p0\lib\site-packages\setuptools\dist.py", line 831, in finalize_options
ep(self)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.752.0_x64__qbz5n2kfra8p0\lib\site-packages\setuptools\dist.py", line 852, in _finalize_setup_keywords
ep.load()(self, ep.name, value)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.752.0_x64__qbz5n2kfra8p0\lib\site-packages\setuptools\dist.py", line 296, in invalid_unless_false
raise DistutilsSetupError(f"{attr} is invalid.")
distutils.errors.DistutilsSetupError: use_2to3 is invalid.

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "C:\Users\fabio.sasso\AppData\Local\Temp\pip-install-xp7j2l7j\urwid_d93aec0609eb42dab1a6c2aa4a77d6a8\setup.py", line 85, in <module>
      setup(**setup_d)
    File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.752.0_x64__qbz5n2kfra8p0\lib\site-packages\setuptools\__init__.py", line 153, in setup
      return distutils.core.setup(**attrs)
    File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.752.0_x64__qbz5n2kfra8p0\lib\distutils\core.py", line 113, in setup
      raise SystemExit("error in %s setup command: %s" % \
  SystemExit: error in urwid setup command: use_2to3 is invalid.
  error in urwid setup command: use_2to3 is invalid.
  Couldn't build the extension module, trying without it...
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.`

@posthuma
Copy link

posthuma commented Mar 25, 2022

@Fabioamd87
I was able to reproduce this error message and this post, solves by installing a previous version of setuptools that still has the command.

pip install setuptools==57.5.0

I was able to install the jmespath-terminal through pip without issue after that.

This workaround would be needed until this PR or something similar is merged to solve the issue.

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

No branches or pull requests

3 participants