At present if there is a problem when importing python script the exception is raised that is not very informative and looks like this:
Traceback (most recent call last):
File "main.py", line 209, in <module>
launcher_arguments=currDiag.get_launcher_arguments())
File "./interface_scripts/projects.py", line 3021, in run_executable
exit_on_warning)
File "./interface_scripts/launchers.py", line 289, in execute
self._execute_script(python_executable, project_info, verbosity, exit_on_warning)
File "./interface_scripts/launchers.py", line 314, in _execute_script
raise ValueError('The script %s can not be imported!' % python_executable)
ValueError: The script ./diag_scripts/sst_ESACCI.py can not be imported!
So there is no particular reason on why the script can't be imported and hence it's quite hard to debug. In my case, for example, the python module were missing, but from the error message there were no way to understand that. I suggest changing this part of launchers.py
ether by adding at least
print("Error while importing python script:", sys.exc_info())
that in my case would lead to:
('Error while importing python script:', (<type 'exceptions.ImportError'>, ImportError('No module named geoval.core.data',), <traceback object at 0x7f42ea5e29e0>))
or if you don't mind additional import use traceback
module:
import traceback
...
try:
exec cmd
except:
print(cmd)
print(traceback.format_exc())
raise ValueError('The script %s can not be imported!' % python_executable)
that lead to:
import sst_ESACCI.py
Traceback (most recent call last):
File "test.py", line 19, in <module>
exec cmd
File "<string>", line 1, in <module>
File "./diag_scripts/sst_ESACCI.py", line 42, in <module>
from sst_diagnostic import SeaSurfaceTemperatureDiagnostic
File "./diag_scripts/aux/LMU_ESACCI-diagnostics/sst_diagnostic.py", line 1, in <module>
from diagnostic import *
File "./diag_scripts/aux/LMU_ESACCI-diagnostics/diagnostic.py", line 17, in <module>
from geoval.core.data import GeoData
ImportError: No module named geoval.core.data
Traceback (most recent call last):
File "test.py", line 23, in <module>
raise ValueError('The script %s can not be imported!' % python_executable)
ValueError: The script sst_ESACCI.py can not be imported!
that is way easier to debug. I can do PR with this fix.