newbie question | shell scripting

Jelle Feringa // EZCT / Paris jelle.feringa at ezct.net
Mon Nov 8 18:20:04 EST 2004


Dear all,
 
I did it! Finally pieced my first half decent python script together!
After some extensive research into which language I should learn to program
and which would most likely meet my needs (being an architect not a
programmer) I'm finally experiencing some of the awesome power of python
first hand.
 
Having said that I'm still facing a few minor problems that I don't seem to
get over myself:
Basically my script is a conversion from a shell script that renders
Radiance images.
The problem that occurs is that the main loop of the script is executed
before the render is actually finished.
The result is that the script is executed until my machine's cpu is
saturated (2 proces pipes)
Too bad I'm not yet familiar enough with python to resolve this problem.
Basically the script works, it just bugs me that it isn't executed properly.
 
Another thing is that I want to build in 2 additions to this script
 
First of all being able to run the processes in the background
Secondly a way to cancel the process from Python.
 
Another thins is that this script relies on piping to get the job done. So
basically still very close to a bash shell script approach.
What would be a more pythonic way of doing this? I've considered tmp files,
but this seems to be a more clean solution.
 
Here's the main loop of the script:
 
i = 0
for x in hour:
    skyName = skiesok[i]
    print skyName
    number = str(skyName[3:-4])
    oconv, oo, oe = win32pipe.popen3('oconv -i no_sky.oct'\
    +' sky'+number+'.sky'+' > '+'tmpOct'+number+'.oct')
    psign, po, pe = win32pipe.popen3('psign -h 16 '\
    +str(day)+' /'+str(month)+' / '+number+':00'+' > label'+number+'.pic')
    rpict, ro, re = win32pipe.popen3('rpict -vf view.vf '+ambparr+'
'+'tmpOct'+number+'.oct'\
    +' | '+'pfilt -x /2 -y /2'\
    +' | '+'pcompos - 0 0 label'+number+'.pic 0 0'\
    +' > '+'tmp'+number+'.pic') 
    i = i +1
    
Thanks for your ideas in advance,
 
Cheers,
 
Jelle.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20041109/7a1e2da4/attachment.html>


More information about the Python-list mailing list