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

    Odd Syntax Errors Python3 at colon

    Scheduled Pinned Locked Moved Solved App Development
    3 Posts 2 Posters 262 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.
      • A Offline
        aarontheissueguy
        last edited by

        I am currently writing a Gemini protocol client for UT and have to import some python modules to get everything working. I use sys to add the libraries to path and was able to successfully import them after some tinkering. It seems like everything the applications needs to run is available to it even if I run it outside of the virtual environment, but if I run clickable desktop to test everything I run into an weird issue that causes the following syntaxerror:

        Failed to create /home/aaron/.cache for shader cache (Permission denied)---disabling.
        "/home/aaron/Nextcloud/Projekte/Gem/build/x86_64-linux-gnu/app/install/%U" does not exist.
        Got library name:  "/usr/lib/x86_64-linux-gnu/qt5/qml/io/thp/pyotherside/libpyothersideplugin.so"
        file:///home/aaron/Nextcloud/Projekte/Gem/build/x86_64-linux-gnu/app/install/qml/Main.qml:94:24: Unable to assign [undefined] to int
        "PyOtherSide error: Traceback (most recent call last):\n\n  File \"/home/aaron/Nextcloud/Projekte/Gem/build/x86_64-linux-gnu/app/install/src/Main.py\", line 19, in <module>\n    import Agunua\n\n  File \"lib/python3.8/site-packages/Agunua/__init__.py\", line 18, in <mdule>\n    import OpenSSL\n\n  File \"lib/python3.8/site-packages/OpenSSL/__init__.py\", line 8, in <module>\n    from OpenSSL import crypto, SSL\n\n  File \"lib/python3.8/site-packages/OpenSSL/crypto.py\", line 14, in <module>\n    from cryptography import utils, x50\n\n  File \"lib/python3.8/site-packages/cryptography/x509/__init__.py\", line 7, in <module>\n    from cryptography.x509.base import (\n\n  File \"lib/python3.8/site-packages/cryptography/x509/base.py\", line 12, in <module>\n    from cryptography.hazmat._types impor _PRIVATE_KEY_TYPES, _PUBLIC_KEY_TYPES\n\n  File \"lib/python3.8/site-packages/cryptography/hazmat/_types.py\", line 7, in <module>\n    from cryptography.hazmat.primitives.asymmetric import (\n\n  File \"lib/python3.8/site-packages/cryptography/hazmat/primitives/asymetric/dsa.py\", line 10, in <module>\n    from cryptography.hazmat.backends import _get_backend\n\n  File \"lib/python3.8/site-packages/cryptography/hazmat/backends/__init__.py\", line 7\n\n    _default_backend: typing.Any = None\n\n                    ^\n\nSyntaxErro: invalid syntax\n"
        qml: python error: Cannot import module: Main (Traceback (most recent call last):
        
          File "/home/aaron/Nextcloud/Projekte/Gem/build/x86_64-linux-gnu/app/install/src/Main.py", line 19, in <module>
            import Agunua
        
          File "lib/python3.8/site-packages/Agunua/__init__.py", line 18, in <module>
            import OpenSSL
        
          File "lib/python3.8/site-packages/OpenSSL/__init__.py", line 8, in <module>
            from OpenSSL import crypto, SSL
        
          File "lib/python3.8/site-packages/OpenSSL/crypto.py", line 14, in <module>
            from cryptography import utils, x509
        
          File "lib/python3.8/site-packages/cryptography/x509/__init__.py", line 7, in <module>
            from cryptography.x509.base import (
        
          File "lib/python3.8/site-packages/cryptography/x509/base.py", line 12, in <module>
            from cryptography.hazmat._types import _PRIVATE_KEY_TYPES, _PUBLIC_KEY_TYPES
        
          File "lib/python3.8/site-packages/cryptography/hazmat/_types.py", line 7, in <module>
            from cryptography.hazmat.primitives.asymmetric import (
        
          File "lib/python3.8/site-packages/cryptography/hazmat/primitives/asymmetric/dsa.py", line 10, in <module>
            from cryptography.hazmat.backends import _get_backend
        
          File "lib/python3.8/site-packages/cryptography/hazmat/backends/__init__.py", line 7
        
            _default_backend: typing.Any = None
        
                            ^
        
        SyntaxError: invalid syntax
        )
        qml: module imported
        "PyOtherSide error: Traceback (most recent call last):\n\n  File \"<string>\", line 1, in <module>\n\nNameError: name 'Main' is not defined\n"
        qml: python error: Function not found: 'Main.display' (Traceback (most recent call last):
        
          File "<string>", line 1, in <module>
        
        NameError: name 'Main' is not defined
        )
        qml: python error: file:///home/aaron/Nextcloud/Projekte/Gem/build/x86_64-linux-gnu/app/install/qml/Main.qml:120: Error: Cannot assign [undefined] to QString
        
        
        

        Can anyone tell me what is going on?
        Btw those are the additional modules I installed through pip3 in the venv

        Package      Version
        ------------ -------
        agunua       1.0
        cffi         1.14.5
        cryptography 3.4.6
        netaddr      0.8.0
        pip          20.2.3
        pycparser    2.20
        pyOpenSSL    20.0.1
        setuptools   53.1.0
        six          1.15.0
        
        

        and here is the sourcecode:

        https://github.com/Aarontheissueguy/AGem

        and finally the logs:

        Clickable v6.23.3
        Using cached version check
        Architecture set to "amd64" because of desktop mode.
        App config value clickable_minimum_required: 6.22.0
        App config value arch: amd64
        App config value restrict_arch_env: None
        App config value restrict_arch: None
        App config value arch_triplet: x86_64-linux-gnu
        App config value template: None
        App config value builder: precompiled
        App config value postmake: None
        App config value prebuild: None
        App config value build: None
        App config value postbuild: None
        App config value launch: None
        App config value build_dir: /home/aaron/Nextcloud/Projekte/Gem/build/x86_64-linux-gnu/app
        App config value build_home: /home/aaron/Nextcloud/Projekte/Gem/build/x86_64-linux-gnu/app/.clickable/home
        App config value src_dir: /home/aaron/Nextcloud/Projekte/Gem
        App config value root_dir: /home/aaron/Nextcloud/Projekte/Gem
        App config value kill: qmlscene
        App config value scripts: {}
        App config value default: clean build install launch
        App config value log: None
        App config value dependencies_build: []
        App config value dependencies_host: []
        App config value dependencies_target: []
        App config value dependencies_ppa: []
        App config value install_lib: []
        App config value install_bin: []
        App config value install_qml: []
        App config value install_data: {}
        App config value app_lib_dir: /home/aaron/Nextcloud/Projekte/Gem/build/x86_64-linux-gnu/app/install/lib/x86_64-linux-gnu
        App config value app_bin_dir: /home/aaron/Nextcloud/Projekte/Gem/build/x86_64-linux-gnu/app/install/lib/x86_64-linux-gnu/bin
        App config value app_qml_dir: /home/aaron/Nextcloud/Projekte/Gem/build/x86_64-linux-gnu/app/install/lib/x86_64-linux-gnu
        App config value ignore: ['.git', '.bzr', '.clickable']
        App config value make_jobs: 4
        App config value gopath: None
        App config value cargo_home: /home/aaron/.clickable/cargo
        App config value docker_image: clickable/amd64-16.04-amd64:16.04.4-qt5.9
        App config value build_args: []
        App config value env_vars: {}
        App config value env_env_vars: {}
        App config value make_args: ['-j4']
        App config value dirty: False
        App config value libraries: {}
        App config value test: qmltestrunner
        App config value install_dir: /home/aaron/Nextcloud/Projekte/Gem/build/x86_64-linux-gnu/app/install
        App config value image_setup: {}
        App config value qt_version: 5.9
        App config value framework: ubuntu-sdk-16.04.4
        Running the "desktop" command
        Checking docker image version via: docker inspect --format '{{ index .Config.Labels "image_version"}}' clickable/amd64-16.04-amd64:16.04.4-qt5.9
        Copied files to install directory for click building
        Using docker container "clickable/amd64-16.04-amd64:16.04.4-qt5.9"
        Click outputted to /home/aaron/Nextcloud/Projekte/Gem/build/x86_64-linux-gnu/app/gem.aaron_1.0.0_amd64.click
        Mounting device home to /home/aaron/.clickable/home
        docker run --privileged --net=host -v /home/aaron/Nextcloud/Projekte/Gem:/home/aaron/Nextcloud/Projekte/Gem:Z -v /tmp/.X11-unix:/tmp/.X11-unix:Z -v /tmp/.docker.xauth:/tmp/.docker.xauth:Z -v /home/aaron/.clickable/home:/home/phablet:Z -v /etc/passwd:/etc/passwd:Z -v /dev/shm:/dev/shm:Z -v /etc/machine-id:/etc/machine-id:Z -v /run/1000/pulse:/run/user/1000/pulse:Z -v /var/lib/dbus:/var/lib/dbus:Z -v /home/aaron/.pulse:/home/phablet/.pulse:Z -v /dev/snd:/dev/snd:Z -e LANG=de_DE.UTF-8 -e LANGUAGE=de_DE.UTF-8 -e LC_CTYPE=de_DE.UTF-8 -e LC_NUMERIC=de_DE.UTF-8 -e LC_TIME=de_DE.UTF-8 -e LC_COLLATE=de_DE.UTF-8 -e LC_MONETARY=de_DE.UTF-8 -e LC_MESSAGES=de_DE.UTF-8 -e LC_PAPER=de_DE.UTF-8 -e LC_NAME=de_DE.UTF-8 -e LC_ADDRESS=de_DE.UTF-8 -e LC_TELEPHONE=de_DE.UTF-8 -e LC_MEASUREMENT=de_DE.UTF-8 -e LC_IDENTIFICATION=de_DE.UTF-8 -e LC_ALL=de_DE.UTF-8 -e TZ='Europe/Berlin
        ' -e APP_DIR=/home/aaron/Nextcloud/Projekte/Gem/build/x86_64-linux-gnu/app/install -e TEXTDOMAINDIR='' -e XAUTHORITY=/tmp/.docker.xauth -e DISPLAY=:0 -e QML2_IMPORT_PATH=/home/aaron/Nextcloud/Projekte/Gem/build/x86_64-linux-gnu/app/install/lib/x86_64-linux-gnu:/home/aaron/Nextcloud/Projekte/Gem/build/x86_64-linux-gnu/app/install/lib:/usr/local/nvidia/lib:/usr/local/nvidia/lib64 -e LD_LIBRARY_PATH=/home/aaron/Nextcloud/Projekte/Gem/build/x86_64-linux-gnu/app/install/lib/x86_64-linux-gnu:/home/aaron/Nextcloud/Projekte/Gem/build/x86_64-linux-gnu/app/install/lib:/usr/local/nvidia/lib:/usr/local/nvidia/lib64 -e PATH=/home/aaron/Nextcloud/Projekte/Gem/build/x86_64-linux-gnu/app/install/bin:/home/aaron/Nextcloud/Projekte/Gem/build/x86_64-linux-gnu/app/install/lib/x86_64-linux-gnu/bin:/home/aaron/Nextcloud/Projekte/Gem/build/x86_64-linux-gnu/app/install:/usr/local/nvidia/bin:/bin:/usr/bin -e HOME=/home/phablet -e OXIDE_NO_SANDBOX=1 -e UBUNTU_APP_LAUNCH_ARCH=x86_64-linux-gnu   -w /home/aaron/Nextcloud/Projekte/Gem/build/x86_64-linux-gnu/app/install --user=1000 --rm  -i clickable/amd64-16.04-amd64:16.04.4-qt5.9 bash -c "qmlscene %U qml/Main.qml"
        
        1 Reply Last reply Reply Quote 0
        • U Offline
          UniSuperBox
          last edited by

          I'm pretty sure that PyOtherSide isn't running python3.8, but 3.5. This means that type hints are, indeed, a syntax error. @dobey might be able to confirm, but I think you need python3.5 deps and not 3.8

          A 1 Reply Last reply Reply Quote 0
          • A Offline
            aarontheissueguy @UniSuperBox
            last edited by

            @unisuperbox Yes that was the Problem tank you

            1 Reply Last reply Reply Quote 0
            • First post
              Last post