[chirp_devel] [PATCH 5/6] Improve CLI download/upload (#2343)

Dan Smith
Thu Mar 5 15:22:39 PST 2015


> @@ -293,17 +297,33 @@ if __name__ == "__main__":
>          print mem
>  
>      if options.download_mmap:
> -        # isinstance(radio, chirp_common.IcomMmapRadio) or fail_unsupported()
> -        radio.sync_in()
> -        radio.save_mmap(options.mmap)
> +        if not issubclass(rclass, chirp_common.CloneModeRadio):
> +            LOG.error("%s is not a clone mode radio" % options.radio)
> +            sys.exit(1)
> +        if not options.mmap:
> +            LOG.error("You must specify the destnation file name with --mmap")

Typo in 'destination'.

> +            sys.exit(1)
> +        try:
> +            radio.sync_in()
> +            radio.save_mmap(options.mmap)
> +        except Exception, e:
> +            LOG.error(e)

This is going to make it really hard to debug what's going on if/when
someone reports it. LOG.exception() will dump the exception, but at
ERROR level, which is probably not what you want here. Maybe check your
global --debug flag and only do it in that case?

> +        sys.exit(1)
>  
>      if options.upload_mmap:
> -        # isinstance(radio, chirp_common.IcomMmapRadio) or fail_unsupported()
> -        radio.load_mmap(options.mmap)
> -        if radio.sync_out():
> -            print "Clone successful"
> -        else:
> -            LOG.error("Clone failed")
> +        if not issubclass(rclass, chirp_common.CloneModeRadio):
> +            LOG.error("%s is not a clone mode radio" % options.radio)
> +            sys.exit(1)
> +        if not options.mmap:
> +            LOG.error("You must specify the destnation file name with --mmap")

Same typo here.

--Dan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
Url : http://intrepid.danplanet.com/pipermail/chirp_devel/attachments/20150305/35b7dd43/attachment-0001.bin 


More information about the chirp_devel mailing list