Skip to content

exitcode#57

Closed
jjhesk wants to merge 2 commits intoextrabacon:masterfrom
msanand:master
Closed

exitcode#57
jjhesk wants to merge 2 commits intoextrabacon:masterfrom
msanand:master

Conversation

@jjhesk
Copy link

@jjhesk jjhesk commented Sep 25, 2016

No description provided.

@surfaceowl
Copy link

@extrabacon -- is this PR helpful? I have a process which exits with exitcode=0, but still emits PythonShell.parseError which I'd like to fix. I'm looking into why this is happening, perhaps we are writing something to stderr that should go to stdout.

@Almenon
Copy link
Collaborator

Almenon commented Jun 24, 2018

@surfaceowl I'm closing this PR - it does not fix anything.

The expected behavior is described in the readme:

An error will be thrown if the process exits with a non-zero exit code or if data has been written to stder

The PR changes the logic so that it only initializes the error depending on the exit code, but then how would the user find out what was written to stderr?

The error event is emitted in both cases - it is up to the user to decide how to handle it. If you want can put in code that ignores the error if the exitcode is equal to 0. Or fix it on the python side.

# logging.py
import logging

logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)

# all logs write to stderr by default
logger.info("yo")
logger.warning("warn")
logger.error("error")
logger.critical("oh noes!")
PythonShell.run('logging.py', function (err, results) {
  console.log(err) 
  // if desired we can ignore logs if err.exitCode == 0
});

Hopefully that helps :)

I'm curious - are you using python-shell for your surfaceOwl buisiness, or some other thing?

@Almenon Almenon closed this Jun 24, 2018
@surfaceowl
Copy link

@extrabacon -- thanks for your quick reply. I'll look into fixing the problem on the python side that is generating the warnings first. If it turns out my case is like the tensorflow situation in python-shell issue #113 , then I'll look at dropping those warnings or perhaps just redirecting warnings to stdout for visibility.

re: python-shell and surfaceOwl -- yes, we are using this

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

Successfully merging this pull request may close these issues.

4 participants