Cannot get autokey to run

493 views
Skip to first unread message

Julian Hoch

unread,
May 5, 2017, 11:12:52 AM5/5/17
to autokey-users
I've been using autokey for quite a while, and recently upgraded my system to Linux Mint (XFCE edition) 18.1.
Since then, I cannot get autokey to run anymore.

If I try to install the version provided with the distribution, I can install that but when I try to run it, it says:
"Fatal error starting AutoKey.
'utf-8' codec can't decode byte 0xf1 in position 63: invalid continuation byte"



I tried to install the version from github, and the install process completes, but if I try to run it I get:
/usr/local/lib/python2.7/dist-packages/autokey/gtkapp.py:24: PyGIWarning: Gtk was imported without specifying a version first. Use gi.require_version('Gtk', '3.0') before import to ensure that the right version gets loaded.
 
from gi.repository import Gtk, Gdk, GObject, GLib
/usr/lib/python2.7/dist-packages/pyatspi/__init__.py:17: PyGIWarning: Atspi was imported without specifying a version first. Use gi.require_version('Atspi', '2.0') before import to ensure that the right version gets loaded.
 
from gi.repository import Atspi
Traceback (most recent call last):
 
File "/usr/local/bin/autokey-gtk", line 20, in <module>
   
from autokey.gtkapp import Application
 
File "/usr/local/lib/python2.7/dist-packages/autokey/gtkapp.py", line 28, in <module>
   
import service, monitor
 
File "/usr/local/lib/python2.7/dist-packages/autokey/service.py", line 21, in <module>
   
from iomediator import Key, IoMediator
 
File "/usr/local/lib/python2.7/dist-packages/autokey/iomediator.py", line 142, in <module>
   
from interface import *
 
File "/usr/local/lib/python2.7/dist-packages/autokey/interface.py", line 29, in <module>
   
from Xlib import X, XK, display, error
ImportError: No module named Xlib


Then I tried to install the autokey-py3 version, but the configure script fails with:
configure: error: Package requirements (dbus-glib-1 >= 0.70) were not met:
   
   
No package 'dbus-glib-1' found
   
   
Consider adjusting the PKG_CONFIG_PATH environment variable if you
    installed software
in a non-standard prefix.
   
   
Alternatively, you may set the environment variables DBUS_GLIB_CFLAGS
   
and DBUS_GLIB_LIBS to avoid the need to call pkg-config.
   
See the pkg-config man page for more details.
   
Traceback (most recent call last):
     
File "<string>", line 1, in <module>
     
File "/tmp/pip-build-e1cydksk/dbus-python/setup.py", line 106, in <module>
       
'build_ext': BuildExt,
     
File "/usr/lib/python3.5/distutils/core.py", line 148, in setup
        dist
.run_commands()
     
File "/usr/lib/python3.5/distutils/dist.py", line 955, in run_commands
       
self.run_command(cmd)
     
File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
        cmd_obj
.run()
     
File "/usr/lib/python3/dist-packages/setuptools/command/install.py", line 61, in run
       
return orig.install.run(self)
     
File "/usr/lib/python3.5/distutils/command/install.py", line 583, in run
       
self.run_command('build')
     
File "/usr/lib/python3.5/distutils/cmd.py", line 313, in run_command
       
self.distribution.run_command(command)
     
File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
        cmd_obj
.run()
     
File "/tmp/pip-build-e1cydksk/dbus-python/setup.py", line 62, in run
        cwd
=builddir)
     
File "/usr/lib/python3.5/subprocess.py", line 581, in check_call
       
raise CalledProcessError(retcode, cmd)
    subprocess
.CalledProcessError: Command '['/tmp/pip-build-e1cydksk/dbus-python/configure', '--disable-maintainer-mode', 'PYTHON=/usr/bin/python3', '--prefix=/tmp/pip-build-e1cydksk/dbus-python/build/temp.linux-x86_64-3.5/prefix']' returned non-zero exit status 1
   
   
----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-e1cydksk/dbus-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-u5_835r3-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-e1cydksk/dbus-python/



I already tried to tinker with my python versions and installed libraries, but could not get it to work. If anybody has any ideas, I'd really appreciate it!

Joe

unread,
May 5, 2017, 6:18:27 PM5/5/17
to autoke...@googlegroups.com
We've seen that problem a few times. I'm not sure what fixes it. You
might have to backup ~/.config.autokey (including hidden files), delete
it and let AutoKey rebuild it.

But, the best approach would be to install the -py3 version as you have
attempted.

The issue, as I understand it, is that setup.py installs AutoKey, but
not its dependencies.

There are some instructions for doing this on the -py3 page on GitHub. I
haven't done it in awhile, so I don't know how complete they are, etc..

I am including a previous post below from someone (Sven) who got it to
work. It probably has a few extra steps in it, but hopefully it will get
you going.

I don't remember what Mint uses for a package manager, so you may have
to translate a bit from Ubuntu-ese.

Make sure you do the whole thing either as a single user install or as a
system wide install. I tried half and half while I was trying to figure
it out and had a mess to clean up afterward.

Post back as you make progress or get stuck.

Once you do get it to work, it would be good if you would inform the
Mint packaging team so they can address the issue and prevent this
problem for other users. Now, that Mint is so popular, this could affect
a lot of people.

Joe

P.S. Everybody posts their problems here - which is why we're here, but
it is also nice when people share how they are using AutoKey
successfully. I am always looking for ideas and example code to add to
the wiki.

> I was able to get the Python 3 version going on a new Ubuntu 16.04 LTS
> install, I will write out everything I did in case it helps anyone
> else. I know I made some wrong turns but I will write it all just in case:
>
> - Install git
> sudo apt-get install git
>
> - I placed it in am "installs" dir in my home dir
> (inside home dir) mkdir installs
> cd installs
>
> - Download the project
> git clone https://github.com/guoci/autokey-py3
>
> - Enter new dir
> cd autokey-py3/
>
> - At this point I should have read the README.rst file which got it
> going in the end, but I didnt, I tried building the .deb file
> dpkg-buildpackage -us -uc
>
> - Which returned:
> dpkg-checkbuilddeps: error: Unmet build dependencies: debhelper (>= 7)
> cdbs (>= 0.4.49) python-central (>= 0.6.0)
> dpkg-buildpackage: warning: build dependencies/conflicts unsatisfied;
> aborting
>
> - Using Synaptic I installed:
> debhelper (9.20160115ubuntu3)
> cdbs (0.4.130ubuntu2)
>
> - There is no python-central package shown, so I installed it manually
> from:
> http://www.ubuntuupdates.org/package/mint_upstream/rebecca/upstream/base/python-central
> I downloaded from the "All Arch deb package" button, doubleclicked to
> install through Software center
>
> - Try building .deb again:
> dpkg-buildpackage -us -uc
>
> - returned (at the end of a long script):
> dh_install: autokey-common missing files:
> usr/lib/python*/*-packages/autokey-*.egg-info
> dh_install: missing files, aborting
> /usr/share/cdbs/1/rules/debhelper.mk:213: recipe for target
> 'binary-install/autokey-common' failed
> make: *** [binary-install/autokey-common] Error 2
> dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit
> status 2
>
> - I found references to these in the code and also found the files
> they were pointing to, so I re-wrote the code to point directly to them:
>
> file: /home/user/installs/autokey-py3/debian/autokey-common.install
> change line: usr/lib/python*/*-packages/autokey-*.egg-info
> to: usr/lib/python*/*-packages/autokey_py3-0.93.6-py2.7.egg-info
>
> file: /home/user/installs/autokey-py3/autokey.spec
> change line: %{python_sitelib}/%{name}-%{version}-py%{py_ver}.egg-info
> to:
> %/home/user/installs/autokey-py3/debian/tmp/usr/lib/python2.7/site-packages/autokey_py3-0.93.6-py2.7.egg-info
>
> - At this point it seemed to build the .deb's, but when I tried to run
> them I had install errors, would not work, there were references to
> unicode chars but encoding not being defined, it was at this point I
> found the README.rst file (after reading
> https://github.com/guoci/autokey-py3/issues/7), and completed these
> actions:
> sudo apt-get install python3-pyinotify wmctrl xautomation imagemagick
> sudo apt-get install python3-gi gir1.2-gtk-3.0 gir1.2-gtksource-3.0
> gir1.2-glib-2.0 gir1.2-notify-0.7 python3-dbus zenity
>
> - I had to install pip3 to continue with the readme instructions:
> sudo apt-get install pip3
>
> - and on:
> pip3 install --user python3-xlib
> pip3 install --user autokey-py3
>
> After this autokey was in my system and I could run it, but I had to
> reset before the actions would work.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "autokey-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to autokey-user...@googlegroups.com
> <mailto:autokey-user...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.


On 05/05/2017 11:12 AM, Julian Hoch wrote:
> I've been using autokey for quite a while, and recently upgraded my
> system to Linux Mint (XFCE edition) 18.1.
> Since then, I cannot get autokey to run anymore.
>
> If I try to install the version provided with the distribution, I can
> install that but when I try to run it, it says:
> |
> "Fatal error starting AutoKey.
> 'utf-8' codec can't decode byte 0xf1 in position 63: invalid
> continuation byte"
> |
>
>
>
> I tried to install the version from github, and the install process
> completes, but if I try to run it I get:
> |
> /usr/local/lib/python2.7/dist-packages/autokey/gtkapp.py:24:PyGIWarning:Gtkwas
> imported without specifying a version
> first.Usegi.require_version('Gtk','3.0')before importto ensurethat the
> right version gets loaded.
> fromgi.repository importGtk,Gdk,GObject,GLib
> /usr/lib/python2.7/dist-packages/pyatspi/__init__.py:17:PyGIWarning:Atspiwas
> imported without specifying a version
> first.Usegi.require_version('Atspi','2.0')before importto ensurethat
> the right version gets loaded.
> fromgi.repository importAtspi
> Traceback(most recent call last):
> File"/usr/local/bin/autokey-gtk",line 20,in<module>
> fromautokey.gtkapp importApplication
> File"/usr/local/lib/python2.7/dist-packages/autokey/gtkapp.py",line
> 28,in<module>
> importservice,monitor
> File"/usr/local/lib/python2.7/dist-packages/autokey/service.py",line
> 21,in<module>
> fromiomediator importKey,IoMediator
> File"/usr/local/lib/python2.7/dist-packages/autokey/iomediator.py",line
> 142,in<module>
> frominterfaceimport*
> File"/usr/local/lib/python2.7/dist-packages/autokey/interface.py",line
> 29,in<module>
> fromXlibimportX,XK,display,error
> ImportError:Nomodulenamed Xlib
> |
>
>
> Then I tried to install the autokey-py3 version, but the configure
> script fails with:
> |
> configure:error:Packagerequirements (dbus-glib-1>=0.70)were notmet:
>
> Nopackage'dbus-glib-1'found
>
> Consideradjusting the PKG_CONFIG_PATH environment variable ifyou
> installed software ina non-standard prefix.
>
> Alternatively,you may setthe environment variables DBUS_GLIB_CFLAGS
> andDBUS_GLIB_LIBS to avoid the need to call pkg-config.
> Seethe pkg-config man page formore details.
> Traceback(most recent call last):
> File"<string>",line 1,in<module>
> File"/tmp/pip-build-e1cydksk/dbus-python/setup.py",line 106,in<module>
> 'build_ext':BuildExt,
> File"/usr/lib/python3.5/distutils/core.py",line 148,insetup
> dist.run_commands()
> File"/usr/lib/python3.5/distutils/dist.py",line 955,inrun_commands
> self.run_command(cmd)
> File"/usr/lib/python3.5/distutils/dist.py",line 974,inrun_command
> cmd_obj.run()
> File"/usr/lib/python3/dist-packages/setuptools/command/install.py",line
> 61,inrun
> returnorig.install.run(self)
> File"/usr/lib/python3.5/distutils/command/install.py",line 583,inrun
> self.run_command('build')
> File"/usr/lib/python3.5/distutils/cmd.py",line 313,inrun_command
> self.distribution.run_command(command)
> File"/usr/lib/python3.5/distutils/dist.py",line 974,inrun_command
> cmd_obj.run()
> File"/tmp/pip-build-e1cydksk/dbus-python/setup.py",line 62,inrun
> cwd=builddir)
> File"/usr/lib/python3.5/subprocess.py",line 581,incheck_call
> raiseCalledProcessError(retcode,cmd)
>
> subprocess.CalledProcessError:Command'['/tmp/pip-build-e1cydksk/dbus-python/configure',
> '--disable-maintainer-mode', 'PYTHON=/usr/bin/python3',
> '--prefix=/tmp/pip-build-e1cydksk/dbus-python/build/temp.linux-x86_64-3.5/prefix']'returned
> non-zero exitstatus 1
>
> ----------------------------------------
> Command"/usr/bin/python3 -u -c
> "importsetuptools,tokenize;__file__='/tmp/pip-build-e1cydksk/dbus-python/setup.py';f=getattr(tokenize,'open',open)(__file__);code=f.read().replace('\r\n','\n');f.close();exec(compile(code,__file__,'exec'))"
> install --record /tmp/pip-u5_835r3-record/install-record.txt
> --single-version-externally-managed --compile --user --prefix="failed
> witherror code 1in/tmp/pip-build-e1cydksk/dbus-python/
>
> |
>
>
> I already tried to tinker with my python versions and installed
> libraries, but could not get it to work. If anybody has any ideas, I'd
> really appreciate it!
> --
> You received this message because you are subscribed to the Google
> Groups "autokey-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to autokey-user...@googlegroups.com
> <mailto:autokey-user...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

Julian Hoch

unread,
May 6, 2017, 2:55:06 AM5/6/17
to autokey-users
Thanks for the info. After manually installing the libdbus dependencies, I managed to install the python3 version from github. Unfortunately, when I try to start it, I still get the same error:

"Fatal error starting AutoKey.
'utf-8' codec can't decode byte 0xf1 in position 63: invalid continuation byte"

So back to zero...


Joe

unread,
May 6, 2017, 3:45:59 AM5/6/17
to autoke...@googlegroups.com
Well, not quite.

There are a few things to try:

1) What happens if you run AutoKey (from a terminal) like this:

LC_ALL=C LC_CTYPE=C autokey-gtk

or the same with autokey-qt, if that's what you are using?

2) What is the output of the locale command (at a terminal command prompt)?

3) Try my earlier suggestion of backing up ~/.config/autokey and then
deleting it. This may be where all your phrases and macros are stored,
so be careful (hidden files ...). If you want to, you can just rename
the the autokey directory so AutoKey won't find it.

If you get lucky and this works, you can gradually restore the files
from your backup until it breaks again. Then, you can focus on just the
problem file(s). Remember that each macro and phrase has an associated
hidden .json file, so you have to restore them in pairs.

4) Once you have the answers to the above, one major thing has changed -
you're working with autokey-py3 - so you can box up all the results and
file them as an issue on the -py3 branch on GitHub (and tell Troy, the
developer, I said, "Hi." <G>) Hopefully, he will have the knowledge and
tools to figure this out and fix it. You are not the only one who has
had this issue, so it is definitely worth fixing.

Whatever happens, please post back here so we can use the results to
help others.

Joe

Julian Hoch

unread,
May 8, 2017, 11:55:12 AM5/8/17
to autokey-users
Hi Joe,
looks like deleting the config file was the right idea! I moved the config file to another location, now it starts up. I'll see if I can somehow get the content of the config file back to the newly created file, but at least no weird errors anymore.
I haven't found out what exactly caused it yet. The error sounds like an encoding error, perhaps my Umlauts or other non-ascii characters caused it. Also, the error message was different when using a different locale setting as you recommended.
I'll update when I find out the result, but it's strange since the file worked previously (just another version).
In any case, a more human readable error message might be advisable :)
Julian

Joe

unread,
May 8, 2017, 9:46:14 PM5/8/17
to autoke...@googlegroups.com
Great!

There's a section of the docs on importing phrases and macros to a new
install.

See:
https://github.com/autokey/autokey/wiki/Installing-AutoKey#moving-autokey-scripts-and-phrases-from-computer-to-computer

Since you have a non-US character set, I would definitely recommend
using the -py3 branch of AutoKey. Aside from it being newer and
maintained, it is based on Python 3.x and one of the major enhancements
to Python 3 was better handling of multibyte character sets.

Looking forward to hearing from you.

Joe

Julian Hoch

unread,
May 9, 2017, 11:13:51 AM5/9/17
to autokey-users
So I had all my phrases in a subfolder, so I just copied that subfolder of the "data" directory to the new install config, and that seems to work. So I guess it must have been something in my "autokey.json" file, not the actual phrases.
I couldn't find any significant differences between the two files, but since I didn't really make any changes to the global configuration, I don't care too much and am just happy it works.
Thanks again!
Reply all
Reply to author
Forward
0 new messages