~madteam/mg5amcnlo/series2.0

« back to all changes in this revision

Viewing changes to madgraph/various/shower_card.py

  • Committer: olivier-mattelaer
  • Date: 2020-08-21 09:16:56 UTC
  • mfrom: (284.2.24 python3)
  • Revision ID: olivier-mattelaer-20200821091656-iizux2mj94tkssuo
pass to 2.8.0 (and move to python3 branch)

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
################################################################################
15
15
"""A File for splitting"""
16
16
 
 
17
from __future__ import absolute_import
17
18
import sys
18
19
import re
19
20
import os
20
21
import logging
 
22
from six.moves import range
 
23
 
21
24
try:
22
25
    import madgraph
23
26
except ImportError:
87
90
        """ if testing, card is the content"""
88
91
        self.testing = testing
89
92
        dict.__init__(self)
90
 
        self.keylist = self.keys()
 
93
        self.keylist = list(self.keys())
91
94
 
92
95
        if card:
93
96
            self.read_card(card)
130
133
        if key in self.logical_vars:
131
134
            try:
132
135
                self[key] = banner.ConfigFile.format_variable(value, bool, key)
133
 
            except InvalidCmd, error:
 
136
            except InvalidCmd as error:
134
137
                raise ShowerCardError(str(error))
135
138
        elif key in self.string_vars:
136
139
            if value.lower() == 'none':
140
143
        elif key in self.int_vars:
141
144
            try:
142
145
                self[key] = banner.ConfigFile.format_variable(value, int, key)
143
 
            except InvalidCmd, error:
 
146
            except InvalidCmd as  error:
144
147
                raise ShowerCardError(str(error))
145
148
        elif key in self.float_vars:
146
149
            try:
147
150
                self[key] =  banner.ConfigFile.format_variable(value, float, key)
148
 
            except InvalidCmd, error:
 
151
            except InvalidCmd as error:
149
152
                raise ShowerCardError(str(error))
150
153
        else:
151
154
            raise ShowerCardError('Unknown entry: %s = %s' % (key, value))