Forked from old version of
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
forest a5887efd7b non-root user 1 year ago
printer first commit 1 year ago
.gitignore first commit 1 year ago
Pipfile first commit 1 year ago
Pipfile.lock first commit 1 year ago non-root user 1 year ago
terow.jpeg first commit 1 year ago


small black reciept printer that says terow on the front

(this is not my project, it was cloned from an older version of

To install the dependencies using pipenv

First make sure to install/update pipenv:

sudo pip install pipenv

Then run the install:

pipenv install

To test the project with a USB reciept printer

This works on the TEROW pos-5890k printer.

First lets just try running it:

echo "hello world!!" | pipenv run python3 printer/

⚠️ NOTE: this should fail with the error usb.core.USBError: [Errno 13] Access denied (insufficient permissions)

This is expected because we are running our python code as a normal user but by default, we can only access the serial port exposed by the USB device if we become root, for example, with sudo.

🤬 ARGH: both pipenv and sudo modify the shell environment, so using them together is extremely likely to break everything.

Instead of trying to figure out how to get sudo and pipenv to play nice together, I think it might be easier to expose the USB device properly so that our non-root user may access it.


Here is a walkthrough of how I did it:

forest@thingpad:~$ lsusb
Bus 001 Device 002: ID 0416:5011 Winbond Electronics Corp. Virtual Com Port

Great, now we have the device manufacturer id 0416 and the device type id 5011.

Now we just need to come up with a linux group that we want to grant access to the device. For now I will just use the sudo group, the group of users who are allowed to sudo.

You can see the list of groups your user is in with the groups command:

forest@thingpad:~$ groups
forest adm cdrom sudo dip plugdev lpadmin lxd sambashare libvirt

Ok now it's time to create the udev rules file for the printer.

sudo nano /etc/udev/rules.d/99-escpos.rules

Write the following text to the file, including your manufacturer, device type, and group:

SUBSYSTEM=="usb", ATTRS{idVendor}=="0416", ATTRS{idProduct}=="5011", MODE="0664", GROUP="sudo"

We have to restart udev for our changes to take effect:

sudo service udev restart

Also, finally, you will have to power cycle or disconnect and reconnect the printer before the changes will take effect.

Once you have done that, you should be able to run:

echo "hello world!!" | pipenv run python3 printer/

And see hello world on your thermal paper!