[Fedora-livecd-list] kickstart.py: except IOError, (err, msg): ValueError: need more than 1 value to unpack

Bruno Wolff III bruno at wolff.to
Sat Jul 24 15:26:06 UTC 2010


On Fri, Jul 23, 2010 at 15:22:28 +0100,
  Marc Herbert <Marc.Herbert at gmail.com> wrote:
> Insert a typo in the name of a %include(d) file. Run "livecd-creator". You get the cryptic:
> 
> Traceback (most recent call last):
>   File "/usr/bin/livecd-creator", line 140, in <module>
>     sys.exit(main())
>   File "/usr/bin/livecd-creator", line 112, in main
>     ks = imgcreate.read_kickstart(options.kscfg)
>   File "/usr/lib/python2.6/site-packages/imgcreate/kickstart.py", line 56, in read_kickstart
>     except IOError, (err, msg):
> ValueError: need more than 1 value to unpack
> 
> 
> The following patch works around the problem. It is probably NOT a fix but a workaround!

Looking at some pythion documentation it looks like normally IOError has
two or three arguments that are errno, strerror and file. In this case you
normally just want to print the strerror. However IOError is getting raised
by urlgrabber and pykickstart sometimes with just one argument, so you
can't do it this way.
One option is to not use a tuple so that you get a variable  which is set up
so that you can print the returned tuple. This will look odd for normal IO
errors, but for ones raised in pykickstart and urlgrabber it should be
reasonable. Another option is to just print the last argument (file isn't
returned when a tuple isn't supplied to the except statement).
I am going to try turning the two argument cases where just the last
is used, to not use a tuple and refer to the args[-1] element. I need to
test this, but if it works I'll post a patch for review.


More information about the livecd mailing list