Visitar URL original
Cannot create display · Issue #116 · python-xlib/python-xlib · GitHub
The Wayback Machine - https://web.archive.org/web/20210106130910/https://github.com/python-xlib/python-xlib/issues/116
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

Cannot create display #116

Open
PythonCoderAS opened this issue Jun 8, 2018 · 1 comment
Open

Cannot create display #116

PythonCoderAS opened this issue Jun 8, 2018 · 1 comment
Labels

Comments

@PythonCoderAS
Copy link

@PythonCoderAS PythonCoderAS commented Jun 8, 2018

As indicated in #71 , I used the linked stackoverflow code, provided below for convenience.

from Xlib import display, X
import PIL.Image #PIL, edited by PokestarFan to fix import

W,H = 200,200
dsp = display.Display()
root = dsp.screen().root
raw = root.get_image(0, 0, W,H, X.ZPixmap, 0xffffffff)
image = Image.fromstring("RGB", (W, H), raw.data, "raw", "BGRX")
image.show()

When I ran the code, I got the folowwing issue.

In [2]: from Xlib import display, X
   ...: from PIL import Image #PIL
   ...:
   ...: W,H = 200,200
   ...: dsp = display.Display()
   ...: root = dsp.screen().root
   ...: raw = root.get_image(0, 0, W,H, X.ZPixmap, 0xffffffff)
   ...: image = Image.fromstring("RGB", (W, H), raw.data, "raw", "BGRX")
   ...: image.show()
   ...:
   ...:
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-2-54cc7b666e0c> in <module>()
      3
      4 W,H = 200,200
----> 5 dsp = display.Display()
      6 root = dsp.screen().root
      7 raw = root.get_image(0, 0, W,H, X.ZPixmap, 0xffffffff)

c:\program files\python36\lib\site-packages\Xlib\display.py in __init__(self, display)
     87 class Display(object):
     88     def __init__(self, display = None):
---> 89         self.display = _BaseDisplay(display)
     90
     91         # Create the keymap cache

c:\program files\python36\lib\site-packages\Xlib\display.py in __init__(self, *args, **keys)
     69
     70     def __init__(self, *args, **keys):
---> 71         protocol_display.Display.__init__(self, *args, **keys)
     72         self._atom_cache = {}
     73

c:\program files\python36\lib\site-packages\Xlib\protocol\display.py in __init__(self, display)
     83
     84     def __init__(self, display = None):
---> 85         name, protocol, host, displayno, screenno = connect.get_display(display)
     86
     87         self.display_name = name

c:\program files\python36\lib\site-packages\Xlib\support\connect.py in get_display(display)
     70
     71     modname = _display_mods.get(platform, _default_display_mod)
---> 72     mod = _relative_import(modname)
     73     return mod.get_display(display)
     74

c:\program files\python36\lib\site-packages\Xlib\support\connect.py in _relative_import(modname)
     53
     54 def _relative_import(modname):
---> 55     return importlib.import_module('..' + modname, __name__)
     56
     57

c:\program files\python36\lib\importlib\__init__.py in import_module(name, package)
    124                 break
    125             level += 1
--> 126     return _bootstrap._gcd_import(name[level:], package, level)
    127
    128

c:\program files\python36\lib\importlib\_bootstrap.py in _gcd_import(name, package, level)

c:\program files\python36\lib\importlib\_bootstrap.py in _find_and_load(name, import_)

c:\program files\python36\lib\importlib\_bootstrap.py in _find_and_load_unlocked(name, import_)

c:\program files\python36\lib\importlib\_bootstrap.py in _load_unlocked(spec)

c:\program files\python36\lib\importlib\_bootstrap_external.py in exec_module(self, module)

c:\program files\python36\lib\importlib\_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)

c:\program files\python36\lib\site-packages\Xlib\support\unix_connect.py in <module>()
     29 # in Python 2.2.
     30
---> 31 import fcntl
     32
     33 if hasattr(fcntl, 'F_SETFD'):

ModuleNotFoundError: No module named 'fcntl'

What is this fcntl module and why do i not have it?

I am on Windows 10 if that helps.

@benoit-pierre
Copy link
Member

@benoit-pierre benoit-pierre commented Jun 8, 2018

Windows is not supported, except when running under Windows Subsystem for Linux, which apparently works (see #99).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.