FileNotFoundError: [Errno 2] No such file or directory: '/home/mrpravin21/Documents/Python3/Application6/users.json' ( kivy app ) - TagMerge
4FileNotFoundError: [Errno 2] No such file or directory: '/home/mrpravin21/Documents/Python3/Application6/users.json' ( kivy app )FileNotFoundError: [Errno 2] No such file or directory: '/home/mrpravin21/Documents/Python3/Application6/users.json' ( kivy app )

FileNotFoundError: [Errno 2] No such file or directory: '/home/mrpravin21/Documents/Python3/Application6/users.json' ( kivy app )

Asked 7 months ago
0
4 answers

try removing setup.py from buildozer folder....that worked for me

Source: link

0

We’re writing a program that lists all the files in a folder. The folder we are referencing contains a list of markdown documentation for our project. To start, let’s import the os library, which has a method that lets us see all the files in a folder:
import os
Next, we are going to use the os.listdir() method to get a list of the files in our folder:
for f in os.listdir("/home/james/python_error/documentation/"):
	print(f)
Our code returns:
FileNotFoundError: [Errno 2] No such file or directory: '/home/james/python_error/documentation/'
We have referenced a folder that does not exist. To solve the error in our program, we must make sure the directory to which we point exists. The actual folder with our docs is at /home/james/python_error/docs . Let’s change the folder to which our program refers to the one that actually contains our documentation:
import os

for f in os.listdir("/home/james/python_error/docs/"):
	print(f)
Our code returns:
index.md

Source: link

0

main.pyemployee1.csv
import csv

with open('employee.csv','r') as file:
    employee = csv.reader(file)

print(employee)
main.pyemployee1.csv
name, age, gender
John, 23, M
Jake, 24, M
Johnny, 22, M

Source: link

0

VS Code is returning the following in the terminal:
Traceback (most recent call last):
File "/Filepath/10-1_learning_python.py", line 3, in <module>
with open(filename) as file_content:
FileNotFoundError: [Errno 2] No such file or directory: 'learning_python.txt'
This is the code in "10-1_learning_python.py":
filename = 'learning_python.txt'

with open(filename) as file_content:
    content = file_content.read()
    print(content)
When you open a file with the file name , you are telling the open() function that your file is in the current working directory. This is called a relative path. If the user does not pass the full path to the file (on Unix type systems this means a path that starts with a slash), the path is interpreted relatively to the current working directory. The current working directory usually is the directory in which you started the program. A good start would be validating the input. In other words, you can make sure that the user has indeed typed a correct path for a real existing file, like this:
while not os.path.isfile(fileName):
    fileName = input("Whoops! No such file! Please enter the name of the file you'd like to use.")

Source: link

Recent Questions on python

    Programming Languages