Go2Linux | Linux Operating System

A site dedicated to: Linux Operating System

HPLIP Syntax error invalid syntax

Date: 2010-11-18 00:00:00 -0400

HPLIP: Installing HP Printer plugin

If you are installing a HP Printer on Arch Linux, and it is one that needs proprietary plugin, you may have problems while building that plugin.

This is because Arch Linux upgraded python from 2 to 3, so while you are running hp-setup or hp-plugin, if you see this error:

Verifying archive integrity... All good. Uncompressing HPLIP 3.10.9 Plugin Self Extracting Archive... File "./plugin_install.py", line 78 except ImportError, e: ^ SyntaxError: invalid syntax error: Python gobject/dbus may be not installed

You need to use python 2 to run the script instead of python 3, one easy way to do it is:

* The steps*

  1. Delete the /usr/bin/python file which is just a link to /usr/bin/python3
  2. Change to /usr/bin folder
  3. Create a new link, this time pointing to python 2.7

The commands

rm -rf /usr/bin/python
cd /usr/bin
ln -s /usr/bin/python2.7 python

You’re done.

But I preferred to make just an exception for this time, and create a temporal link, and leave the original one as it is.

The steps

  1. Go to /tmp folder
  2. Create the link to python2.7
  3. Add /tmp to the path
  4. Export the new PATH variable

The commands

cd /tmp
link -s /usr/bin/python2.7 python
PATH=/tmp:$PATH
export PATH

Now, you can run all the programs you need to use python2 and then just delete the link in the /tmp folder and you are done.

If you liked this article please share it.

powered by TinyLetter

If you want to contact me in any other way, please use the contact page.