Questions tagged [file-not-found]

An error, exit status, or exception that indicates that the file denoted by a specified pathname could not be found.

An error, exit status, or exception that indicates that the file denoted by a specified pathname could not be found. In other words, you're trying to access a file that doesn't exist where the code is expecting it to be.

This could occur as a result of many different actions, such as...

  1. The file doesn't actually exist, or was deleted before you could access it
  2. There is a spelling mistake in your pathname, or the pathname contains characters that aren't permitted in the pathname.
  3. You're using a relative pathname (such as file.txt) and the file doesn't exist in the default working directory for your application
  4. The code is getting confused due to different directory path indicators on different operating systems (ie / vs \)
  5. The programming language interprets the \ character in a String to be a escape character for a special symbol (such as \n indicating new-line), and you're using single \ slashes as directory indicators instead of \\ for a single escaped slash.
  6. In some languages, it could also give this exception if you aren't able to access the file due to security permissions.

Your code should be able to prevent or handle this condition, such as by doing the following...

  1. Detect - Many programming languages allow you to create a File object as a virtual representation of a physical file. Further to this, you can usually call a method or function that asks whether the file exists, such as exists();. This would allow you to check the file exists before you attempt to access it
  2. Prevent - If the user is selecting a file, present them with a FileChooser dialog rather than a text entry field. FileChooser dialogs echo the files that exist in the system, so spelling mistakes are avoided. If you're using relative paths, convert them to absolute paths if practical, or ensure you set the relative path location to a known directory before trying to access files relatively.
  3. Handle - Wrap your file access methods in exception-handling code, such as a try-catch block. This will allow you to catch unexpected exceptions, and perform an alternate operation, such as alerting the user of the error.
601 questions
6
votes
3 answers

import "cocos2d.h" works in some files, but not all

Here is what I did: In Xcode 4.3.1 File -> New -> Project -> Single view application Dragged the file cocos2d-ios.xcodeproj into navigator. In build phases settings : Added : libcocos2d.a (becomes highlighted in red), as a linked library…
Rahul Iyer
  • 19,924
  • 21
  • 96
  • 190
6
votes
3 answers

Include all files when debugging in Visual Studio?

How do I setup Visual Studio 2008 to include all files in the project root when debugging? I have a few files in the project root folder which are not copied to the bin/debug folder so when I am about to debug the application I have to manually copy…
Adam Asham
  • 1,519
  • 2
  • 20
  • 32
6
votes
1 answer

Eclipse can't find header file, even though include paths are set

This was an issue we've been dealing with for a while now - we're building a C++ project using the Cygwin toolchain, and no matter what we add in the C++ compiler include paths under project settings, Eclipse can't seem to find the necessary header…
Vee
  • 729
  • 10
  • 27
6
votes
1 answer

Python FileNotFoundError with trailing period in filename

I have a weird problem. I can neither rename specific files, nor remove them. I get the FileNotFoundError. Similar questions have been asked before. The solution to this problem was using a full path and not just the filename. My script worked…
Ali
  • 761
  • 1
  • 5
  • 24
6
votes
6 answers

Error: The file “Info.plist” couldn’t be opened because there is no such file

I have move my project from another machine with latest Xcode installed in it. But now when i'm running project it giving me error as Info.plist:0: error: reading data: The file “Info.plist” couldn’t be opened because there is no such…
Lalit
  • 61
  • 1
  • 2
  • 9
6
votes
1 answer

Source not found on Vagrant up

I have the below code in my Vagrantfile which calls the below script. The script runs fine up until the last line source $dotfile. When it gets to source, the script says source: not found. The line before, cat $dotfile works just fine so the file…
Merlin -they-them-
  • 2,731
  • 3
  • 22
  • 39
6
votes
1 answer

Debug Triggering Build Errors (File Not Found) and Antivirus Program, Visual Basic (V11 2012)

I made some changes in my code and when I went to debug my program I got a build error. The error prompted my anti-virus software (Avast) to block my program as a "suspicious file". Visual Studio returned this error: Error 1 Could not copy the file…
6
votes
3 answers

AVFoundation/AVFoundation.h file not found

When I create an iOS project,and "Build Phases -> Link binary with Libraries", I add the AVFoundation.framework lib and use #import "". I get a compilation error: "AVFoundation/AVFoundation.h file not found". Here's…
explorer
  • 449
  • 2
  • 10
  • 19
5
votes
0 answers

GTLObject.h file not found GTLCalendar and GoogleOpernSource framework

Works fine in release mode but not in debug. Settings seem to be identical, but if they are not I cannot see what is different. Apparently GTL_BUILT_AS_FRAMEWORK is not defined in debug mode. Everything is included by reference into project. in…
kos
  • 1,357
  • 9
  • 21
5
votes
4 answers

Orchard 1.8 Getting 404 Not Found Error - Deployed via Web Matrix

I created an Orchard Website (Version 1.8) It was created through WebMatrix. Locally everything runs perfectly fine. When I upload it to my server (Web Deploy also via WebMatrix) I get following Error Message: Server Error in '/' Application. The…
5
votes
6 answers

Permalinks in Wordpress - Page not found

I've been searching for hours but haven't found anything that seems to be able to solves this issue. Here's the scenario: I'm making a wp theme based on the "Twenty Eleven" theme. Everything went fine til I decided to change the urls to permalinks.…
darksoulsong
  • 13,988
  • 14
  • 47
  • 90
4
votes
2 answers

Why does adding multiprocessing prevent python from finding my compiled c program?

I am currently looking to speed up my code using the power of multiprocessing. However I am encountering some issues when it comes to calling the compiled code from python, as it seems that the compiled file disappears from the code's view when it…
Arkleseisure
  • 416
  • 5
  • 19
4
votes
3 answers

Too many open files Error on Lucene

The project I'm working on is indexing a certain number of data (with long texts) and comparing them with list of words per interval (about 15 to 30 minutes). After some time, say 35th round, while starting to index new set of data on 36th round…
eunique0216
  • 875
  • 1
  • 16
  • 28
4
votes
0 answers

MSBUILD : error MSB1009: Project file does not exist when building docker file for an ASP.NET Core API application

I am trying to build a docker image for an ASP.NET Core 3.1 application and I fail to restore the packages. My solution has multiple projects and after copying all the project files, I am trying to create a layer which contains restored dependencies…
Alexei - check Codidact
  • 22,016
  • 16
  • 145
  • 164
4
votes
0 answers

"" error when running pip or venv

I have several people on my team that are running into an intermittent problem running some very basic Python commands. The following is all in Windows 10, using the Python Launcher (the py command that allows you to setup a default Python – in our…
LightCC
  • 9,804
  • 5
  • 52
  • 92
1 2
3
40 41