[Rivet] rivet-cmphistos: '=' in the PLOT parameter

David Grellscheid david.grellscheid at durham.ac.uk
Wed Sep 28 17:35:19 BST 2016


Hi Dmitry,

thanks for spotting this. The fix is simpler:

 > key, val = [s.strip() for s in key_val.split("=",1)]

will be sufficient, as it forces just one single split. Can you please 
try it and let me know if it works for you, then I'll put it into the 
next version.

Thanks,

   David



On 28/09/2016 07:32, Dmitry Kalinkin wrote:
> Hi all,
>
> There is a bug that prevents user from using ‘=‘ symbol in PLOT:Title=foo=bar:… It fails with:
> ValueError: too many values to unpack
> It would be nice to fix that (possibly using fix below).
>
> Thanks,
>
> Dmitry
>
> diff a/bin/rivet-cmphistos b/bin/rivet-cmphistos
> --- a/bin/rivet-cmphistos
> +++ b/bin/rivet-cmphistos
> @@ -371,7 +371,9 @@ if __name__ == '__main__':
>          #     plot[key] = val
>          if plotoptions.has_key("PLOT"):
>              for key_val in plotoptions["PLOT"]:
> -                key, val = [s.strip() for s in key_val.split("=")]
> +                pos = key_val.index("=")
> +                key = key_val[:pos].strip()
> +                val = key_val[pos+1:].strip()
>                  plot[key] = val
>          if opts.LINEAR:
>              plot['LogY'] = '0'
> _______________________________________________
> Rivet mailing list
> Rivet at projects.hepforge.org
> https://www.hepforge.org/lists/listinfo/rivet
>


More information about the Rivet mailing list