Python Forum
FileNotFoundError: No such file or no access
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
FileNotFoundError: No such file or no access
#1
Hello,

I am begging in python. I compile the code of and I got the error like this:

Quote: File "C:\Users\krasona\PycharmProjects\GlioblastomaSegmentation\venv\lib\site-packages\nibabel\loadsave.py", line 42, in load
raise FileNotFoundError("No such file or no access: '%s'" % filename)
FileNotFoundError: No such file or no access: 'C:\Users\krasona\PycharmProjects\GlioblastomaSegmentation\output\FLAIR_N4Bias.nii.gz'

The code looks like this :
  try:
        stat_result = os.stat(filename)
    except OSError:
        raise FileNotFoundError("No such file or no access: '%s'" % filename)
    if stat_result.st_size <= 0:
        raise ImageFileError("Empty file: '%s'" % filename)
    sniff = None
    for image_klass in all_image_classes:
        is_valid, sniff = image_klass.path_maybe_image(filename, sniff)
        if is_valid:
            img = image_klass.from_filename(filename, **kwargs)
            return img

    raise ImageFileError('Cannot work outfile type of "%s"' %
                         filename)


Could you help me to fix this issue ?

I would be appreciate for any help please.
Reply
#2
The error is quite clear.
The file C:\Users\krasona\PycharmProjects\GlioblastomaSegmentation\output\FLAIR_N4Bias.nii.gz doesn't exist, or you don't have access to it.
So check if you have the file, and if you have access.
Reply
#3
It didn't create this file.
Before It creates another files but this one was not created.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  FileNotFoundError: [WinError 2] The system cannot find the file specified NewBiee 2 1,496 Jul-31-2023, 11:42 AM
Last Post: deanhystad
  Trying to access excel file on our sharepoint server but getting errors cubangt 0 773 Feb-16-2023, 08:11 PM
Last Post: cubangt
  data file for .exe program to access ose 2 1,145 Nov-23-2022, 08:02 PM
Last Post: snippsat
  Need Help: FileNotFoundError:[Errno 2] No such file or directory python202209 5 2,526 Sep-12-2022, 04:50 AM
Last Post: python202209
  FileNotFoundError: [Errno 2] No such file or directory: 'word2vec.model' Anldra12 6 5,908 Jul-07-2021, 07:29 AM
Last Post: Anldra12
  FileNotFoundError: [Errno 2] No such file or directory: 'model/doc2vec.model/Articles Anldra12 10 5,680 Jun-11-2021, 04:48 PM
Last Post: snippsat
  FileNotFoundError: [Errno 2] No such file or directory: 5l3y3r 6 8,009 Nov-02-2020, 12:48 PM
Last Post: 5l3y3r
  Shutil FileNotFoundError: Errno 2 Help lord_kaiser 8 10,361 Aug-10-2020, 08:45 AM
Last Post: lord_kaiser
  Getting FileNotFoundError: [Errno 2] ,if tries to acees same file from sub-directory pmpinaki 2 2,458 May-04-2020, 03:39 PM
Last Post: pmpinaki
  Making .exe file that requires access to text and html files ClassicalSoul 0 1,552 Apr-23-2020, 05:03 PM
Last Post: ClassicalSoul

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020