title: No such file or directory: '/dev/ttyUSB0'
body: <p>I am trying to interface a Raspberry Pi with a USB RFID card reader using a Python script. For the record, my code is as follows:</p>
  
  <pre><code>import serial, time, sys
  import sqlite3 as lite
  
  reader = "/dev/ttyUSB0"
  ser = serial.Serial(reader, timeout=1)
  print("Connected to RFID reader on:", reader)
  
  try:
      while True:
          thetime = time.strftime("%Y-%m-%d %a %H:%M:%S", time.localtime())
          ser.flushInput() # flush any extra data from the serial port
          rfid_data = ser.readline().strip()
  
          if len(rfid_data) &gt; 0:
              rfid_data = rfid_data[1:11]
              print("Card scanned", rfid_data)
  
  
          else:
              print("Card not found")
  
  except:
      print("Unexpected error")
  
  finally:
      ser.close()
  </code></pre>
  
  <p>I'm actually receiving more than one error at the moment. Instead of trying my best to explain it in my own words, I am sure that the following snippet would be more useful to most of you. </p>
  
  <blockquote>
  <pre><code>Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 275, in open
      self.fd = os.open(self.portstr, os.O_RDWR|os.O_NOCTTY|os.O_NONBLOCK)
  FileNotFoundError: [Errno 2] No such file or directory: '/dev/ttyUSB0'
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "/home/pi/Desktop/Alex Panagis/rfidtestfinal.py", line 5, in &lt;module&gt;
      ser = serial.Serial(reader, timeout=1)
    File "/usr/lib/python3/dist-packages/serial/serialutil.py", line 261, in __init__
      self.open()
    File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 278, in open
      raise SerialException("could not open port %s: %s" % (self._port, msg))
  serial.serialutil.SerialException: could not open port /dev/ttyUSB0: [Errno 2] No such file or directory: '/dev/ttyUSB0'
  </code></pre>
  </blockquote>
  
  <p>Any help in resolving this issue is greatly appreciated :)</p>