[WinError 3] The system cannot find the path specified

31283
2
04-24-2020 01:14 PM
AkpakliEdudzi
New Contributor

Hi!

I have taken a course on updating real-time data with python. Toward the latter part of the course i was supposed to update an online feature service in a web map. However, i encountered a FileNotFound error when i ran the script in the python command prompt:

"FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\user\\AppData\\Local\\Temp\\tmpfesd0bnq\\p20\\live.gdb'"

I need help on how to fix it.

Attached is the script I've written.

Thank you.

0 Kudos
2 Replies
GonzaloEspinoza-Davalos
New Contributor

Hi Akpakli,

What is the command that you're trying to run in the command prompt? maybe there is a parameter (i.e. file location) that might contain an error and windows can't locate the file. Maybe one of the followings:

  • C:\\Users\\user\\AppData\\Local\\Temp\\tmpfesd0bnq\\p20\\live.gdb . the directory user in this case should be replaced by your windows user name.
  • Try to create a folder for the exercise, especially for the Live geodatabase. Use some location other than the ...\\AppData\\Local\\Temp folder. Before running the feed routine in the command prompt, verify that the directory exists and that you can load the feature classes in the geodatabase in ArcGIS Pro.

Good luck!

Gonzalo

0 Kudos
carlhyde
New Contributor

When you specify the file name "filename.ext" while read  file, you are providing the open() function with a relative path. This means that the file you want to read is located in the current working directory.

file = open('filename.ext') //relative path

In the above code, you are not giving the full path to a file to the open() function, just its name - a relative path. The error “FileNotFoundError: [Errno 2] No such file or directory” is telling you that there is no file of that name in the working directory. So, try using the exact, or absolute path.

file = open(r'C:\path\to\your\filename.ext') //absolute path

In the above code, all of the information needed to locate the file is contained in the path string - absolute path.

If the full path to the file is not provided, the python file path is interpreted relative to the current working directory. This is the directory from which the program was started. For this to work, the directory containing the python executable must be in the PATH environment variable, which contains directories automatically searched for executables when a command is entered. To access a file in a different directory, you must either specify a relative path between the files or use an absolute path for one of them.

 

0 Kudos