you can remove the error after hitting cancel on the cmds.fileDialog2(), if you just setup a if Statemeant to make sure the output of it, is not None type. it returns None if the user cancels, or a list of file paths if save is hit. a other option is to just let it error and use exception handling, to pass the TypeError.