[issue3748] [py3k] platform.architecture() prints vogus messege on windows

Hirokazu Yamamoto report at bugs.python.org
Mon Sep 1 14:03:08 CEST 2008


Hirokazu Yamamoto <ocean-city at m2.ccsnet.ne.jp> added the comment:

This difference between trunk and py3k would go down to this.

import os
os.popen(r'file e:\python-dev\py3k\PC\VC6\python_d.exe 2> /dev/null')

trunk prints nothing, but py3k prints that message.

I don't know which is popen's correct behavior, we can supress this
message by using subprocess.Popen instead.

Index: Lib/platform.py
===================================================================
--- Lib/platform.py     (revision 66090)
+++ Lib/platform.py     (working copy)
@@ -110,7 +110,7 @@

 __version__ = '1.0.6'

-import sys, os, re
+import sys, os, re, subprocess

 ### Platform specific APIs

@@ -942,7 +942,7 @@
     """
     target = _follow_symlinks(target)
     try:
-        f = os.popen('file %s 2> /dev/null' % target)
+        f = subprocess.Popen('file %s 2> /dev/null' % target,
stdout=subprocess
.PIPE, stderr=subprocess.PIPE).stdout
     except (AttributeError,os.error):
         return default
     output = f.read().strip()

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3748>
_______________________________________


More information about the Python-bugs-list mailing list