Skip to content

Instantly share code, notes, and snippets.

@Nov05
Created February 19, 2024 00:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nov05/6596fdefb49becbd91d5f33788c6999b to your computer and use it in GitHub Desktop.
Save Nov05/6596fdefb49becbd91d5f33788c6999b to your computer and use it in GitHub Desktop.
20240218 python PyWhatKit issue 313

Ankit404butfound/PyWhatKit#313

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/Xlib/support/unix_connect.py in get_socket(dname, host, dno)
     75             s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
---> 76             s.connect('/tmp/.X11-unix/X%d' % dno)
     77     except OSError as val:

FileNotFoundError: [Errno 2] No such file or directory

During handling of the above exception, another exception occurred:

DisplayConnectionError                    Traceback (most recent call last)
10 frames
<ipython-input-7-46c0156c67eb> in <cell line: 4>()
      2 my_phone_number = userdata.get('my_phone_number')
      3 ## Sending to WhatsApp
----> 4 import pywhatkit
      5 message = "The training is finished."
      6 pywhatkit.sendwhatmsg_instantly(my_phone_number, message)

/usr/local/lib/python3.10/dist-packages/pywhatkit/__init__.py in <module>
     14 from pywhatkit.misc import info, playonyt, search, show_history
     15 from pywhatkit.sc import cancel_shutdown, shutdown
---> 16 from pywhatkit.core.log import set_log_path
     17 from pywhatkit.whats import (
     18     open_web,

/usr/local/lib/python3.10/dist-packages/pywhatkit/core/log.py in <module>
      2 import time
      3 
----> 4 from pywhatkit.core.core import check_number
      5 
      6 def format_message(message: str) -> str:

/usr/local/lib/python3.10/dist-packages/pywhatkit/core/core.py in <module>
      7 
      8 import requests
----> 9 from pyautogui import click, hotkey, locateOnScreen, moveTo, press, size, typewrite
     10 
     11 from pywhatkit.core.exceptions import InternetException

/usr/local/lib/python3.10/dist-packages/pyautogui/__init__.py in <module>
    244 
    245 try:
--> 246     import mouseinfo
    247 
    248     def mouseInfo():

/usr/local/lib/python3.10/dist-packages/mouseinfo/__init__.py in <module>
    221             raise
    222 
--> 223     _display = Display(os.environ['DISPLAY'])
    224 
    225     def _linuxPosition():

/usr/local/lib/python3.10/dist-packages/Xlib/display.py in __init__(self, display)
     78 class Display:
     79     def __init__(self, display = None):
---> 80         self.display = _BaseDisplay(display)
     81 
     82         # Create the keymap cache

/usr/local/lib/python3.10/dist-packages/Xlib/display.py in __init__(self, *args, **keys)
     60 
     61     def __init__(self, *args, **keys):
---> 62         display.Display.__init__(*(self, ) + args, **keys)
     63         self._atom_cache = {}
     64 

/usr/local/lib/python3.10/dist-packages/Xlib/protocol/display.py in __init__(self, display)
     56         self.default_screen = screenno
     57 
---> 58         self.socket = connect.get_socket(name, host, displayno)
     59 
     60         auth_name, auth_data = connect.get_auth(self.socket,

/usr/local/lib/python3.10/dist-packages/Xlib/support/connect.py in get_socket(dname, host, dno)
     74     modname = _socket_mods.get(platform, _default_socket_mod)
     75     mod = __import__(modname, globals(),level=1)
---> 76     return mod.get_socket(dname, host, dno)
     77 
     78 

/usr/local/lib/python3.10/dist-packages/Xlib/support/unix_connect.py in get_socket(dname, host, dno)
     76             s.connect('/tmp/.X11-unix/X%d' % dno)
     77     except OSError as val:
---> 78         raise error.DisplayConnectionError(dname, str(val))
     79 
     80     # Make sure that the connection isn't inherited in child processes

DisplayConnectionError: Can't connect to display ":0": [Errno 2] No such file or directory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment