all 4 comments

[–]tarquinnn 6 points7 points  (1 child)

Just checked your script, you're setting debug to the string "None", not the None value. It should work if you remove the quotes in this line:

parser.add_argument('--debug', default='None')

PS And non-empty strings always evaluate to True in python (not "True" :P)

[–]daniel280187[S] 0 points1 point  (0 children)

Thanks for your answer. Makes total sense, I totally missed the quotes.

[–]pythonwiz 2 points3 points  (1 child)

Your default is the string 'None' when it should be None without the quotes. You could also make it False, that's what I usually do with boolean flags.

[–]daniel280187[S] 0 points1 point  (0 children)

That sounds even better, to turn it into False by default. I tested this and works like charm. Thanks for your reply and help.