How do I distinguish a string from a sequence?

Paul Moore gustav at morpheus.demon.co.uk
Sat Sep 29 17:02:05 EDT 2001


On Fri, 28 Sep 2001 15:02:17 -0500, Skip Montanaro <skip at pobox.com> wrote:

>
>    Paul> "Ability to be passed to popen2()" is what I'm after (at least in
>    Paul> the initial version, later I might use fork/exec or low-level
>    Paul> Win32 calls) and that isn't testable for...
>
>Why not simply call popen2() with your argument and if it squawks, do
>something about it?

Good point. I was worried about just catching all errors, and I wasn't sure what
specific exception I could catch. But a bit of checking shows that I get a
TypeError, which makes perfect sense. So trying the call and catching TypeError
is right.

Thanks,
Paul.



More information about the Python-list mailing list