I am new to python kivy. I am finding a way to delete files without importing the os module. It casts an error while compiling it with buildozer. here's my code:
def remove_all(arg):
store = JsonStore('data.json')
if store.exists('json'):
filename = int(store.get('json').get('value'))
for i in range(filename):
os.remove('results/' + str(i+1) + '.jpg')
store.delete('json')
please lemme know if there's a module of kivy for deleting files
Well, you could use shutil.rmtree()
, which removes the file in question.
The real question however is, "why do I get an error with os?". OS is part of the python standard library, so buildozer adds it to your app either way. Did you include it in your buildozer .spec file?
If so, don't.