On my Ubuntu machine, I have been using a pyguiauto app, that I had written a few years ago, to automate some mundane, daily tasks. Today, there was an software update that system brought up, I installed whatever was offered without paying too much attention.
After the update, to my surprise, I found out that my pyautogui based app stopped working with a dconf Permission error.
I do not know what dconf was. So, I searched for it. LinuxConfig.org says that it is a GNOME desktop thing.
I am using KDE desktop environment. So, I am not sure how dconf is relevant in this context. Plus I don't know how to configure it. Plus, dconf is not even installed on my machine:
$ dconf
Command 'dconf' not found, but can be installed with:
sudo apt install dconf-cli
Any suggestions ?
Installed python packages used by my app:
pip list
Package Version
------------- --------
blessed 1.20.0
MouseInfo 0.1.3
numpy 1.26.3
opencv-python 4.9.0.80
pillow 10.2.0
pip 24.2
PyAutoGUI 0.9.54
PyGetWindow 0.0.9
PyMsgBox 1.0.9
pyperclip 1.8.2
PyRect 0.2.0
PyScreeze 0.1.30
python3-xlib 0.15
pytweening 1.0.7
setuptools 72.1.0
six 1.16.0
stopit 1.1.2
watchdog 3.0.0
wcwidth 0.2.13
TraceBack for the error:
Traceback (most recent call last):
File "/home/XXXXXXXXXXXMonitor.py", line 293, in <module>
gui.click(pp_location)
File "/home/XXXXXXXXXXXMonitor/linux_env/lib/python3.12/site-packages/pyautogui/__init__.py", line 594, in wrapper
returnVal = wrappedFunction(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/XXXXXXXXXXXMonitor/linux_env/lib/python3.12/site-packages/pyautogui/__init__.py", line 984, in click
button = _normalizeButton(button)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/XXXXXXXXXXXMonitor/linux_env/lib/python3.12/site-packages/pyautogui/__init__.py", line 866, in _normalizeButton
swapped = platformModule._mouse_is_swapped()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/XXXXXXXXXXXMonitor/linux_env/lib/python3.12/site-packages/pyautogui/_pyautogui_x11.py", line 91, in _mouse_is_swapped
proc = subprocess.Popen(['dconf', 'read', '/org/gnome/desktop/peripherals/mouse/left-handed'], stdout=subprocess.PIPE)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/subprocess.py", line 1026, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.12/subprocess.py", line 1955, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: 'dconf'
System Info
cat /etc/*release*
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=24.04
DISTRIB_CODENAME=noble
DISTRIB_DESCRIPTION="Ubuntu 24.04.2 LTS"
PRETTY_NAME="Ubuntu 24.04.2 LTS"
NAME="Ubuntu"
VERSION_ID="24.04"
VERSION="24.04.2 LTS (Noble Numbat)"
VERSION_CODENAME=noble
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=noble
LOGO=ubuntu-logo
I realized that I can run the same script on Manjaro. The difference was dconf was installed on that system, whereas dconf is missing on my ubuntu machine.
So I installed dconf by:
sudo apt install dconf-cli
And this has fixed the problem.