[Tutor] Equivalent of && in Python?
wormwood_3
wormwood_3 at yahoo.com
Mon Aug 27 16:54:19 CEST 2007
I have a script that reads some local system information, performs some calculations, and then launches some terminal windows:
# Spawn the 4 terminals, with needed positions and sizes, then exit
commands.getoutput("%s --geometry=%dx%d+%d+%d --working-directory=%s" % \
(terminal, t1width, t1height, t1posx, t1posy, workingdir))
commands.getoutput("%s --geometry=%dx%d+%d+%d --working-directory=%s" % \
(terminal, t2width, t2height, t2posx, t2posy, workingdir))
commands.getoutput("%s --geometry=%dx%d+%d+%d --working-directory=%s" % \
(terminal, t3width, t3height, t3posx, t3posy, workingdir))
commands.getoutput("%s --geometry=%dx%d+%d+%d --working-directory=%s" % \
(terminal, t4width, t4height, t4posx, t4posy, workingdir))
The oddity: When I call this script, sometimes all four terminals launch, one right after another, which is the desired behaviour. At other times, one will launch, and ONLY after I close it will the second launch, and so on until the fourth. I do not understand how this is happening. I thought each line in a script which does anything has to be done before the next one is executed, but I may be way off on this.
If this were in a bash script, I could add " &&" after each line, but what to do in a Python script?
-Sam
More information about the Tutor
mailing list