title: "[Errno 13] Access denied" when connecting to USB
body: <p>So I have been following <a href="https://python-escpos.readthedocs.io/en/latest/index.html#" rel="nofollow noreferrer">these</a> documentations so that I can print on my thermal printer through python.</p>
  
  <p>I am running Ubuntu and have the pyusb module installed.
  The printer is a Rongta RP58, and it's idVendor and idProduct were found through the lsusb command (0fe6:811e).</p>
  
  <p>Just like in the instructions, I enter:</p>
  
  <pre><code>from escpos.printer import Usb
  p = Usb(0x0fe6, 0x811e)
  </code></pre>
  
  <p>but the error appears</p>
  
  <pre><code>Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "/home/testerdell/.local/lib/python2.7/site-packages/escpos/printer.py", line 51, in __init__
      self.open()
    File "/home/testerdell/.local/lib/python2.7/site-packages/escpos/printer.py", line 62, in open
      check_driver = self.device.is_kernel_driver_active(0)
    File "/home/testerdell/.local/lib/python2.7/site-packages/usb/core.py", line 1061, in is_kernel_driver_active
      self._ctx.managed_open()
    File "/home/testerdell/.local/lib/python2.7/site-packages/usb/core.py", line 102, in wrapper
      return f(self, *args, **kwargs)
    File "/home/testerdell/.local/lib/python2.7/site-packages/usb/core.py", line 120, in managed_open
      self.handle = self.backend.open_device(self.dev)
    File "/home/testerdell/.local/lib/python2.7/site-packages/usb/backend/libusb1.py", line 786, in open_device
      return _DeviceHandle(dev)
    File "/home/testerdell/.local/lib/python2.7/site-packages/usb/backend/libusb1.py", line 643, in __init__
      _check(_lib.libusb_open(self.devid, byref(self.handle)))
    File "/home/testerdell/.local/lib/python2.7/site-packages/usb/backend/libusb1.py", line 595, in _check
      raise USBError(_strerror(ret), ret, _libusb_errno[ret])
  usb.core.USBError: [Errno 13] Access denied (insufficient permissions)
  </code></pre>
  
  <p>In the <a href="http://python-escpos.readthedocs.io/en/latest/user/installation.html?highlight=rules#setup-udev-for-usb-printers" rel="nofollow noreferrer">documentation</a> it suggested to create a rule that grants access, but it hasn't worked for me.</p>
  
  <pre><code>sudo nano /etc/udev/rules.d/99-escpos.rules
  </code></pre>
  
  <p>is the command I use to edit the file, and this is what's inside</p>
  
  <pre><code>SUBSYSTEM=="usb", ATTRS{idVendor}=="0fe6", ATTRS{idProduct}=="811e", MODE="0664", GROUP="dialout"
  </code></pre>
  
  <p>after changing anything in that file, I run this code:</p>
  
  <pre><code>sudo service udev restart
  </code></pre>
  
  <p>I am not sure how else I can give USB access to python.
  When using direct root access with</p>
  
  <pre><code>sudo su root
  </code></pre>
  
  <p>the system says "ImportError: No module named escpos.printer". I wouldn't want to enter the password for root access every single time.</p>
  
  <p>Is there a problem with my udev rules, groups, mode, user permissions?</p>
  
  <p>Any help is greatly appreciated! Thanks in advance :) </p>