-
-
Notifications
You must be signed in to change notification settings - Fork 31
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.stderr.read() fails with NoneType #211
Comments
So, when I rerun the command that caused the initial error it looks like my OS kills it as it gobbles up too much memory. So I could see why this was not an error properly captured. I am not sure what the behaviour is here - is it the singularity process that is killed, or the parent python process that ultimately runs the subprocess? It must be just the singularity command otherwise I wouldn't get this stack trace. For some more context this particular error was raised with a prefect pipeline. So on my side are a few layers to unwrap. This might be a user error issue unrelated to spython. But I think perhaps the check for a non-None stderr could still be useful. |
I think likely what is happening is that the container (which is just akin to any running process) is killed one level up. Would it make sense to wrap this call in something to catch the error? So if I understand your fix, when this happens you see output to the stdout but not stderr? Isn't that the opposite of what we'd expect? |
So, as far as I can tell it is not related to #209 like I thought initially. It seems to be a case that in this particular failure more there is simply a case that |
I would be okay with some check for None (and a different outcome given this case). I don't think we want to take a preference on how to handle a specific try/catch, however. Let me know if that works for you. Your possible fix section above I think would be OK. |
Sorry for my delay in getting back to this. I have raised #212 as a fix for this. Any thoughts or comments? |
Expected Behavior
I think that this might be related to #209
I am running a container that contains a program that prints exclusively to the stderr. I added #209 to let a user tweak which stream to capture and print. Ideally this will simply print the stderr output as it becomes available.
Actual Behavior
I am not sure what the interplay between
subprocess.Popen(..., stderr=subprocess.STDOUT)
andprocess.stderr.read()
is. My reading of the docs (https://docs.python.org/3/library/subprocess.html) suggest that ifpreocess.stderr
is None then there was nothing captured.Maybe it is worth having a check to ensure that
stderr
is not None before attempting to print? I am not familiar with the finer details fo subprocess here to know.Steps to Reproduce
I am trying to come up with a reproducible example.
Context
[provide more detailed introduction to the issue itself . This is for make a reproducible issue.]
Failure Logs
Possible Fix
Perhaps something like
The text was updated successfully, but these errors were encountered: