kivy / plyer

Plyer is a platform-independent Python wrapper for platform-dependent APIs
https://plyer.readthedocs.io
MIT License
1.61k stars 427 forks source link

FileNotFoundError: [Errno 2] No such file or directory: 'None' #765

Closed boyintheroom closed 11 months ago

boyintheroom commented 1 year ago

I was trying to put a file to firebase which i selected from filechoser(plyer), it threw me this error.

05-19 14:49:35.186  6157  6157 I python  :  Traceback (most recent call last):
05-19 14:49:35.187  6157  6157 I python  :    File "jnius/jnius_proxy.pxi", line 50, in jnius.jnius.PythonJavaClass.invoke
05-19 14:49:35.187  6157  6157 I python  :    File "jnius/jnius_proxy.pxi", line 76, in jnius.jnius.PythonJavaClass._invoke
05-19 14:49:35.187  6157  6157 I python  :    File "/home/dheeraj/phenon/.buildozer/android/platform/build-armeabi-v7a_arm64-v8a_x86_x86_64/build/python-installs/Phenon/arm64-v8a/android/activity.py", line 35, in onActivityResult
05-19 14:49:35.188  6157  6157 I python  :    File "/home/dheeraj/phenon/.buildozer/android/platform/build-armeabi-v7a_arm64-v8a_x86_x86_64/build/python-installs/Phenon/arm64-v8a/plyer/platforms/android/filechooser.py", line 195, in _on_activity_result
05-19 14:49:35.188  6157  6157 I python  :    File "/home/dheeraj/phenon/.buildozer/android/app/main.py", line 679, in selectedTree
05-19 14:49:35.188  6157  6157 I python  :    File "/home/dheeraj/phenon/.buildozer/android/app/main.py", line 698, in Tree_to_database
05-19 14:49:35.188  6157  6157 I python  :    File "/home/dheeraj/phenon/.buildozer/android/platform/build-armeabi-v7a_arm64-v8a_x86_x86_64/build/python-installs/Phenon/arm64-v8a/pyrebase/pyrebase.py", line 462, in put
05-19 14:49:35.189  6157  6157 I python  :  FileNotFoundError: [Errno 2] No such file or directory: 'None'

i little of my code for you to understand

import pyrebase
from requests import urllib3
import requests

    def Upload(self, arg):
        from plyer import filechooser
        self.dialog.dismiss()
        filechooser.open_file(on_selection=(self.boby))

    def boby(self, selection): 
        from plyer import filechooser    
        if selection:           
            self.Directory = selection[0]
        self.India()

    def India(self):
        video=self.Directory
        firebase = pyrebase.initialize_app(config)
        storage = firebase.storage()
        storage.child('dheeraj').put(str(f"{video}"))
Julian-O commented 11 months ago

👋 Sorry to hear you are having difficulties; Kivy unites a number of different technologies, so developing apps can be temperamental.

We try to use GitHub issues only to track work for developers to do to fix bugs and add new features to this project. This issue is being closed, because it doesn't describe a bug in this project.

There is a mailing list and a Discord channel to support Kivy users debugging their own systems, which should be able to help. They are linked in the ReadMe.

Of course, if it turns out you have stumbled over a bug in this project, we do want to hear about it here. The support channels should be able to help you craft an appropriate bug report.

einfall commented 7 months ago

I think this is a permission problem, i got the same None callback try to set the permission.

from android import api_version, mActivity
from android.permissions import request_permissions, Permission
if api_version < 29:
    self.permissions = [Permission.WRITE_EXTERNAL_STORAGE, Permission.READ_EXTERNAL_STORAGE]
else:
    self.permissions = [Permission.READ_MEDIA_IMAGES, Permission.WRITE_EXTERNAL_STORAGE, Permission.READ_EXTERNAL_STORAGE, Permission.READ_MEDIA_VIDEO, Permission.READ_MEDIA_AUDIO]
request_permissions(self.permissions)