UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login
    1. Home
    2. Kamisori
    K
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 3
    • Groups 0

    Kamisori

    @Kamisori

    1
    Reputation
    2
    Profile views
    3
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    Kamisori Unfollow Follow

    Best posts made by Kamisori

    • RE: How to debug python app?

      Here I am with answer to the my own question.
      RTFM!
      clickable log command very useful. 🙂

      posted in App Development
      K
      Kamisori

    Latest posts made by Kamisori

    • How to allow unconfined apparmor template with clicable?

      No publish to OpenStore is needed.
      How can I get unrestricted shell access?
      How I should use --accept-review-errors argument with the clickable command?

      Sorry for the brief description. 'Post content was flagged as spam by Akismet.com' warnings are pissed pissed me off.

      posted in App Development
      K
      Kamisori
    • RE: How to debug python app?

      Here I am with answer to the my own question.
      RTFM!
      clickable log command very useful. 🙂

      posted in App Development
      K
      Kamisori
    • How to debug python app?

      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
      
      posted in App Development
      K
      Kamisori