Getting error "serial.serialutil.SerialException: [Errno 2] could not open port /dev/rfcomm0" with pyserial
<p>I want to communicate with my serial port in python. I installed pyserial for linux:</p>

<pre><code>import thread
import serial
PORT = '/dev/rfcomm0'
BAUDRATE = 921600
TIMEOUT = 1  
port = serial.Serial(port=PORT, baudrate=BAUDRATE, timeout=TIMEOUT)
port.open()
...
port.close()
</code></pre>

<p>It gives the following error:</p>

<pre><code>Traceback (most recent call last):
  File "/home/dnaphone/PycharmProjects/test/BluetoothClient.py", line 12, in &lt;module&gt;
    port = serial.Serial(port=PORT, baudrate=BAUDRATE, timeout=TIMEOUT)
  File "/usr/local/lib/python2.7/dist-packages/serial/serialutil.py", line 182, in __init__
    self.open()
  File "/usr/local/lib/python2.7/dist-packages/serial/serialposix.py", line 247, in open
    raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
serial.serialutil.SerialException: [Errno 2] could not open port /dev/rfcomm0: [Errno 2] No such file or directory: '/dev/rfcomm0'
</code></pre>