import nibabel
nibabel.processing.resample_to_output(input_img, voxel_size)
AttributeError: module 'nibabel' has no attribute 'processing'
import nibabel
import nibabel.processing
nibabel.processing.resample_to_output(input_img, voxel_size)
Why does the first code fail but the second code work?
asked Apr 8, 2020 at 2:26
Crispy13
3792 gold badges6 silver badges18 bronze badges
1 Answer 1
Expanding on @juanpa answer in the comments, you can simply consider these as two different modules.
For this
import nibabel
You get the error which suggests that this module does not have an attribute named processing
But for this
import nibabel.processing
It works fine since itself can be considered a module and thus means that processing is not an attribute of nibabel.
So it looks the code that you are trying to run only requires the 2nd import and not the first.
answered Apr 8, 2020 at 3:04
AzyCrw4282
7,9145 gold badges26 silver badges43 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
lang-py
nibabeldoesn't have a.processingattribute. The modulenibabel.processingexists, but that doesn't mean that it is an attribute onnibabel.