Python - if/else statements

Bengt Richter bokr at
Sun Jul 13 01:11:20 CEST 2003

On Sat, 12 Jul 2003 14:27:33 +1200, dmbkiwi <dmbkiwi at> wrote:

>On Sat, 12 Jul 2003 01:58:13 +0000, Bengt Richter wrote:
>> If that is really happening, I wonder if you are somehow executing code from a different version
>> or have some kind of mixed-up installation. Or are using incompatible extension modules?
>> Do you have multiple versions installed? what are your versions, and what sym links are there?
>> And what are the #! lines of your script(s)?
>One point that I may not have made clear is that I'm not experiencing this
>behaviour personally with my set up.  It is other people using this script
Is it a single .py file?

>who are reporting this behaviour.  The difficulty I'm having is that it's
>very hard to debug a problem you're not having.  I've sent versions of the
>script to these people, with print statements at appropriate points to
>ensure that the script is doing what I think it's doing (in terms of going
>wrong for them), and from the output they send back, the interpreter is
>definitely ignoring the else statement and ploughing through them, even
>though, it's also executed the corresponding if statement.
I wonder if your script is executed directly by Python. Perhaps it is "sanitized"
for security reasons before being executed in some context, and it gets glitched,
in the sanitizing process. If so, could you ask them to put a debug print to
show what's actually being executed? And ask them how it's being executed
(ie, exec vs exec in somedir vs execfile vs import and invoke vs whatever they do).
>Suffering alone exists, none who suffer;
>The deed there is, but no doer thereof;
>Nirvana is, but no one is seeking it;
>The Path there is, but none who travel it.
>		-- "Buddhist Symbolism", Symbols and Values
Cool ;-)

Bengt Richter

More information about the Python-list mailing list