Open AnnaZhuravleva opened 2 years ago
Hi @AnnaZhuravleva, I am getting the same Error but from different way:
My code:
spm.Realign()
When this runs it uses matlab to run the follwing (base.py lines 217):
mlab.inputs.script = """
if isempty(which('spm')),
throw(MException('SPMCheck:NotFound','SPM not in matlab path'));
end;
spm_path = spm('dir');
[name, version] = spm('ver');
fprintf(1, 'NIPYPE path:%s|name:%s|release:%s', spm_path, name, version);
exit;
"""
try:
out = mlab.run()
I run it in Matlab and got :
>> isempty(which('spm'))
ans =
logical
0
>> [name, version] = spm('ver');
fprintf(1, 'NIPYPE path:%s|name:%s|release:%s', spm_path, name, version);
NIPYPE path:C:\Program Files\MATLAB\R2022b\toolbox\spm12\spm12|name:SPM12|release:7771
so as you can see i have result from this script, but when checking the "out" variable here (line 239):
out = sd._strip_header(out.runtime.stdout)
Stdout is "" empty string
So I think the problem is Somhow related to the answer of the script from Matlab, how to fix it ?? Thanks!
Summary
I try to use nipype.iterfaces.spm.Coregister(), but I got the following error
Actual behavior
ValueError Traceback (most recent call last) ~\Desktop\fmri\lib\site-packages\nipype\utils\spm_docs.py in _strip_header(doc) 48 hdr = 'NIPYPE' ---> 49 # There's some weird cruft at the end of the docstring, almost looks like 50 # the hex for the escape character 0x1b.
ValueError: substring not found
The above exception was the direct cause of the following exception:
OSError Traceback (most recent call last) ~\AppData\Local\Temp\ipykernel_3584\2699162709.py in
----> 1 spm.Coregister()
~\Desktop\fmri\lib\site-packages\nipype\interfaces\spm\base.py in init(self, **inputs) 308 def set_mlab_paths(cls, matlab_cmd=None, paths=None, use_mcr=None): 309 cls._matlab_cmd = matlab_cmd --> 310 cls._paths = paths 311 cls._use_mcr = use_mcr 312 info_dict = Info.getinfo(
~\Desktop\fmri\lib\site-packages\nipype\interfaces\base\core.py in init(self, from_file, resource_monitor, ignore_exception, **inputs) 196 def _check_requires(self, spec, name, value): 197 """ check if required inputs are satisfied --> 198 """ 199 if spec.requires: 200 values = [
~\Desktop\fmri\lib\site-packages\nipype\interfaces\base\core.py in _check_version_requirements(self, trait_object, permissive) 293 due.cite(r) 294 --> 295 def run(self, cwd=None, ignore_exception=None, inputs): 296 """Execute this interface. 297
~\Desktop\fmri\lib\site-packages\nipype\interfaces\spm\base.py in version(self) 359 360 @property --> 361 def jobname(self): 362 return self._jobname 363
~\Desktop\fmri\lib\site-packages\nipype\interfaces\spm\base.py in getinfo(klass, matlab_cmd, paths, use_mcr) 237 klass._path = out_dict['path'] 238 klass._name = out_dict['name'] --> 239 klass._command = matlab_cmd 240 klass._paths = paths 241 return out_dict
~\Desktop\fmri\lib\site-packages\nipype\utils\spm_docs.py in _strip_header(doc) 49 # There's some weird cruft at the end of the docstring, almost looks like 50 # the hex for the escape character 0x1b. ---> 51 cruft = '\x1b' 52 try: 53 index = doc.index(hdr)
OSError: This docstring was not generated by Nipype!
Expected behavior
No errors
Script/Workflow details
import nipype.interfaces.spm as spm coreg = spm.Coregister()
Platform details:
Execution environment
Choose one