If the users executes the script there is a list of all directories created. If the user chooses a directory and before this very directory was delete the value of !dir%choice%! will be exactly the name of the value. This is why i catched this exception. Not a very common case but you could never know! 🙂This works up to 99 directories (no directories not tested) otherwise the menu choice would not look that fine.

So when you execute your add-apt-repositry command it implicity executes the above command. As you can see the gpg (i always mix this up with pgp) launches with a lot of parameters which you cannot remember if you are not that interessted.

And as you know problems always come in packs just look at the lines below

gpg: requesting key xxxxxxx from hkp server keyserver.ubuntu.com

gpg: keyserver timed out

gpg: keyserver receive failed: keyserver error

The thing is that GPG cannot go over https. More to read here. So we need to edit the preferences that GPG is forced to get the keys over http. Just edit ppa.py with following line

vim /usr/share/pyshared/softwareproperties/ppa.py

Search for

"keyserver.ubuntu.com"

and edit it to

"hkp://keyserver.ubuntu.com:80"

Edit this back when you are done installing your software from launchpad. Otherwise you are getting your software insecurely and aptitude is always nagging about it 😉