Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: "Adam" Newsgroups: comp.lang.python Subject: Re: PySerial could not open port COM4: [Error 5] Access is denied - please help Date: Wed, 27 Jun 2012 15:51:38 -0700 Organization: A noiseless patient Spider Lines: 54 Message-ID: References: Injection-Date: Wed, 27 Jun 2012 22:51:41 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="Bh0M18YIbCo+pO+cFqDnkw"; logging-data="8444"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18AVVI97TTeglbiJXgQe9Up" X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-RFC2646: Format=Flowed; Original X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 Cancel-Lock: sha1:GvPE4Ku4kZE3afRGiR0ORCOp484= X-Priority: 3 X-MSMail-Priority: Normal Xref: csiph.com comp.lang.python:24557 "Temia Eszteri" wrote in message news:ra2nu7h75720i75ijhabg12dngrab756e8@4ax.com... > On Wed, 27 Jun 2012 22:18:59 +0000 (UTC), Grant Edwards > 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).