Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #24632

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

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:: [': 0.03; 'subject:Error': 0.07; 'works.': 0.07; 'subject:help': 0.07; 'anymore.': 0.09; 'creation,': 0.09; 'if,': 0.09; 'linux.': 0.09; 'open()': 0.09; 'port,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'successive': 0.09; 'windows,': 0.09; 'subject:not': 0.11; 'thread': 0.11; 'message- id:@dough.gmane.org': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:PySerial': 0.16; 'subject:port': 0.16; 'pointed': 0.17; "shouldn't": 0.17; 'subject:] ': 0.19; 'windows': 0.19; 'earlier': 0.21; "i'd": 0.22; 'linux': 0.24; 'script': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'subject:please': 0.27; "doesn't": 0.28; 'header:X-Complaints-To:1': 0.28; 'once,': 0.29; '"the': 0.29; 'received:84': 0.32; 'to:addr:python-list': 0.33; 'open': 0.35; 'something': 0.35; 'received:org': 0.36; 'but': 0.36; 'anything': 0.36; 'possible': 0.37; 'does': 0.37; 'subject:: ': 0.38; 'object': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'your': 0.60; 'skip:u 10': 0.60; 'back': 0.62; 'time,': 0.62; 'more': 0.63; 'behavior': 0.64; 'serial': 0.66; 'believe': 0.69; 'actually,': 0.84; 'ports': 0.93
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Roel Schroeven <roel@roelschroeven.net>
Subject Re: PySerial could not open port COM4: [Error 5] Access is denied - please help
Date Thu, 28 Jun 2012 21:08:29 +0200
References <jse17v$d5n$1@dont-email.me> <jse604$1cq$1@dont-email.me> <jseim6$tn7$1@dont-email.me> <jseu9c$sp3$1@dont-email.me> <jsf8nf$13d$1@dont-email.me> <jsfatv$djt$1@dont-email.me> <jsfgkr$kf7$1@dont-email.me> <jsfhv2$ta9$1@dont-email.me> <jsfr3i$p6d$1@dont-email.me> <jsftah$bb5$1@reader1.panix.com> <jsfv3v$imr$1@dont-email.me> <jsg05u$mgk$1@reader1.panix.com> <jsg0sj$4t9$1@reader1.panix.com> <ra2nu7h75720i75ijhabg12dngrab756e8@4ax.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host d54c6d210.access.telenet.be
User-Agent Thunderbird 2.0.0.24 (Windows/20100228)
In-Reply-To <ra2nu7h75720i75ijhabg12dngrab756e8@4ax.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1618.1340910525.4697.python-list@python.org> (permalink)
Lines 35
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1340910525 news.xs4all.nl 6964 [2001:888:2000:d::a6]:59639
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:24632

Show key headers only | View raw


Temia Eszteri schreef:
> 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.

That doesn't have anything to do with Windows, but with how pySerial 
works. See the documentation for __init__():

"The port is immediately opened on object creation, when a port is 
given. It is not opened when port is None and a successive call to 
open() will be needed."

So if your script does something like

prt = serial.Serial('COM4')

then pySerial automatically opens the port, and you shouldn't call 
prt.open() anymore.

If, on the contrary, you do something like

prt = serial.Serial()
prt.port = 'COM4'

then pySerial doesn't open the port, and you have to call prt.open() to 
do it.

PySerial has this same behavior on both Windows and Linux. The 
difference might be that on Linux it is possible to open serial ports 
more than once, while that doesn't work on Windows.

Best regards,
Roel

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

PySerial could not open port COM4: [Error 5] Access is denied - please help "Adam" <adam@no_thanks.com> - 2012-06-26 21:12 -0700
  Re: PySerial could not open port COM4: [Error 5] Access is denied - please help John Nagle <nagle@animats.com> - 2012-06-26 22:33 -0700
    Re: PySerial could not open port COM4: [Error 5] Access is denied - please help "Adam" <adam@no_thanks.com> - 2012-06-27 02:10 -0700
      Re: PySerial could not open port COM4: [Error 5] Access is denied - please help Paul <nospam@needed.com> - 2012-06-27 08:28 -0400
        Re: PySerial could not open port COM4: [Error 5] Access is denied - please help "Adam" <adam@no_thanks.com> - 2012-06-27 08:26 -0700
          Re: PySerial could not open port COM4: [Error 5] Access is denied - please help Paul <nospam@needed.com> - 2012-06-27 12:04 -0400
            Re: PySerial could not open port COM4: [Error 5] Access is denied - please help "Adam" <adam@no_thanks.com> - 2012-06-27 10:41 -0700
              Re: PySerial could not open port COM4: [Error 5] Access is denied - please help Paul <nospam@needed.com> - 2012-06-27 14:04 -0400
                Re: PySerial could not open port COM4: [Error 5] Access is denied - please help "Adam" <adam@no_thanks.com> - 2012-06-27 13:40 -0700
                Re: PySerial could not open port COM4: [Error 5] Access is denied - please help Grant Edwards <invalid@invalid.invalid> - 2012-06-27 21:18 +0000
                Re: PySerial could not open port COM4: [Error 5] Access is denied - please help "Adam" <adam@no_thanks.com> - 2012-06-27 14:48 -0700
                Re: PySerial could not open port COM4: [Error 5] Access is denied - please help Grant Edwards <invalid@invalid.invalid> - 2012-06-27 22:06 +0000
                Re: PySerial could not open port COM4: [Error 5] Access is denied - please help Grant Edwards <invalid@invalid.invalid> - 2012-06-27 22:18 +0000
                Re: PySerial could not open port COM4: [Error 5] Access is denied - please help Temia Eszteri <lamialily@cleverpun.com> - 2012-06-27 15:31 -0700
                Re: PySerial could not open port COM4: [Error 5] Access is denied - please help "Adam" <adam@no_thanks.com> - 2012-06-27 15:51 -0700
                Re: PySerial could not open port COM4: [Error 5] Access is denied - please help Grant Edwards <invalid@invalid.invalid> - 2012-06-27 23:24 +0000
                Re: PySerial could not open port COM4: [Error 5] Access is denied - please help "Adam" <adam@no_thanks.com> - 2012-06-27 17:14 -0700
                Re: PySerial could not open port COM4: [Error 5] Access is denied - please help Grant Edwards <invalid@invalid.invalid> - 2012-06-28 14:15 +0000
                Re: PySerial could not open port COM4: [Error 5] Access is denied - please help "Adam" <adam@no_thanks.com> - 2012-06-28 13:31 -0700
                Re: PySerial could not open port COM4: [Error 5] Access is denied - please help Roel Schroeven <roel@roelschroeven.net> - 2012-06-28 21:08 +0200
                Re: PySerial could not open port COM4: [Error 5] Access is denied- please help "Adam" <adam@no_thanks.com> - 2012-06-28 14:48 -0700
      Re: PySerial could not open port COM4: [Error 5] Access is denied - please help "David H. Lipman" <DLipman~nospam~@Verizon.Net> - 2012-06-27 08:28 -0400
        Re: PySerial could not open port COM4: [Error 5] Access is denied - please help Grant Edwards <invalid@invalid.invalid> - 2012-06-27 14:53 +0000

csiph-web