Repository navigation
Description
Describe the bug
Elliot Gilbert from the ACNS reported that an error occurred when trying to run a composite model created by adding a power law plus two Gaussians following the help documentation. @butlerpd reproduced the error. The error occurs when choosing that model from the dropdown. In other words creating the model saves correctly, SasView then recognizes it as a valid plugin to the extent that it shows up in the plugin category dropdown, but as soon as that model is chosen the following error is thrown and no model is actually loaded.
10:45:20 - INFO: --- SasView session started, version 6.1.2, 2025 ---
10:45:20 - INFO: Python: 3.11.9 (tags/v3.11.9:de54cf5, Apr 2 2024, 10:12:12) [MSC v.1938 64 bit (AMD64)]
10:47:41 - ERROR: Traceback (most recent call last): File "sas\qtgui\Perspectives\Fitting\FittingWidget.py", line 1418, in onSelectModel File "sas\qtgui\Perspectives\Fitting\FittingWidget.py", line 1589, in respondToModelStructure File "sas\qtgui\Perspectives\Fitting\FittingWidget.py", line 2364, in SASModelToQModel File "sas\qtgui\Perspectives\Fitting\FittingWidget.py", line 2412, in fromModelToQModel File "", line 244, in basename File "", line 213, in split TypeError: expected str, bytes or os.PathLike object, not NoneTypeThe plugin model file @butlerpd used was:
from sasmodels.core import load_model_info
from sasmodels.sasview_model import make_model_from_info
model_info = load_model_info('power_law+gaussian_peak+gaussian_peak')
model_info.name = 'PowerPlusTwoGaussian'
model_info.description = 'power_law + gaussian_peak + gaussian_peak'
Model = make_model_from_info(model_info)To Reproduce
Steps to reproduce the behavior:
- create the above plugin. I used the Add/multiply feature to first create a power law plus Gaussian. I then opened that model in the model editor and added the second Gaussian as described in the help and shown above. Then saved
- Now, from within the SasView GUI, use the
Plugin ModelsCategory and then choose the model just created - Result, no model is loaded and the error is thrown
Expected behavior
The model should load correctly as any other model
SasView version (please complete the following information):
- Version: Still present in 6.2.0 but initially detected in 6.1.2
Operating system (please complete the following information):
- OS: Windows 11 for sure
Installation method (please complete the following information):
- Installed: from installer on release page
Activity
krzywon commentedon Aug 3, 2026
I was able to reproduce this, but then changed the
model_info.nameparameter to the file name, and was able to load the plugin model. I think #848 is back.butlerpd commentedon Aug 3, 2026
actually, it seems that the name is set to
Nonewhich is the problem. I suspect that a different name might work but that aNonewas not envisaged as a possibility when fixing #848? Apparently all mixture models generate amodelinfo.name=Nonewhich may be the problem?butlerpd commentedon Aug 3, 2026
and yes @krzywon if I change the name in the file for modelinfo.name= to be the same as the filename it works. I think plugins start by assuming the names are the same and then fallback to a different method only when they are not? In this case the fall back finds a name=None instead of a string?
rozyczko commentedon Aug 6, 2026
This could also use a fix in sasmodels
if not hasattr(model, 'filename')to also handle None insasview_model.load_custom_model(line 146).Theproposed fix for SasView should be sufficient on its own, but fixing that in sasmodels would fix it for scripting users too.
rozyczko commentedon Aug 6, 2026
Fixed in 4074-composite-model-failure
butlerpd commentedon Aug 6, 2026
great point @rozyczko! Actually, I'm now wondering if the fix should not in fact be in sasmodels to start with? of course if a NONE gets generated somewhere else, the sasview fix will still catch it.... which leads to the much larger and difficult discussion about how to avoid traceback errors from ever occurring and silently degrading the reliability of the GUI app...
rozyczko commentedon Aug 7, 2026
Thanks, @butlerpd
Indeed it should ALSO be in sasmodels.
SasView/sasmodels#749