Re: with open('com1', 'r') as f:

2009-04-07 Thread Terry Reedy
Lawrence D'Oliveiro wrote: In message , Delaney, Timothy (Tim) wrote: Lawrence D'Oliveiro wrote: In message , Terry Reedy wrote: Lawrence D'Oliveiro wrote: All Python objects are reference-counted. Nope. Only in CPython, and even that could change. Why should it? Because Guido has sa

RE: with open('com1', 'r') as f:

2009-04-06 Thread Lawrence D'Oliveiro
In message , Delaney, Timothy (Tim) wrote: > Lawrence D'Oliveiro wrote: > >> In message , >> Terry Reedy wrote: >> >>> Lawrence D'Oliveiro wrote: >>> All Python objects are reference-counted. >>> >>> Nope. Only in CPython, and even that could change. >> >> Why should it? > > Because G

RE: with open('com1', 'r') as f:

2009-04-06 Thread Delaney, Timothy (Tim)
Lawrence D'Oliveiro wrote: > In message , > Terry Reedy wrote: > >> Lawrence D'Oliveiro wrote: >> >>> All Python objects are reference-counted. >> >> Nope. Only in CPython, and even that could change. > > Why should it? Because Guido has said it might some time in the future. >>> Once the f

Re: with open('com1', 'r') as f:

2009-04-05 Thread Lawrence D'Oliveiro
In message , Terry Reedy wrote: > Lawrence D'Oliveiro wrote: > >> All Python objects are reference-counted. > > Nope. Only in CPython, and even that could change. Why should it? >> Once the file object becomes >> inaccessible, it is automatically closed. Simple. > > Even in CPython, that wou

Re: with open('com1', 'r') as f:

2009-04-05 Thread gert
On Apr 5, 12:24 am, "Gabriel Genellina" wrote: > En Sat, 04 Apr 2009 14:11:12 -0300, gert escribió: > > > On Apr 4, 5:20 pm, Kushal Kumaran wrote: > >> On Fri, 03 Apr 2009 22:10:36 +0200 > >> Christian Heimes wrote: > >> > gert wrote: > >> > > I do understand, and I went looking into pySerial,

Re: with open('com1', 'r') as f:

2009-04-05 Thread Steven D'Aprano
On Sun, 05 Apr 2009 18:52:58 +1200, Lawrence D'Oliveiro wrote: > In message <01e842d6$0$20654$c3e8...@news.astraweb.com>, Steven D'Aprano > wrote: > >> Firstly, what you describe is an implementation detail of CPython, not >> Python the language. Jython does not close files as soon as they become

Re: with open('com1', 'r') as f:

2009-04-04 Thread Lawrence D'Oliveiro
In message <01e842d6$0$20654$c3e8...@news.astraweb.com>, Steven D'Aprano wrote: > Firstly, what you describe is an implementation detail of CPython, not > Python the language. Jython does not close files as soon as they become > inaccessible, and IronPython and CLPython may not. That's a limitat

Re: with open('com1', 'r') as f:

2009-04-04 Thread Terry Reedy
Lawrence D'Oliveiro wrote: In message <91e09eaf-5a25-4a6b-b131- a5245970b...@f19g2000yqh.googlegroups.com>, gert wrote: On Apr 4, 12:58 am, Lawrence D'Oliveiro wrote: In message <8bc55c05-19da-41c4- b916-48e0a4be4...@p11g2000yqe.googlegroups.com>, gert wrote: with open('com1', 'r') as f: f

Re: with open('com1', 'r') as f:

2009-04-04 Thread Steven D'Aprano
On Sun, 05 Apr 2009 15:51:31 +1200, Lawrence D'Oliveiro wrote: > All Python objects are reference-counted. Once the file object becomes > inaccessible, it is automatically closed. Simple. If only it were so simple. Firstly, what you describe is an implementation detail of CPython, not Python th

Re: with open('com1', 'r') as f:

2009-04-04 Thread Lawrence D'Oliveiro
In message <91e09eaf-5a25-4a6b-b131- a5245970b...@f19g2000yqh.googlegroups.com>, gert wrote: > On Apr 4, 12:58 am, Lawrence D'Oliveiro central.gen.new_zealand> wrote: > >> In message <8bc55c05-19da-41c4- >> b916-48e0a4be4...@p11g2000yqe.googlegroups.com>, gert wrote: >> >>> with open('com1', 'r')

Re: with open('com1', 'r') as f:

2009-04-04 Thread Gabriel Genellina
En Sat, 04 Apr 2009 14:11:12 -0300, gert escribió: On Apr 4, 5:20 pm, Kushal Kumaran wrote: On Fri, 03 Apr 2009 22:10:36 +0200 Christian Heimes wrote: > gert wrote: > > I do understand, and I went looking into pySerial, but it is a long > > way from getting compatible with python3.x and i

Re: with open('com1', 'r') as f:

2009-04-04 Thread Christian Heimes
gert wrote: > On Apr 3, 10:10 pm, Christian Heimes wrote: >> gert wrote: >>> I do understand, and I went looking into pySerial, but it is a long >>> way from getting compatible with python3.x and involves other libs >>> that are big and non pyhton3.x compatible. >> So don't use Python 3.0. Most pe

Re: with open('com1', 'r') as f:

2009-04-04 Thread Diez B. Roggisch
gert schrieb: On Apr 3, 10:10 pm, Christian Heimes wrote: gert wrote: I do understand, and I went looking into pySerial, but it is a long way from getting compatible with python3.x and involves other libs that are big and non pyhton3.x compatible. So don't use Python 3.0. Most people are stil

Re: with open('com1', 'r') as f:

2009-04-04 Thread Gabriel Genellina
En Sat, 04 Apr 2009 11:29:22 -0300, gert escribió: On Apr 4, 12:58 am, Lawrence D'Oliveiro wrote: In message <8bc55c05-19da-41c4- b916-48e0a4be4...@p11g2000yqe.googlegroups.com>, gert wrote: >     with open('com1', 'r') as f: >         for line in f: >              print('line') Why bother,

Re: with open('com1', 'r') as f:

2009-04-04 Thread gert
On Apr 4, 5:20 pm, Kushal Kumaran wrote: > On Fri, 03 Apr 2009 22:10:36 +0200 > > Christian Heimes wrote: > > gert wrote: > > > I do understand, and I went looking into pySerial, but it is a long > > > way from getting compatible with python3.x and involves other libs > > > that are big and non p

Re: with open('com1', 'r') as f:

2009-04-04 Thread Kushal Kumaran
On Fri, 03 Apr 2009 22:10:36 +0200 Christian Heimes wrote: > gert wrote: > > I do understand, and I went looking into pySerial, but it is a long > > way from getting compatible with python3.x and involves other libs > > that are big and non pyhton3.x compatible. > > So don't use Python 3.0. Most

Re: with open('com1', 'r') as f:

2009-04-04 Thread gert
On Apr 3, 10:10 pm, Christian Heimes wrote: > gert wrote: > > I do understand, and I went looking into pySerial, but it is a long > > way from getting compatible with python3.x and involves other libs > > that are big and non pyhton3.x compatible. > > So don't use Python 3.0. Most people are still

Re: with open('com1', 'r') as f:

2009-04-04 Thread gert
On Apr 4, 12:58 am, Lawrence D'Oliveiro wrote: > In message <8bc55c05-19da-41c4- > > b916-48e0a4be4...@p11g2000yqe.googlegroups.com>, gert wrote: > >     with open('com1', 'r') as f: > >         for line in f: > >              print('line') > > Why bother, why not just > >     for line in open('co

Re: with open('com1', 'r') as f:

2009-04-03 Thread Lawrence D'Oliveiro
In message <8bc55c05-19da-41c4- b916-48e0a4be4...@p11g2000yqe.googlegroups.com>, gert wrote: > with open('com1', 'r') as f: > for line in f: > print('line') Why bother, why not just for line in open('com1', 'r') : print line -- http://mail.python.org/mailma

Re: with open('com1', 'r') as f:

2009-04-03 Thread Christian Heimes
gert wrote: > I do understand, and I went looking into pySerial, but it is a long > way from getting compatible with python3.x and involves other libs > that are big and non pyhton3.x compatible. So don't use Python 3.0. Most people are still using Python 2.5 or 2.6. Christian -- http://mail.pyt

Re: with open('com1', 'r') as f:

2009-04-03 Thread gert
On Apr 3, 3:44 pm, "Gabriel Genellina" wrote: > En Thu, 02 Apr 2009 20:04:14 -0300, gert escribió: > > > On Apr 2, 8:53 pm, Kushal Kumaran wrote: > >> On Thu, 2 Apr 2009 10:01:02 -0700 (PDT) > >> gert wrote: > >> > from subprocess import * > >> > check_call(['mode', 'COM1:9600,N,8,1,P'],shell=T

Re: with open('com1', 'r') as f:

2009-04-03 Thread Gabriel Genellina
En Thu, 02 Apr 2009 20:04:14 -0300, gert escribió: On Apr 2, 8:53 pm, Kushal Kumaran wrote: On Thu, 2 Apr 2009 10:01:02 -0700 (PDT) gert wrote: > from subprocess import * > check_call(['mode', 'COM1:9600,N,8,1,P'],shell=True) > while True: >     with open('com1', 'r') as f: >         for l

Re: with open('com1', 'r') as f:

2009-04-02 Thread gert
On Apr 2, 8:53 pm, Kushal Kumaran wrote: > On Thu, 2 Apr 2009 10:01:02 -0700 (PDT) > > > > gert wrote: > > from subprocess import * > > > check_call(['mode', 'COM1:9600,N,8,1,P'],shell=True) > > while True: > >     with open('com1', 'r') as f: > >         for line in f: > >              print('li

Re: with open('com1', 'r') as f:

2009-04-02 Thread Kushal Kumaran
On Thu, 2 Apr 2009 10:01:02 -0700 (PDT) gert wrote: > from subprocess import * > > check_call(['mode', 'COM1:9600,N,8,1,P'],shell=True) > while True: > with open('com1', 'r') as f: > for line in f: > print('line') > > This works very well except for one thing. After a r