Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(124)  |  Call(119)  |  Derive(0)  |  Import(5)
return unicode output of executing 'cmd' in a separate process.

raise cmdexec.Error exeception if the command failed.
the exception will provide an 'err' attribute containing
the error-output from the command.
if the subprocess module does not provide a proper encoding/unicode strings
sys.getdefaultencoding() will be used, if that does not exist, 'UTF-8'.

        def cmdexec(cmd):
    """ return unicode output of executing 'cmd' in a separate process.

    raise cmdexec.Error exeception if the command failed.
    the exception will provide an 'err' attribute containing
    the error-output from the command.
    if the subprocess module does not provide a proper encoding/unicode strings
    sys.getdefaultencoding() will be used, if that does not exist, 'UTF-8'.
    """
    process = subprocess.Popen(cmd, shell=True,
            universal_newlines=True,
            stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    out, err = process.communicate()
    if sys.version_info[0] < 3: # on py3 we get unicode strings, on py2 not
        try:
            default_encoding = sys.getdefaultencoding() # jython may not have it
        except AttributeError:
            default_encoding = sys.stdout.encoding or 'UTF-8'
        out = unicode(out, process.stdout.encoding or default_encoding)
        err = unicode(err, process.stderr.encoding or default_encoding)
    status = process.poll()
    if status:
        raise ExecutionFailed(status, status, cmd, out, err)
    return out
        


src/p/y/pytest-2.5.2/doc/ja/example/multipython.py   pytest(Download)
            f.close()
        """ % (str(self.picklefile), obj)))
        py.process.cmdexec("%s %s" %(self.pythonpath, dumpfile))
 
    def load_and_is_true(self, expression):
        """ % (str(self.picklefile), expression)))
        print (loadfile)
        py.process.cmdexec("%s %s" %(self.pythonpath, loadfile))
 

src/p/y/pytest-2.5.2/doc/en/example/multipython.py   pytest(Download)
            f.close()
        """ % (str(self.picklefile), obj)))
        py.process.cmdexec("%s %s" %(self.pythonpath, dumpfile))
 
    def load_and_is_true(self, expression):
        """ % (str(self.picklefile), expression)))
        print (loadfile)
        py.process.cmdexec("%s %s" %(self.pythonpath, loadfile))
 
@pytest.mark.parametrize("obj", [42, {}, {1:3},])

src/e/x/execnet-1.2.0/doc/example/svn-sync-repo.py   execnet(Download)
def get_svn_youngest(repo):
    rev = py.process.cmdexec('svnlook youngest "%s"' % repo)
    return int(rev)
 
def getgateway(host, configfile=None):

src/p/l/plexnet-HEAD/third_party/generic/pypy/py/rest/convert.py   plexnet(Download)
    try:
        eps = ps.new(ext=".eps")
        py.process.cmdexec('ps2epsi "%s" "%s"' % (ps, eps))
    except ExecutionFailed:
        py.process.cmdexec('ps2eps -l -f "%s"' % ps)
           '"-sOutputFile=%(outfile)s" %(OPTIONS)s -c .setpdfwrite '
           '-f "%(infile)s"') % options
    py.process.cmdexec(cmd)
    return pdf
 
def eps2pdf(eps):
    # XXX write a pure python version
    if not py.path.local.sysfind("epstopdf"):
        raise SystemExit("ERROR: epstopdf not found")
    py.process.cmdexec('epstopdf "%s"' % eps)
    if not py.path.local.sysfind("dvips"):
        raise SystemExit("ERROR: dvips not found")
    py.process.cmdexec(command)
 
def convert_dot(fn, new_extension):

src/p/l/plexnet-HEAD/third_party/generic/pypy/pypy/doc/tool/mydot.py   plexnet(Download)
    tex.write(texcontent)
 
    epscontent = py.process.cmdexec("dot -Tps %s" % (tempdot, ))
    eps.write(re.sub("\n\[.*\]\nxshow", "\nshow", epscontent))
    return tex, eps
    oldpath = dot.dirpath()
    dvi.dirpath().chdir()
    py.process.cmdexec("latex %s" % (tex, ))
    py.process.cmdexec("dvips -E -o %s %s" % (output, dvi))
    oldpath.chdir()
    elif options.format == "png":
        png = epsfile.new(ext="png")
        py.process.cmdexec("convert %s %s" % (epsfile, png))
        print png.read()
 

src/p/l/plexnet-HEAD/third_party/generic/pypy/pypy/rlib/parsing/deterministic.py   plexnet(Download)
        plainpath = p.new(ext="plain")
        try:
            py.process.cmdexec("neato -Tplain %s > %s" % (p, plainpath))
        except py.error.Error:
            py.process.cmdexec("fdp -Tplain %s > %s" % (p, plainpath))
        try:
            try:
                py.process.cmdexec("neato -Tplain %s > %s" % (p, plainpath))
            except py.error.Error:
                py.process.cmdexec("fdp -Tplain %s > %s" % (p, plainpath))
        except py.error.Error:
            p.write(
                dot.replace("graph G {", "digraph G {").replace(" -- ", " -> "))
            py.process.cmdexec("dot -Tplain %s > %s" % (p, plainpath))

src/p/l/plexnet-HEAD/third_party/generic/pypy/py/misc/svnlook.py   plexnet(Download)
def changed(repo, revision):
    out = py.process.cmdexec("svnlook changed -r %s %s" %(revision, repo))
    l = []
    for line in out.strip().split('\n'):
        l.append(ChangeItem(repo, revision, line))
    return l
 
def author(repo, revision):         
    out = py.process.cmdexec("svnlook author -r %s %s" %(revision, repo))
def youngest(repo): 
    out = py.process.cmdexec("svnlook youngest %s" %(repo,))
    return int(out) 
 

src/p/l/plexnet-HEAD/third_party/generic/pypy/py/path/svn/wccommand.py   plexnet(Download)
                hold = os.environ.get(key)
                os.environ[key] = 'C'
                out = py.process.cmdexec(string)
            finally:
                if hold:
    def copy(self, target):
        """ copy path to target."""
        py.process.cmdexec("svn copy %s %s" %(str(self), str(target)))
 
    def rename(self, target):
        """ rename this path to target. """
        py.process.cmdexec("svn move --force %s %s" %(str(self), str(target)))

src/p/l/plexnet-HEAD/third_party/generic/pypy/pypy/translator/tool/cbuild.py   plexnet(Download)
            # we raise ImportError to be nice to the pypy.config.pypyoption
            # logic of skipping modules depending on non-installed libs
        cflags = py.process.cmdexec('"%s" --cflags' % (str(path),))
        eci1 = cls.from_compiler_flags(cflags)
        libs = py.process.cmdexec('"%s" --libs' % (str(path),))

src/s/y/Sypy-HEAD/doc/tool/mydot.py   Sypy(Download)
    tex.write(texcontent)
 
    epscontent = py.process.cmdexec("dot -Tps %s" % (tempdot, ))
    eps.write(re.sub("\n\[.*\]\nxshow", "\nshow", epscontent))
    return tex, eps
    oldpath = dot.dirpath()
    dvi.dirpath().chdir()
    py.process.cmdexec("latex %s" % (tex, ))
    py.process.cmdexec("dvips -E -o %s %s" % (output, dvi))
    oldpath.chdir()
    elif options.format == "png":
        png = epsfile.new(ext="png")
        py.process.cmdexec("convert %s %s" % (epsfile, png))
        print png.read()
 

  1 | 2 | 3 | 4 | 5 | 6  Next