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: 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 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: 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: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 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