Hi.
Host: Ubuntu 22.04 x86_64
Device: Pixel 3a, Ubuntu 20.04
Clickable: 8.0.1
I'm trying to install an openconnect client on my phone. If I solve the challenge from the shell side, then there is a problem with the interface.
I installed clickable with the “QML only” profile (according to the documentation at https://docs.innerzaurus.com/en/latest/tools/clickable.html).
I created a simple interface with a Python call on click.
Everything works on emulation, but not on the phone.
The function with a simple print statement works, but with the subshell call it does not, even with a try-except attached.
How can I display the error? Or should I call the shell differently? (To be honest, I don’t really need Python. I can perform all the logical steps in bash.)
main.qml
import QtQuick 2.0
import io.thp.pyotherside 1.0
Rectangle {
width: 640; height: 480
color: "#E95420"
Text {
id: label
font.family: "Ubuntu Mono"
font.pixelSize: 32
text: "[Nothing here yet]"
anchors {
top: parent.top
left: parent.left
}
color: "white"
}
MouseArea {
anchors.fill: parent
onClicked: {
py.addImportPath(Qt.resolvedUrl("."));
py.importModule("hello", function(){
label.text = py.call_sync("hello.run_netstat_output");
});
}
}
Python { id: py }
}
hello. py
import subprocess
# hello.py
def hello_world():
return "Hello from Python!"
def return_shell_output(cmd):
try:
out = subprocess.check_output(cmd, shell=True)
return out.decode("utf-8")
except subprocess.CalledProcessError as e:
return f"Error executing command: {e}"
def run_netstat_output():
return return_shell_output("ls -l") # ls is for the test purpose