Serial PermissionError issue

Hi everyone,

I am having a problem with using a simple serial port trigger in psychopy sending simple triggers to an Arduino board. The program keeps giving me an access denied error - PermissionError(13, ‘Access is denied.’, None, 5). None of the suggestions on the forum for this issue have worked thus far - most I can find online just say that this means the COM port is occupied by something else, but I have repeatedly confirmed that is not the case here.

I have done extensive troubleshooting on this issue – I have attempted this on several computers, including one with a totally fresh install of Windows and PsychoPy. If I open the python code from the builder and run the serial components one at a time it works flawlessly and I can confirm it communicates with the board just fine.

I have done this both with using code and trying to use the builder objects to no avail. Each time I have confirmed the availability of the COM port using Termite (which I disconnect each time).

Running python on its own to send basic triggers also works normally. It seems to be something specifically about PsychoPy causing this to happen. I also ran PsychoPy as an administrator to no avail. I am losing my wits on this one! Any help is appreciated.

Full error message:

Traceback (most recent call last):
  File "C:\Users\Sam\Desktop\TaskFiles\ACQ_test2_with_COM_lastrun.py", line 226, in <module>
    port = serial.Serial(
  File "C:\Program Files\PsychoPy\lib\site-packages\serial\serialwin32.py", line 33, in __init__
    super(Serial, self).__init__(*args, **kwargs)
  File "C:\Program Files\PsychoPy\lib\site-packages\serial\serialutil.py", line 244, in __init__
    self.open()
  File "C:\Program Files\PsychoPy\lib\site-packages\serial\serialwin32.py", line 64, in open
    raise SerialException("could not open port {!r}: {!r}".format(self.portstr, ctypes.WinError()))
serial.serialutil.SerialException: could not open port 'COM4': PermissionError(13, 'Access is denied.', None, 5)`````

Update - Solved my own issue! It appears this was a bug with the version of PsychoPy on the website. I installed the latest version from GitHub (v2023.1.0) and it works!