UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    clickable and Python/QML App ImportError: No module named 'encodings'

    Scheduled Pinned Locked Moved App Development
    10 Posts 3 Posters 2.3k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ropod7R Offline
      ropod7
      last edited by ropod7

      Platform: --xenial.

      I'm trying to launch simple 'Hello World' app from touch panel, but logs shows that there is:
      Fatal Python error: Py_Initialize: Unable to get the locale encoding
      ImportError: No module named 'encodings'

      From the console python and app launches very well, but not from click panel. I'm trying to dig into app.apparmor policy groups, but there nothing to add in this case. Also I had seen that in the app directory is lib/arm-linux-gnueabihf which contains libpython3.4m* libraries.

      There is also /userdata/systme-data path, but there nothing in this case to import anything for python only etc/:opt/ and var/ system dirs.

      So my questions are:

      1. Which user is launching apps from panel?
      2. How does apparmor participates in this process?
      3. Which python package participates in this process and from which directory?
        Following from previous questions:
      4. How to permit process which launching apps to read $PATH and $PYTHONPATH variables and to get everything what python needs?
      neoparN 1 Reply Last reply Reply Quote 0
      • neoparN Offline
        neopar @ropod7
        last edited by

        @ropod7 I ran into same errors when I tried to use clickable app template. It is not ported to xenial.

        So just use python build template and remove local python libs.

        ropod7R 1 Reply Last reply Reply Quote 1
        • ropod7R Offline
          ropod7 @neopar
          last edited by

          @neopar Thank you. It works. Just removed lib/ directory from project.

          1 Reply Last reply Reply Quote 0
          • neoparN Offline
            neopar
            last edited by

            @ropod7 clickable --desktop also didn't work for me. On desktop I use qmlscene for testing.

            ropod7R 1 Reply Last reply Reply Quote 1
            • ropod7R Offline
              ropod7
              last edited by

              It's did not work for me to. I will try your method. Thanks.

              1 Reply Last reply Reply Quote 0
              • ropod7R Offline
                ropod7
                last edited by

                So, it is not so comfortable to remove lib/ dir from the project on the phone at each installation. Easier to move python_lib/ dir from the source of project on desktop to somewhere and comment on the CMakeLists.txt file just one line:
                #add_subdirectory(python-lib)

                And it works.

                1 Reply Last reply Reply Quote 0
                • ropod7R Offline
                  ropod7 @neopar
                  last edited by

                  @neopar I found solution to publish xenial python apps created on clickable.

                  1. We need to remove all *3.4m python libs from local projects lib/ directory and also libpyothersideplugin.so from there;
                  2. Download from device system libs libpython3.5m.so.1.0 and libpython3.5m.so.1;
                  3. Edit python-lib/CMakeLists.txt to replace all 3.4 to 3.5;

                  After all we may upload apps to the open-store.io

                  Ubuntu Touch is awesome in case of app development. I've created one simple app. Need test.

                  H 1 Reply Last reply Reply Quote 1
                  • H Offline
                    hummlbach @ropod7
                    last edited by hummlbach

                    Hi @ropod7, can you tell why you're doing steps 2 and 3 now? What you've written in your fore last post was more what I had expected.

                    ropod7R 2 Replies Last reply Reply Quote 0
                    • ropod7R Offline
                      ropod7 @hummlbach
                      last edited by ropod7

                      @hummlbach Otherwise xenial returns encodings import error in my device. Xenial has python3.5 on a board and while calling clickable review --xenial before clickable publish --xenial - desktop returns that no python libs on an app board.
                      In the last case after clickable --xenial we do not need to remove anything at the device side. Everything works from scratch.

                      1 Reply Last reply Reply Quote 0
                      • ropod7R Offline
                        ropod7 @hummlbach
                        last edited by

                        @hummlbach It is just one time process moving libs into the python-lib/
                        After that project is compatible for xenial. I don't know how abot previous 15.04, but in xenial case it works.

                        1 Reply Last reply Reply Quote 0

                        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                        With your input, this post could be even better 💗

                        Register Login
                        • First post
                          Last post