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


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*


Each Frame

if t>=0.1 and not trigger:

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.


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


Has this been resolved on your end knagel27? I’m having the same issue as you!

1 Like

I’m also having the same issue, I’ve adjusted the code for the fix but am still having the exact same error. Does anyone have another resolution for this?

Hi! I had this problem and for me I think it was because I had multiple psychopy experiments with serial components open at the same time (not running, just open, for testing various things). It was solved by only having one open at a time. the error usually happens if something else is trying to access the port