[Python-Dev] test_cmd_line on Windows

Walter Dörwald walter at livinglogic.de
Tue Nov 22 14:13:56 CET 2005


A.B., Khalid wrote:

> Currently test_directories of test_cmd_line fails on the latest Python 2.4.2 
> from svn branch and from the svn head. The reason it seems is that the test 
> assumes that the local language of Windows is English and so tries to find 
> the string " denied" in the returned system error messages of the commands
> ("python .") and ("python < .").
> 
> But while it is true that the first command ("python .") does return an 
> English string error message even on so-called non-English versions of 
> Windows, the same does not seem to be true for the second command ("python < 
> ."), which seems to return a locale-related string error message. And since 
> the latter test is looking for the English " denied" in a non-English 
> language formated string, the test fails in non-English versions of Windows.

Does the popen2.popen4() used by the test provide return values of the 
execute command?

Using os.system() instead seems to provide enough information:

On Windows:

Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on 
win32
Type "help", "copyright", "credits" or "license" for more information.
 >>> import os
 >>> os.system("python < .")
Zugriff verweigert
1
 >>> os.system("python <NUL:")
Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on 
win32
Type "help", "copyright", "credits" or "license" for more information.
 >>>
0
 >>>

On Linux:

Python 2.4.2 (#1, Oct  3 2005, 15:51:22)
[GCC 3.3.5 (Debian 1:3.3.5-13)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> import os
 >>> os.system("python < .")
35584
 >>> os.system("python < /dev/null")
0

Can you provide a patch to test_cmd_line.py?

Bye,
    Walter Dörwald


More information about the Python-Dev mailing list