This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author christian.heimes
Recipients JosephArmbruster, astrand, christian.heimes, joearmbruster
Date 2007-11-21.08:14:30
SpamBayes Score 0.08471212
Marked as misclassified No
Message-id <1195632870.59.0.91473843.issue1475@psf.upfronthosting.co.za>
In-reply-to
Content
In Python 3.x os.popen is implemented based on subprocess. I believe
it's still a problem with subprocess. Python 3.x also drops support for
Windows 95 to ME. Would the additional quoting be ok when the code
checks for COMPSPEC == "cmd.exe" first?

# Supply os.popen()
def popen(cmd, mode="r", buffering=None):
    if not isinstance(cmd, str):
        raise TypeError("invalid cmd type (%s, expected string)" %
type(cmd))
    if mode not in ("r", "w"):
        raise ValueError("invalid mode %r" % mode)
    import subprocess, io
    if mode == "r":
        proc = subprocess.Popen(cmd,
                                shell=True,
                                stdout=subprocess.PIPE,
                                bufsize=buffering)
        return _wrap_close(io.TextIOWrapper(proc.stdout), proc)
    else:
        proc = subprocess.Popen(cmd,
                                shell=True,
                                stdin=subprocess.PIPE,
                                bufsize=buffering)
        return _wrap_close(io.TextIOWrapper(proc.stdin), proc)
History
Date User Action Args
2007-11-21 08:14:30christian.heimessetspambayes_score: 0.0847121 -> 0.08471212
recipients: + christian.heimes, astrand, joearmbruster, JosephArmbruster
2007-11-21 08:14:30christian.heimessetspambayes_score: 0.0847121 -> 0.0847121
messageid: <1195632870.59.0.91473843.issue1475@psf.upfronthosting.co.za>
2007-11-21 08:14:30christian.heimeslinkissue1475 messages
2007-11-21 08:14:30christian.heimescreate