Serial - could not open port ' COM4' - access denied

Hi,

I am trying to send audio stimulus triggers to actiview (biosemi eeg) through serial port. But I keep getting this error message "serial.serialutil.SerialException: could not open port ‘COM4’: PermissionError(13, ‘Access is denied.’, None, 5) ".

I am the admin and have rebooted the windows pc system, closed all other applications , restarted pyschopy but none worked. I also downloaded “Termite” as recommended by biosemi to check if the port COM4 is working alright and sending the right triggers. And that seems to be working fine.

Begin experiment*

import serial
port=serial.Serial("COM4", baudrate=115200)

Begin routine*

trigger=False

Each Frame

if t>=0.1 and not trigger:
    port.write(str.encode(chr(stim)))
    trigger=True

Were you able to fix your this issue? I am currently having difficulties sending triggers from PsychoPy to Actiview with the USB Trigger Interface and have received this same error message.

Hi ! yes. You just need to do this once.

In my custom code : I entered this and it worked.

1 Like

Thank you for sharing! Would you also mind sharing what you have for code in the other tabs?

1 Like