Jachym Cepicky jachym.cepicky at centrum.cz
Sat Nov 25 14:42:15 EST 2006

On Sat, Nov 25, 2006 at 06:56:14PM +0000, Glynn Clements wrote:
> The documentation for the readlines() method says:
> readlines([sizehint])
>     Read until EOF using readline() and return a list containing the
>     lines thus read. If the optional sizehint argument is present,
>     instead of reading up to EOF, whole lines totalling approximately
>     sizehint bytes (possibly after rounding up to an internal buffer
>     size) are read. Objects implementing a file-like interface may
>     choose to ignore sizehint if it cannot be implemented, or cannot
>     be implemented efficiently.
> The "until EOF" means that it isn't going to return until the command
> has completed.
> > Could somebody help me, how to do it? Could you point me to tcl code,
> > which must solve this problem too?
> Looking at the Python docs, you probably want something like:
> 	f = os.popen("r.los in=elevation.dem out=tmp 2>&1")
> 	try:
> 	    for line in f:
> 	        print line
> 	finally:
> 	    f.close()

thanks, Glynn,  but it does not seem to work - or it works the same way,
like readlines() does.

I have in the script:

import os

f = os.popen("r.los --o in=elevation.dem out=tmp \
        coordinate=603067.6875,4925297.0625 max_dist=10000 2>&1")
    for line in f:
        print line

result is, lines are printed. but _after_ r.los finished it's

do I understand something wrong?



Jachym Cepicky
e-mail: jachym.cepicky at centrum.cz
URL: http://les-ejk.cz
GPG: http://www.les-ejk.cz/pgp/jachym_cepicky-gpg.pub
Department of Geoinformation Technologies 
Zemedelska 3
613 00, Brno
Czech Republick
e-mail: xcepicky at node.mendelu.cz
URL:    http://mapserver.mendelu.cz
Tel.:   +420 545 134 514
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20061125/32f24f41/attachment.bin

More information about the grass-dev mailing list