Answer the question
In order to leave comments, you need to log in
Why does the Kivy app crash on my phone when using boto3, paramiko?
I have a small application that sends a command to AWS EC2 and runs code on it. Created application on Xubuntu virtual machine using python 3.6. On Windows everything works fine. I was also able to build other applications with Kivy and KivyMD on this VM.
Here is part of my custom file.
source.include_exts = py,png,jpg,kv,atlas
source.include_patterns = assets/*,amazon2.pem
requirements = kivy==1.11.1, kivymd, boto3, botocore, openssl, paramiko, urllib3, s3transfer
from kivy.lang import Builder
from kivymd.app import MDApp
import kivy
import boto3
import paramiko
kivy.require('1.11.1')
KV = '''
Screen:
MDRoundFlatIconButton:
id: button
text: "Start"
font_size: "18sp"
pos_hint: {"center_x": 0.5, "center_y": 0.15}
on_release: app.start()
'''
class MainApp(MDApp):
def build(self):
return Builder.load_string(KV)
def start(self):
def lambda_handler():
client = boto3.client('ec2', aws_access_key_id=aws_access_key, aws_secret_access_key=aws_secret_key,
region_name='us-east-2')
describeInstance = client.describe_instances()
key = paramiko.RSAKey.from_private_key_file("amazon2.pem")
ssh_client = paramiko.SSHClient()
ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh_client.connect(hostname="18.18.18.18", username="ubuntu", pkey=key)
commands = [
"python3 /home/ubuntu/server.py 'text'",
]
print("Starting execution")
for command in commands:
print("Executing command: " + command)
stdin, stdout, stderr = ssh_client.exec_command(command)
print(stdout.read())
print(stderr.read())
print("finished execution")
lambda_handler()
MainApp().run()
import boto3
import paramiko
into a function, then everything starts, but when you click on the button where these imports are involved, the application crashes Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question