On Sat, 9 Jul 2022 at 10:57, MRAB <pyt...@mrabarnett.plus.com> wrote: > > On 08/07/2022 23:20, Avi Gross via Python-list wrote: > > Nati Stern has asked several questions here, often about relatively > > technical uses of python code that many of us have never used and still is > > not providing more exact info that tends to be needed before anyone can > > even think of diagnosing the problem. > > > > I have learned to stay away from some such questioners. But I am wondering > > if some people (others too) think this forum is a generalized help desk > > staffed by College Professors with nothing else to do. > > > > Many questions are best handled locally where people can look over your > > shoulder or use the same software and may have some fluency in your native > > language. And sometimes you need to do more investigating on your own, and > > perhaps tell us what you tried and why it was not useful, or we end up > > making endless suggestions and being told we are not working on your real > > issue and so on. > > > > The code below is just babel or maybe babble. Something nested in a loop > > had a problem. Why not try something drastic and look at the files and > > PICK ONE and use it step by step and see when it fails? > > > > It looks like the code wants to ask for all files then ignore some. > > > > Why you would import numpy repeatedly in a loop is beyond me! LOL! > > > > But which command line failed? My GUESS is: > > > > data = img.get_fdata() > > > > > > If so, did you try to see the current value of the filename you call "i" in > > the loop and see what name was loaded in what looks like a file ending in > > .nii in this code: > > > > img = nib.load(path+"/"+i) > > > > > > You need to proceed step by step and see if any previous steps failed. > > But what is possible is you got a file with .nii in middle of the name that > > does not end in .gz, or is not in the format needed. > > Indeed, it writes JPEG files whose filename contains the original > filename (with the ".nii") into the same folder, so if it has already > been run and produced an output file, the next time it's run, it'll trip > itself up. > > All this would've been clear to the OP if it had printed messages as it > went.
Or if the OP had renamed them all to "shrubbery" along the way. ChrisA -- https://mail.python.org/mailman/listinfo/python-list