Skip to content

entrypoint confusion with python3 #1999

Closed as not planned
Closed as not planned

Description

@inter1965

Hi, i am working with the git version of pythonforandroid.

pythonforandroid/bootstraps/common/build/jni/application/src/start.c

char *dot = strrchr(env_entrypoint, '.');
#if PY_MAJOR_VERSION > 2
char *ext = ".pyc";
#else
char *ext = ".pyo";
#endif

pythonforandroid/bootstraps/sdl2/build/src/main/java/org/kivy/android/PythonActivity.java

public String getEntryPoint(String search_dir) {
/* Get the main file (.pyc|.pyo|.py) depending on if we
* have a compiled version or not.
*/
List<String> entryPoints = new ArrayList<String>();
entryPoints.add("main.pyo"); // python 2 compiled files
entryPoints.add("main.pyc"); // python 3 compiled files
for (String value : entryPoints) {
File mainFile = new File(search_dir + "/" + value);
if (mainFile.exists()) {
return value;
}
}
return "main.py";
}

Judging from the code above, there should be only one entrypoint file existed in the private.mp3 archive. However, for the current build, both "main.pyc" and "main.py" were stored in the private.mp3 archive. This caused the enviroment variable 'ANDROID_ENTRYPOINT': 'main.pyo' and it complains "Entrypoint have an invalid extension (must be .py or .pyc/.pyo), abort.", thus the program won't start.

tar tf apk/assets/private.mp3 | head
main.pyc
main.pyo
_python_bundle/
_python_bundle/stdlib.zip
_python_bundle/site-packages/
_python_bundle/site-packages/jnius_config.pyc
_python_bundle/site-packages/six.pyc
_python_bundle/site-packages/easy_install.pyc
_python_bundle/site-packages/usr/local/

Activity

  1. inclement commented on Oct 13, 2019

    @inclement
    Member

    That's interesting and unintended. Not sure what's going on. What happens if you delete both the pyc and pyo and run python-for-android again?

  2. linuxrootok commented on Jan 12, 2023

    @linuxrootok

    same here,and then I rebuild , it works well.So perhaps,you can delete the pyc and pyo files and rebuild,I think it will be okay!

  3. misl6 commented on Jan 15, 2023

    @misl6
    Member

    Hi @linuxrootok !

    Since support for pyo files (and Python 2) has been removed, can you please post the full log of the issue you encountered?

  4. moved this to Needs Triage in Kivy's Control Toweron Jan 15, 2023
  5. Julian-O commented on Nov 19, 2023

    @Julian-O
    Contributor

    Closing as Can't Repro.

  6. moved this from Needs Triage to Done in Kivy's Control Toweron Nov 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions