Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #24635
| Path | csiph.com!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | "Adam" <adam@no_thanks.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: PySerial could not open port COM4: [Error 5] Access is denied - please help |
| Date | Thu, 28 Jun 2012 13:31:48 -0700 |
| Organization | A noiseless patient Spider |
| Lines | 85 |
| Message-ID | <jsievj$k72$1@dont-email.me> (permalink) |
| 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> <jsg2pt$87s$1@dont-email.me> <jsg4o8$o4p$1@reader1.panix.com> <jsg7m0$6mn$1@dont-email.me> <jshotj$s55$1@reader1.panix.com> |
| Injection-Date | Thu, 28 Jun 2012 20:31:47 +0000 (UTC) |
| Injection-Info | mx04.eternal-september.org; posting-host="Bh0M18YIbCo+pO+cFqDnkw"; logging-data="20706"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/UxUQEva+0iYK05fq1wXM+" |
| 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:cfALFpUk0TYmJG3nJfOSJH6YwTU= |
| X-Priority | 3 |
| X-MSMail-Priority | Normal |
| Xref | csiph.com comp.lang.python:24635 |
Show key headers only | View raw
"Grant Edwards" <invalid@invalid.invalid> wrote in message news:jshotj$s55$1@reader1.panix.com... > On 2012-06-28, Adam <adam@no_thanks.com> wrote: > >> Obviously pySerial considers the serial port open > > Because it's already been opened by the Python program. > >> and will not open an already open serial port. > > Pyserial will happily try if you call the open() of a port that's > already open, but Windows will return an error. > >> However, why is it that TeraTerm can open the serial port? > > Because TeraTerm only opens it once. > >> Here's the link where I read about calling ser.close() before >> ser.open() ... >> >> Trying to open a serial port with pyserial on WinXP -> "Access denied" >> >> http://stackoverflow.com/questions/2063257/trying-to-open-a-serial-port-with-pyserial-on-winxp-access-denied > > That code is broken. > > The port is opened by this line: > > self.ser=serial.Serial(port='\\.\COM1', baudrate=9600, > bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE, > stopbits=serial.STOPBITS_ONE, timeout=1) > > And then the author tries to _open_it_a_second_time_ here: > > self.ser.open() > >> Here's the Python scripts ... >> https://github.com/adafruit/Tweet-a-Watt/downloads >> Click on the "Download as ..." button for the Python scripts > > Like I kept telling you, those programs are trying to re-open a port > that they've already open. Here's the erroneous code: > > wattcher.py: > > 53 > 54 # open up the FTDI serial port to get data transmitted to xbee > 55 ser = serial.Serial(SERIALPORT, BAUDRATE) > 56 ser.open() > 57 > > Line 55 opens the serial port. > > Line 56 tries to _open_it_again_. _The_port_is_already_open_. > Windows doesn't allow a serial port to be opened twice, therefore the > ser.open() call raises an exception. > > Just delete line 56. > > > The same thing happens here: > > gmeter-wattcher.py > > 83 > 84 # open up the FTDI serial port to get data transmitted to xbee > 85 ser = serial.Serial(SERIALPORT, BAUDRATE) > 86 ser.open() > 87 > > Just delete line 86. > > See how simple it was to get the problem solved once you posted the > actual code? > > -- > Grant Edwards grant.b.edwards Yow! HUMAN REPLICAS are > at inserted into VATS of > gmail.com NUTRITIONAL YEAST ... Thanks, Grant !
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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