Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

process.Run 'int' object is not subscriptable #624

Open
adanaja opened this issue Aug 17, 2023 · 1 comment
Open

process.Run 'int' object is not subscriptable #624

adanaja opened this issue Aug 17, 2023 · 1 comment

Comments

@adanaja
Copy link
Contributor

adanaja commented Aug 17, 2023

In e3.os.process.Run, the parameter input can by of type PIPE_VALUE => -2

    def __init__(
        self,
        cmds: AnyCmdLine,
        cwd: str | None = None,
        output: STDOUT_VALUE | DEVNULL_VALUE | PIPE_VALUE | str | IO | None = PIPE,
        error: STDOUT_VALUE | DEVNULL_VALUE | PIPE_VALUE | str | IO | None = STDOUT,
        input: DEVNULL_VALUE  # noqa: A002
+       | PIPE_VALUE
        | str
        | bytes
        | IO
        | None = None,  # noqa: A002

Then we have:

        # First resolve output, error and input
+       self.input_file = File(input, "r")
        self.output_file = File(output, "w")

Then in File:

    def __init__(self, name: Any, mode: str = "r"):
+       self.name = name

        if isinstance(name, bytes) and mode == "r" and name.startswith(b"|"):
            self.fd = subprocess.PIPE
        elif isinstance(name, str):
            ...
        else:
            # this is a file descriptor
+           self.fd = name
        ...
        
    def get_command(self) -> str | None:
        """Return the command to run to create the pipe."""
        if self.fd == subprocess.PIPE:
+           return self.name[1:]
        else:
            return None

So when doing Run(..., input=PIPE), the error 'int' object is not subscriptable is raised

@Nikokrock
Copy link
Contributor

we don't support input=PIPE I think

leocardao added a commit to leocardao/e3-core that referenced this issue Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants