Page 2 of 2

Posted: Sat Oct 21, 2017 3:58 am
by lightningrod
I am now running my own debug version of the app. I have hacked a
try: block around the suspected line identified here:
10-12 09:05:43.501 10388 10428 I python : File "/home/brent/git-projects/RaceCapture_App/.buildozer/android/platform/build/dists/racecapture/private/lib/python2.7/site-packages/kivy/app.py", line 780, in user_data_dir
10-12 09:05:43.501 10388 10428 I python : OSError: [Errno 2] No such file or directory: '/sdcard/racecapture'
before:

Code: Select all

        if not exists(data_dir):
                os.mkdir(data_dir)
after:

Code: Select all

        if not exists(data_dir):
            try:
                os.mkdir(data_dir)
            except:
                data_dir = data_dir
The app now starts and seems to run OK. I haven't tried to do much (like connect to my mk3) yet.

Oddly, creating the folder in question - /sdcard/racecapture (from the adb shell), does not change the behaviour. It still results in os.mkdir throwing the "No such file or directory" exception.

My experience with Kivy is nil and android debugging not much better. I'm happy to pursue this more, but, I'll need some direction.

Rod.

Posted: Sat Oct 21, 2017 7:35 pm
by lightningrod
My best guess as of right now is some Kivy/Android7/Huawei compatibility issue (perhaps exacerbated by me having configured the SD to be the default storage location). However, I'm confident that my phone has a legitimate configuration that should be handled without crashing.

When executed with the Racecapture context I get permission denied when attempting to do a os.listdir('/') and a file not found on os.listdir('/sdcard').

In my hacked version I have changed the external storage location to '/storage/2824-9CB0' instead of '/sdcard' and everything seems to be working as expected. I found this location by browsing my phone's drive. I suspect there is a proper API for extracting this info. Although the fact that '/sdcard' exists and seems to point to the same location has me thinking it could also be a permission problem.

Brent: I'll leave it to you at this point if you wish to escalate this to kivy, but I think I've found out all that I can on my own at this point.

Rod.

Posted: Sun Oct 22, 2017 4:51 am
by lightningrod
Using the code from autosportlabs/racecapture/settings/systemsettings.py

Code: Select all

            from jnius import autoclass
            env = autoclass('android.os.Environment')
            return path.join(env.getExternalStorageDirectory().getPath(), 'racecapture')


instead of the code from .buildozer/android/platform/build/dists/racecapture/private/lib/python2.7/site-packages/kivy/app.py

Code: Select all

            data_dir = join('/sdcard', self.name)
seems to find '/storage/2824-9CB0' correctly.

The code in .../kivy/app.py should become functionally equivalent to:

Code: Select all

            from jnius import autoclass
            env = autoclass('android.os.Environment')
            data_dir = join(env.getExternalStorageDirectory().getPath(), self.name )
This was identified as a problem in Kivy https://github.com/kivy/kivy/issues/2990
this related discussion was closed here: https://github.com/kivy/kivy/issues/5259

All the users complaining about this seem to Huawei users.

Posted: Sun Oct 22, 2017 7:30 pm
by lightningrod
I've reported this to kivy and it looks like fix may come with an upcoming kivy release:
https://github.com/kivy/kivy/issues/5448

Posted: Wed Oct 25, 2017 3:33 pm
by brentp
Excellent research, thank you.

You're welcome to open an issue on our repository so we can track it for the next release, and reference the Kivy issues from there.

Thanks again!