当前位置: 首页>>代码示例>>Python>>正文


Python subprocess.PIPE属性代码示例

本文整理汇总了Python中matplotlib.compat.subprocess.PIPE属性的典型用法代码示例。如果您正苦于以下问题:Python subprocess.PIPE属性的具体用法?Python subprocess.PIPE怎么用?Python subprocess.PIPE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在matplotlib.compat.subprocess的用法示例。


在下文中一共展示了subprocess.PIPE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: checkdep_ghostscript

# 需要导入模块: from matplotlib.compat import subprocess [as 别名]
# 或者: from matplotlib.compat.subprocess import PIPE [as 别名]
def checkdep_ghostscript():
    if sys.platform == 'win32':
        gs_execs = ['gswin32c', 'gswin64c', 'gs']
    else:
        gs_execs = ['gs']
    for gs_exec in gs_execs:
        try:
            s = subprocess.Popen(
                [gs_exec, '--version'], stdout=subprocess.PIPE,
                stderr=subprocess.PIPE)
            stdout, stderr = s.communicate()
            if s.returncode == 0:
                v = byte2str(stdout[:-1])
                return gs_exec, v
        except (IndexError, ValueError, OSError):
            pass
    return None, None 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:19,代码来源:__init__.py

示例2: get_fontconfig_fonts

# 需要导入模块: from matplotlib.compat import subprocess [as 别名]
# 或者: from matplotlib.compat.subprocess import PIPE [as 别名]
def get_fontconfig_fonts(fontext='ttf'):
    """
    Grab a list of all the fonts that are being tracked by fontconfig
    by making a system call to ``fc-list``.  This is an easy way to
    grab all of the fonts the user wants to be made available to
    applications, without needing knowing where all of them reside.
    """
    fontext = get_fontext_synonyms(fontext)

    fontfiles = {}
    try:
        pipe = subprocess.Popen(['fc-list', '', 'file'], stdout=subprocess.PIPE)
        output = pipe.communicate()[0]
    except OSError, IOError:
        # Calling fc-list did not work, so we'll just return nothing
        return fontfiles 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:18,代码来源:font_manager.py

示例3: dvipng_hack_alpha

# 需要导入模块: from matplotlib.compat import subprocess [as 别名]
# 或者: from matplotlib.compat.subprocess import PIPE [as 别名]
def dvipng_hack_alpha():
    try:
        p = Popen(['dvipng', '-version'], stdin=PIPE, stdout=PIPE,
                  stderr=STDOUT, close_fds=(sys.platform != 'win32'))
    except OSError:
        mpl.verbose.report('No dvipng was found', 'helpful')
        return False
    stdin, stdout = p.stdin, p.stdout
    for line in stdout:
        if line.startswith(b'dvipng '):
            version = line.split()[-1]
            mpl.verbose.report('Found dvipng version %s' % version,
                               'helpful')
            version = version.decode('ascii')
            version = distutils.version.LooseVersion(version)
            return version < distutils.version.LooseVersion('1.6')
    mpl.verbose.report('Unexpected response from dvipng -version', 'helpful')
    return False 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:20,代码来源:texmanager.py

示例4: gs_version

# 需要导入模块: from matplotlib.compat import subprocess [as 别名]
# 或者: from matplotlib.compat.subprocess import PIPE [as 别名]
def gs_version(self):
        """
        version of ghostscript.
        """
        try:
            return self._cached["gs_version"]
        except KeyError:
            pass

        from matplotlib.compat.subprocess import Popen, PIPE
        pipe = Popen(self.gs_exe + " --version",
                     shell=True, stdout=PIPE).stdout
        if sys.version_info[0] >= 3:
            ver = pipe.read().decode('ascii')
        else:
            ver = pipe.read()
        gs_version = tuple(map(int, ver.strip().split(".")))

        self._cached["gs_version"] = gs_version
        return gs_version 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:22,代码来源:backend_ps.py

示例5: checkdep_ghostscript

# 需要导入模块: from matplotlib.compat import subprocess [as 别名]
# 或者: from matplotlib.compat.subprocess import PIPE [as 别名]
def checkdep_ghostscript():
    if sys.platform == 'win32':
        gs_execs = ['gswin32c', 'gswin64c', 'gs']
    else:
        gs_execs = ['gs']
    for gs_exec in gs_execs:
        try:
            s = subprocess.Popen(
                [gs_exec, '--version'], stdout=subprocess.PIPE,
                stderr=subprocess.PIPE)
            stdout, stderr = s.communicate()
            if s.returncode == 0:
                v = stdout[:-1].decode('ascii')
                return gs_exec, v
        except (IndexError, ValueError, OSError):
            pass
    return None, None 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:19,代码来源:__init__.py

示例6: fc_match

# 需要导入模块: from matplotlib.compat import subprocess [as 别名]
# 或者: from matplotlib.compat.subprocess import PIPE [as 别名]
def fc_match(pattern, fontext):
        fontexts = get_fontext_synonyms(fontext)
        ext = "." + fontext
        try:
            pipe = subprocess.Popen(
                ['fc-match', '-s', '--format=%{file}\\n', pattern],
                stdout=subprocess.PIPE,
                stderr=subprocess.PIPE)
            output = pipe.communicate()[0]
        except (OSError, IOError):
            return None

        # The bulk of the output from fc-list is ascii, so we keep the
        # result in bytes and parse it as bytes, until we extract the
        # filename, which is in sys.filesystemencoding().
        if pipe.returncode == 0:
            for fname in output.split(b'\n'):
                try:
                    fname = six.text_type(fname, sys.getfilesystemencoding())
                except UnicodeDecodeError:
                    continue
                if os.path.splitext(fname)[1][1:] in fontexts:
                    return fname
        return None 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:26,代码来源:font_manager.py

示例7: dvipng_hack_alpha

# 需要导入模块: from matplotlib.compat import subprocess [as 别名]
# 或者: from matplotlib.compat.subprocess import PIPE [as 别名]
def dvipng_hack_alpha():
    try:
        p = Popen(['dvipng', '-version'], stdin=PIPE, stdout=PIPE,
                  stderr=STDOUT, close_fds=(sys.platform != 'win32'))
        stdout, stderr = p.communicate()
    except OSError:
        mpl.verbose.report('No dvipng was found', 'helpful')
        return False
    lines = stdout.decode('ascii').split('\n')
    for line in lines:
        if line.startswith('dvipng '):
            version = line.split()[-1]
            mpl.verbose.report('Found dvipng version %s' % version,
                               'helpful')
            version = distutils.version.LooseVersion(version)
            return version < distutils.version.LooseVersion('1.6')
    mpl.verbose.report('Unexpected response from dvipng -version', 'helpful')
    return False 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:20,代码来源:texmanager.py

示例8: gs_version

# 需要导入模块: from matplotlib.compat import subprocess [as 别名]
# 或者: from matplotlib.compat.subprocess import PIPE [as 别名]
def gs_version(self):
        """
        version of ghostscript.
        """
        try:
            return self._cached["gs_version"]
        except KeyError:
            pass

        from matplotlib.compat.subprocess import Popen, PIPE
        s = Popen(self.gs_exe + " --version",
                     shell=True, stdout=PIPE)
        pipe, stderr = s.communicate()
        if six.PY3:
            ver = pipe.decode('ascii')
        else:
            ver = pipe
        try:
            gs_version = tuple(map(int, ver.strip().split(".")))
        except ValueError:
            # if something went wrong parsing return null version number
            gs_version = (0, 0)
        self._cached["gs_version"] = gs_version
        return gs_version 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:26,代码来源:backend_ps.py

示例9: check_for

# 需要导入模块: from matplotlib.compat import subprocess [as 别名]
# 或者: from matplotlib.compat.subprocess import PIPE [as 别名]
def check_for(texsystem):
    header = """
    \\documentclass{minimal}
    \\usepackage{pgf}
    \\begin{document}
    \\typeout{pgfversion=\\pgfversion}
    \\makeatletter
    \\@@end
    """
    try:
        latex = subprocess.Popen(["xelatex", "-halt-on-error"],
                                 stdin=subprocess.PIPE,
                                 stdout=subprocess.PIPE)
        stdout, stderr = latex.communicate(header.encode("utf8"))
    except OSError:
        return False

    return latex.returncode == 0 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:20,代码来源:test_backend_pgf.py

示例10: verify

# 需要导入模块: from matplotlib.compat import subprocess [as 别名]
# 或者: from matplotlib.compat.subprocess import PIPE [as 别名]
def verify(filename):
    """Verify the file through some sort of verification tool."""
    if not os.path.exists(filename):
        raise IOError("'%s' does not exist" % filename)
    base, extension = filename.rsplit('.', 1)
    verifier = verifiers.get(extension, None)
    if verifier is not None:
        cmd = verifier(filename)
        pipe = subprocess.Popen(
            cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        stdout, stderr = pipe.communicate()
        errcode = pipe.wait()
        if errcode != 0:
            msg = "File verification command failed:\n%s\n" % ' '.join(cmd)
            if stdout:
                msg += "Standard output:\n%s\n" % stdout
            if stderr:
                msg += "Standard error:\n%s\n" % stderr
            raise IOError(msg) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:21,代码来源:compare.py

示例11: checkdep_ghostscript

# 需要导入模块: from matplotlib.compat import subprocess [as 别名]
# 或者: from matplotlib.compat.subprocess import PIPE [as 别名]
def checkdep_ghostscript():
    if checkdep_ghostscript.executable is None:
        if sys.platform == 'win32':
            # mgs is the name in miktex
            gs_execs = ['gswin32c', 'gswin64c', 'mgs', 'gs']
        else:
            gs_execs = ['gs']
        for gs_exec in gs_execs:
            try:
                s = subprocess.Popen(
                    [str(gs_exec), '--version'], stdout=subprocess.PIPE,
                    stderr=subprocess.PIPE)
                stdout, stderr = s.communicate()
                if s.returncode == 0:
                    v = stdout[:-1].decode('ascii')
                    checkdep_ghostscript.executable = gs_exec
                    checkdep_ghostscript.version = v
            except (IndexError, ValueError, OSError):
                pass
    return checkdep_ghostscript.executable, checkdep_ghostscript.version 
开发者ID:alvarobartt,项目名称:twitter-stock-recommendation,代码行数:22,代码来源:__init__.py

示例12: checkdep_inkscape

# 需要导入模块: from matplotlib.compat import subprocess [as 别名]
# 或者: from matplotlib.compat.subprocess import PIPE [as 别名]
def checkdep_inkscape():
    if checkdep_inkscape.version is None:
        try:
            s = subprocess.Popen([str('inkscape'), '-V'],
                                 stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE)
            stdout, stderr = s.communicate()
            lines = stdout.decode('ascii').split('\n')
            for line in lines:
                if 'Inkscape' in line:
                    v = line.split()[1]
                    break
            checkdep_inkscape.version = v
        except (IndexError, ValueError, UnboundLocalError, OSError):
            pass
    return checkdep_inkscape.version 
开发者ID:alvarobartt,项目名称:twitter-stock-recommendation,代码行数:18,代码来源:__init__.py

示例13: dvipng_hack_alpha

# 需要导入模块: from matplotlib.compat import subprocess [as 别名]
# 或者: from matplotlib.compat.subprocess import PIPE [as 别名]
def dvipng_hack_alpha():
    try:
        p = Popen([str('dvipng'), '-version'], stdin=PIPE, stdout=PIPE,
                  stderr=STDOUT, close_fds=(sys.platform != 'win32'))
        stdout, stderr = p.communicate()
    except OSError:
        _log.info('No dvipng was found')
        return False
    lines = stdout.decode(sys.getdefaultencoding()).split('\n')
    for line in lines:
        if line.startswith('dvipng '):
            version = line.split()[-1]
            _log.info('Found dvipng version %s', version)
            version = distutils.version.LooseVersion(version)
            return version < distutils.version.LooseVersion('1.6')
    _log.info('Unexpected response from dvipng -version')
    return False 
开发者ID:alvarobartt,项目名称:twitter-stock-recommendation,代码行数:19,代码来源:texmanager.py

示例14: gs_version

# 需要导入模块: from matplotlib.compat import subprocess [as 别名]
# 或者: from matplotlib.compat.subprocess import PIPE [as 别名]
def gs_version(self):
        """
        version of ghostscript.
        """
        try:
            return self._cached["gs_version"]
        except KeyError:
            pass

        from matplotlib.compat.subprocess import Popen, PIPE
        s = Popen([self.gs_exe, "--version"], stdout=PIPE)
        pipe, stderr = s.communicate()
        if six.PY3:
            ver = pipe.decode('ascii')
        else:
            ver = pipe
        try:
            gs_version = tuple(map(int, ver.strip().split(".")))
        except ValueError:
            # if something went wrong parsing return null version number
            gs_version = (0, 0)
        self._cached["gs_version"] = gs_version
        return gs_version 
开发者ID:alvarobartt,项目名称:twitter-stock-recommendation,代码行数:25,代码来源:backend_ps.py

示例15: isAvailable

# 需要导入模块: from matplotlib.compat import subprocess [as 别名]
# 或者: from matplotlib.compat.subprocess import PIPE [as 别名]
def isAvailable(cls):
        '''
        Check to see if a MovieWriter subclass is actually available by
        running the commandline tool.
        '''
        bin_path = cls.bin_path()
        if not bin_path:
            return False
        try:
            p = subprocess.Popen(
                bin_path,
                shell=False,
                stdout=subprocess.PIPE,
                stderr=subprocess.PIPE,
                creationflags=subprocess_creation_flags)
            return cls._handle_subprocess(p)
        except OSError:
            return False 
开发者ID:alvarobartt,项目名称:twitter-stock-recommendation,代码行数:20,代码来源:animation.py


注:本文中的matplotlib.compat.subprocess.PIPE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。