[New-bugs-announce] [issue34216] python platform no child error

sachin report at bugs.python.org
Tue Jul 24 17:02:51 EDT 2018


New submission from sachin <sskamble619 at gmail.com>:

We are trying to utilize librosa library for some processing. When we try to load the librosa library, python platform library is triggered via the  Numba library. Numba is trying to find the underlying OS which is installed. Function "_syscmd_uname" is triggered to find out the underlying os, but in the above function the os.popen object which is opened to determine the OS , but when the object is closed it throws a no child process error. This is mainly due to the closure of the popen object before the close fuction is called. we can get around this problem 
by catching the error and returning a default value if the closing of the popen pipeline fails

python platform.py file

def _syscmd_uname(option, default=''):

    """ Interface to the system's uname command.
    """
    if sys.platform in ('dos', 'win32', 'win16'):
        # XXX Others too ?
        return default
    try:
        f = os.popen('uname %s 2> %s' % (option, DEV_NULL))
    except (AttributeError, OSError):
        return default
    output = f.read().strip()
    rc = f.close()  # error at this place enclose in a try except statement to catrch the exception
    if not output or rc:
        return default
    else:
return output

----------
components: Build
messages: 322330
nosy: sskamble619
priority: normal
severity: normal
status: open
title: python platform no child error
type: compile error
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34216>
_______________________________________


More information about the New-bugs-announce mailing list