title: Com Port Permissions Python
body: <p>Working on trying to get serial comminications working between an arduino and my computer. When working off the code that can be seen <a href="http://www.instructables.com/id/Interface-Python-and-Arduino-with-pySerial/?ALLSTEPS" rel="nofollow noreferrer">here</a> I keep getting this error: </p>
  
  <pre><code>raise SerialException("could not open port {!r}: {!r}".format(self.portstr,     ctypes.WinError()))
  serial.serialutil.SerialException: could not open port 'COM4': WindowsError(5, 'Access is denied.')
  </code></pre>
  
  <p>I have edited the com port used in the aformentioned code to match what I am actually using, but I cant get this error to go away. Here are a few thinks I've tried:</p>
  
  <ul>
  <li>Ran file as administrator</li>
  <li>Started pycharm as administrator</li>
  <li>Changed the security properties for the directory the program is in</li>
  <li>Unistalled and reinstalled the COM port in device manager</li>
  <li>Restarted Computer</li>
  </ul>
  
  <p>The weird thing is sometimes after I do these fixes it will work once, and then when I stop the program and start it again it once again throws the error.</p>