How to fix 'DISPLAY' error in python while using pywhatkit | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to fix 'DISPLAY' error in python while using pywhatkit

19th Feb 2021, 7:02 PM
Parmar Amit
Parmar Amit - avatar
10 Answers
+ 4
okay. can you list the entire error? That might help. this could be a python exception with a traceback or actually an error deeper in the API.
20th Feb 2021, 8:58 PM
Wilbur Jaywright
Wilbur Jaywright - avatar
+ 2
a python exception traceback looks like this: Traceback (most recent call last): file ‘cat_life.py’ line 42, in react(): self.bark(mailman) AttributeError: Jaywright has no attribute ‘bark’ an error that is not your fault might say something like: Segmentation fault. <0xB129X7> memory block is unreadable.
20th Feb 2021, 9:04 PM
Wilbur Jaywright
Wilbur Jaywright - avatar
+ 1
please share your code. This error likely has a number of possible causes. I personally have no experience in WhatsApp...
20th Feb 2021, 12:01 AM
Wilbur Jaywright
Wilbur Jaywright - avatar
+ 1
thanks for your help @wilbur jaywright
22nd Feb 2021, 2:14 PM
Parmar Amit
Parmar Amit - avatar
+ 1
That is because in Android os there doesn't exist any os.environ['DISPLAY'] so all module which requires browser control and mouse/pixel movment control are not usable in Android (Pywhatkit, pyAudio, pyautogui) wont work
22nd Dec 2022, 7:23 PM
krishna sarda
krishna sarda - avatar
0
import pywhatkit pywhatkit.sendwhatmsg("+phone number" , "massage" , hour, min) code is as above. I am learning python from my phone so please help me if there is any other library required to install. pywhatkit is already installed
20th Feb 2021, 7:25 PM
Parmar Amit
Parmar Amit - avatar
0
error is as below 👇👇 Traceback (most recent call last): File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 31, in <module> start(fakepyfile,mainpyfile) File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 30, in start exec(open(mainpyfile).read(), __main__.__dict__) File "<string>", line 2, in <module> File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/pywhatkit/__init__.py", line 4, in <module> from pywhatkit.mainfunctions import sendwhatmsg_to_group, watch_tutorial_in_English, watch_tutorial_in_Hindi, developer_contact, showHistory, shutdown, cancelShutdown, prnt_sleeptm, check_window, sendwhatmsg, info, playonyt, image_to_ascii_art, search File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/pywhatkit/mainfunctions.py", line 3, in <module> import pyautogui as pg File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/pyautogui/__init__.py", line 241, in <module> import mouseinfo File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/mouseinfo/__init__.py", line 223, in <module> _display = Display(os.environ['DISPLAY']) File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/os.py", line 675, in __getitem__ raise KeyError(key) from None KeyError: 'DISPLAY' [Program finished]
21st Feb 2021, 7:29 AM
Parmar Amit
Parmar Amit - avatar
0
this looks like a failure within the API, though it’s still written in python at the point of failure. I’m not sure if you can fix it. However, someone else might know better than me here. I stopped programming in android a few years ago.
22nd Feb 2021, 2:09 PM
Wilbur Jaywright
Wilbur Jaywright - avatar
0
Bro I got same error After 1 year From you😅 If you find it solution Please tell me.
13th Dec 2022, 1:05 PM
Himanshu Sharma
0
Thanks
20th Jan 2023, 2:26 PM
Himanshu Sharma