could not open port 'COM3': WindowsError(5, 'Access is denied.')

Asked by Gerb Il on 2020-01-20

I am using Sikuli to execute a small .exe app written from python that communicates with an Arduino board. The board emulates a true HID mouse via a serial port, and the .exe file tells the board to send a mouseclick.

For several weeks everything was working perfectly until recently when I started to intermittently get an error that the COM port could not be opened. This happens only when I execute the app through Sikuli. When I run the app from command line or double-click directly, it functions without error.

Any idea why this occurs?

This is the command window output:

Microsoft Windows [Version 10.0.17763.973]
(c) 2018 Microsoft Corporation. All rights reserved.

C:\Users\D\Desktop\LPM>[u'COM3']
[u'COM3']
[u'COM3']
[u'COM3']
[u'COM3'[u'COM3']
][[
uu'COM3'[u'COM3']
Traceback (most recent call last):
  File "click.py", line 14, in <module>
  File "site-packages\serial\serialwin32.py", line 31, in __init__
  File "site-packages\serial\serialutil.py", line 240, in __init__
  File "site-packages\serial\serialwin32.py", line 62, in open
serial.serialutil.SerialException: could not open port 'COM3': WindowsError(5, 'Access is denied.')
[2636] Failed to execute script click
'COM3']]

Traceback (most recent call last):
[ File "click.py", line 14, in <module>
[u[u'COM3']
  File "site-packages\serial\serialwin32.py", line 31, in __init__
'COM3'[u File "site-packages\serial\serialutil.py", line 240, in __init__
]u['COM3'[ File "site-packages\serial\serialwin32.py", line 62, in open
userial.serialutil[u]
'COM3''COM3'.]'COM3'
]Traceback (most recent call last):
SerialException
]u
  File "click.py", line 14, in <module>
: File "site-packages\serial\serialwin32.py", line 31, in __init__

'COM3'Traceback (most recent call last):
Traceback (most recent call last):
c File "click.py", line 14, in <module>
] File "site-packages\serial\serialwin32.py", line 31, in __init__
Traceback (most recent call last):
  File "site-packages\serial\serialutil.py", line 240, in __init__
  File "click.py", line 14, in <module>
  File "click.py", line 14, in <module>

  File "site-packages\serial\serialutil.py", line 240, in __init__
ould not open port 'COM3': WindowsError(5, 'Access is denied.') File "site-packages\serial\serialwin32.py", line 62, in open
  File "site-packages\serial\serialwin32.py", line 31, in __init__
  File "site-packages\serial\serialwin32.py", line 31, in __init__
Traceback (most recent call last):
  File "site-packages\serial\serialwin32.py", line 62, in open

[10056] Failed to execute script click
serial.serialutilserial.serialutil File "site-packages\serial\serialutil.py", line 240, in __init__
  File "site-packages\serial\serialutil.py", line 240, in __init__
  File "click.py", line 14, in <module>
.. File "site-packages\serial\serialwin32.py", line 62, in open
  File "site-packages\serial\serialwin32.py", line 62, in open
  File "site-packages\serial\serialwin32.py", line 31, in __init__
SerialExceptionSerialExceptionserial.serialutilserial.serialutil File "site-packages\serial\serialutil.py", line 240, in __init__
: : .. File "site-packages\serial\serialwin32.py", line 62, in open
ccSerialExceptionSerialExceptionserial.serialutilould not open port 'COM3': WindowsError(5, 'Access is denied.')ould not open port 'COM3': WindowsError(5, 'Access is denied.'): : .
SerialExceptioncc
[8356] Failed to execute script click
ould not open port 'COM3': WindowsError(5, 'Access is denied.')ould not open port 'COM3': WindowsError(5, 'Access is denied.')[9896] Failed to execute script click

[15636] Failed t
[o: 3116] execute script click
Failed to execucte script click
ould not open port 'COM3': WindowsError(5, 'Access is denied.')
[11324] Failed to execute script click

Question information

Language:
English Edit question
Status:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2020-01-20
Last reply:
2020-01-21
Daniel Shats (shantzzz) said : #1

It's working now. I found that I had duplicate functions in two different places in the script. Once I removed one of them, things began to work again.

Can you help with this problem?

Provide an answer of your own, or ask Gerb Il for more information if necessary.

To post a message you must log in.