Skip to content

FileNotFoundError '/bin/sh' with subprocess.py python3crystax #691

@haricot

Description

@haricot

the error occurs when a try use subprocess with python3crystax

I/python  (24626): Traceback (most recent call last):
I/python  (24626):   File "main.py", line 36, in <module>
I/python  (24626):     ctypes.util.find_library('SDL2')
I/python  (24626):   File "/data/data/org.hello.world/files/crystax_python/stdlib.zip/ctypes/util.py", line 239, in find_library
I/python  (24626):   File "/data/data/org.hello.world/files/crystax_python/stdlib.zip/ctypes/util.py", line 103, in _findLib_gcc
I/python  (24626):   File "/data/data/org.hello.world/files/crystax_python/stdlib.zip/os.py", line 991, in popen
I/python  (24626):   File "/data/data/org.hello.world/files/crystax_python/stdlib.zip/subprocess.py", line 950, in __init__
I/python  (24626):   File "/data/data/org.hello.world/files/crystax_python/stdlib.zip/subprocess.py", line 1540, in _execute_child
I/python  (24626): FileNotFoundError: [Errno 2] No such file or directory: '/bin/sh'
I/python  (24626): Python for android ended.

it works by modifying the file in subprocess.py stdlib.zip
/.local/share/python-for-android/dists/testproject/crystax_python/crystax_python/stdlib.zip
subprocess.py

if shell:
                args = ["/bin/sh", "-c"] + args
                if executable:
                    args[0] = executable

            if executable is None:

to

if shell:
                args = ["/system/bin/sh", "-c"] + args
                if executable:
                    args[0] = executable

            if executable is None:

it does not look simple to modify the subprocess.py variables of permanent way by passing it through a script.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions