Comment 1 for bug 1698157

Revision history for this message
Olivier Mattelaer (olivier-mattelaer) wrote :

Hi,

Thanks for the information, actually both using "newmodel" and "./newmodel" can lead to problem.
So I'm going to change the code for
1) do not allow at all, the "newmodel" option
2) have a full support for "./newmodel"

You can find below the patch that I'm going to apply:

=== modified file 'madgraph/interface/madgraph_interface.py'
--- madgraph/interface/madgraph_interface.py 2017-04-06 21:08:27 +0000
+++ madgraph/interface/madgraph_interface.py 2017-06-15 15:18:31 +0000
@@ -5057,6 +5057,8 @@
                 try:
                     self._curr_model = import_ufo.import_model(args[1], prefix=prefix,
                         complex_mass_scheme=self.options['complex_mass_scheme'])
+ if os.path.sep in args[1] and "import" in self.history[-1]:
+ self.history[-1] = 'import model %s' % self._curr_model.get('modelpath+restriction')
                 except import_ufo.UFOImportError, error:
                     if 'not a valid UFO model' in str(error):
                         logger_stderr.warning('WARNING: %s' % error)

=== modified file 'models/import_ufo.py'
--- models/import_ufo.py 2017-02-16 15:16:38 +0000
+++ models/import_ufo.py 2017-06-15 15:23:58 +0000
@@ -78,10 +78,9 @@
                     last_model_path = os.path.join(MG5DIR, p, model_name)
                 return os.path.join(MG5DIR, p, model_name)
     if os.path.isdir(model_name):
- if last_model_path != os.path.join(MG5DIR, model_name):
- logger.info("model loaded from: %s", os.path.join(os.getcwd(), model_name))
- last_model_path = os.path.join(MG5DIR, model_name)
- return model_name
+ logger.warning('No model %s found in default path. Did you meant \'import model ./%s\'',
+ model_name, model_name)
+ raise UFOImportError("Path %s is not a valid pathname" % model_name)
     else:
         raise UFOImportError("Path %s is not a valid pathname" % model_name)