ValueError vs IndexError, unpacking arguments with string.split

Morten W. Petersen morphex at
Fri Nov 30 08:35:50 EST 2018

Hi there.

I was adding a port specification feature to my surveil project as shown

A bit later I was surprised when the script raised an exception, and that I
had to catch a ValueError instead of an IndexError:

I've been reading up on a bit of C++, Assembler etc. lately, so maybe my
mind expected an IndexError because of that, but isn't it logical that the
string is parsed and split, and then later the unpacking operation fails
with an IndexError?



Videos at
Twittering at
Blogging at
Playing music at
Also playing music and podcasting here:
On Google+ here
On Instagram at

More information about the Python-list mailing list