PySerial could not open port COM4: [Error 5] Access is denied - please help

Adam adam at no_thanks.com
Wed Jun 27 18:51:38 EDT 2012


"Temia Eszteri" <lamialily at cleverpun.com> wrote in message 
news:ra2nu7h75720i75ijhabg12dngrab756e8 at 4ax.com...
> On Wed, 27 Jun 2012 22:18:59 +0000 (UTC), Grant Edwards
> <invalid at invalid.invalid> wrote:
>
>>> Can you post a small example showing what you're doing?
>>
>>The best way to get help is to write as small a program as possible
>>that demonstrates the problem, and post it.  I'll help you get
>>started...
>>
>>Does this program work?
>>
>>    import serial
>>    ser = serial.Serial("COM4")
>>    ser.close()
>>
>>At the moment, I don't have access to a Windows machine, but I think
>>the above should run without any errors.  If it works, then you've
>>successfully opened and closed the COM4 port.  Start adding
>>"features", in increments as small as possible, until the program
>>fails.
>>
>>Then try to remove stuff that's not needed while still keeping the
>>failure.
>>
>>IOW, try to find the smallest possible program that fails.
>>
>>Usually, in the process of doing that, you'll figure out what you were
>>doing wrong.  If not, post the smallest failing program you can come
>>up with, and somebody will be able to help.
>>
>>If you won't show us what you're doing, we can't tell you what you're
>>doing wrong.
>
> Actually, I believe someone in an earlier thread in the newsgroup or
> elsewhere pointed out that serial ports automatically open under
> Windows. I'd have to look it back up when I have the time, which I
> don't have at the moment, unfortunately.
>
> ~Temia
> -- 
> The amazing programming device: fuelled entirely by coffee, it codes while
> awake and tests while asleep!


Thanks, I think I read that as well but can't recall where.

I am just running Python scripts (downloaded),
which is not opening the serial port more than once (as Grant keeps 
assuming).





More information about the Python-list mailing list