r/kivy • • Mar 16 '18

HELP. Amazon Web Services (AWS) on Kivy. Python for android = BOTO3

AWS, specifically dynamodb is of huge benefit in mobile. Service assumed, like a water supply, always on. Have been asked by 'selfishshellfish' here, earlier thread, to look into this. Am using pygame for android (PGS4A) myself, deployment using "rapt": 'python android.py --launch build /home/user/dep release install'. Works well. shellfish here has tried boto3. I have tried boto3 & gone further in debugging his problem.

Boto3 = android python client for AWS dynamoDB access. boto = community python client for AWS dynamodb access.

pastebin holds trial program, error output, deplploy with buildozer

https://pastebin.com/35p0ijpC

someone else (manchester uk, both shellfish & I are also UK) .. posted on stack overflow that there is json problem with boto3. He resorts to boto2 .. He got boto2 working

boto2 is the advised "use boto3" boto2 is legacy as far as I can see.

I use python 4 android, I use rapt deploy =

https://github.com/renpytom/rapt-pygame-example

python android.py --launch build /home/dan/dep release install

I need some background on that

this I deployed boto with .. I managed to get boto deploying initially by copying the boto/botocore directories from /origin /usr/lib, into the deploy directory, so they end up on the device, can be imported. 1 is 11mb. That's no good, but I can't figure out how to include "requirements" into the .android.json, file that android.py appears to use for deploy. The "rapt" (via python for android given example 'hello world). Deployment is svelte. I was anti-buildozer until I saw all that it does.

So I get boto to import using python for android, but not to run. Reason, no ssl, no http because no ssl. Researching this, seeing what 'shellfish' has to get "boto" working with kivy (not sure if he has achieved that yet), the requirement = "openssl". So now I am with p4a, trying to get it to build with openssl. It requires ssl, AWS, boto requires SSL as 'secure communication layer' ..

no dice, because .. 1. I have no idea how to put ssl into requirements.

I then go to kivy to start looking @ putting 'boto' onto kivy. I am flailing around, get the kivy virtualbox deploy to work, was previous kivy user, before moving to p4a -- have assessed kivy, I like kivy, had managed to get "shellfish" (creating an app for UK social services), onto kivy, but I use p4a cos all my shit is pygame. I am then trying to move stuff from url/lib to the buildozer deploy directory I have .. etc etc etc. Supporting him for nothing. Need support to get boto. I want boto now also. It would replace my horrible attempts at filing systems.

In between, an attempt to package android app using p4a, .. saw that the p4a packaging, that is also a fundamental kivy packager, then provides an android app. That app isn't in APK format, needs bundling into APK. Im looking @ the way to bundle into APK which gets into eclipse, multi options, I do not want to use eclipse. I do not want to try it using the command line. It is a hugely complex task -- I see the reason for 'buildozer'. Was trying to use the p4a commands to get openssl into python-for-android.

I am looking at the rapt (python android.py) deploy, trying to figure out if the basis of that is p4a deploy. It does not seem to be. It is a very minimal, nice deploy but I can't get ssl into the package using it. I really need "boto3". I don't know where the PG4SA hello world originates, how it deploys p4a without using p4a. How it could be extended, how I could get it to include ssl.

Was thinking that it was a mistake advising this 'client' (selfishshellfish), to use kivy because, rather than java. would be sure that with android java deploy "boto3" amazon aws client, works 100%. More and more people will require boto with kivy. It really should work. The target market is mobile. Shellfish is doing mobile/IOT. Stuck, absolubtely.

selfishshellfish post earlier, re: this https://www.reddit.com/r/kivy/comments/82emte/gods_of_kivy_hear_me/

would change title of this to "please can we have boto3 with PG4SA, kivy

"selfishshellfish" / others know that Amazon AWS is now the goto place for cloud services, vs google/anything else.

I tested boto3 from ubuntu client with massive blocks > 100k blocks, it does not slow much, it does not break. Its amazing. It needs to be available from p4a/pygame for android=SDL2/kivy. I know a basis of kivy = "renpy". I know a basis of kivy is pygame.

thanks. help.

0 Upvotes

1 comment sorted by

1

u/[deleted] Mar 17 '18 edited Mar 17 '18

The first thing to do is to enable all sorts of debug logging in boto3 and all the libraries that it depends on (especially anything with json and networking etc). A ValueError with no context is not suuper helpful.

If I had to take a wild guess, it could be related to locale, that's a typical thing to cause weird encoding errors like this. In a best case scenario, it may be enough to set some environment variables; or it could be more work..

I have no idea how to put ssl into requirements.

The recipe name is openssl, so just add it to the requirements string, in buildozer for example requirements = hostpython2,kivy==master,openssl. Make sure you are using python for android master branch when doing this, either by setting p4a.branch in buildozer or by installing it system wide.

See recipes here: https://github.com/kivy/python-for-android/tree/master/pythonforandroid/recipes

You may need to create one or more of them to build boto3, it is possible that the error you are experiencing is because of a fallback (ie it uses a different library for some parsing on desktop platform, that has not been packaged)

Was trying to use the p4a commands to get openssl into python-for-android.

p4a apk \
  --private /path/to/your/app \
  --package=org.example.testapp \
  --name "Test application" \
  --version 0.1 \
  --bootstrap=sdl2 \
  --requirements=python2,kivy==master,openssl

This builds Kivy with openssl for me (edit: you need the ndk/sdk environment vars set as per p4a docs, or add those options to the command)