process.Run 'int' object is not subscriptable
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 32
- Forks
- 36
- PR merge metrics
- No merged PRs in 30d
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at e3.os.process.Run and the File class, then reproduce the error with Run(..., input=PIPE). Verify that the input PIPE value no longer causes an integer-subscripting error and that the existing File handling remains consistent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100