Skip to content

python subprocess call system command error #188

@xunwumizhi

Description

@xunwumizhi
Image
    command = [        
        'echo',
        'hello world',
    ]
    try:
        result = subprocess.run(
            command,
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            check=True,
            text=True
        )
        msg = f"code: {result.returncode}, stdout:{result.stdout}, stderr:{result.stderr}"
    except Exception as e:
        msg = f"exception: {e}"
    print(msg)
    return {
        "result": msg,
    }

got error:

"exception: Command '['echo', 'hello world']' died with <Signals.SIGSYS: 31>."

i had add echo(/usr/bin/echo) command to python lib path (/var/sandbox/python-sandbox/usr/bin/echo)

python_lib_path:
  # external libraries
  - /usr/bin/ffmpeg # will add /usr/bin path
  - /usr/share/ffmpeg

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