[SciPy-Dev] request for testing: SciPy 0.7.2 RC1 + NumPy 1.4.1 RC1

Ralf Gommers ralf.gommers@googlemail....
Wed Apr 7 09:40:24 CDT 2010


On Wed, Apr 7, 2010 at 10:03 AM, Bruce Southey <bsouthey@gmail.com> wrote:

> On Mon, Apr 5, 2010 at 10:08 PM, Alan G Isaac <aisaac@american.edu> wrote:
> > Python 2.6.5 (32bit) on Vista (64bit), no gcc.
> > Alan Isaac
> >
> [snip]
> > 'gcc' is not recognized as an internal or external command,
> > operable program or batch file.
>
> These are from the weave tests from running ' scipy.weave.test()' with
> some of the message coming from the file
> test_numpy_scalar_spec.py
>
> I can reproduce the window on my system by running under IDLE:
> >>>from scipy.weave.build_tools import msvc_exists, gcc_exists
>
>
> There is no problem with
> >>> msvc_exists()
> 0
>
> >>>gcc_exists()
> False
> >>>
> >From the command line it gives:
> >>>gcc_exists()
> 'gcc' is not recognized as an internal or external command,
> operable program or batch file.
> False
>
>
> Trying the associated code:
> >>> import subprocess
> >>> name='gcc'
> >>> cmd=[str(name), '-v']
> >>> cmd
> ['gcc', '-v']
> >>> subprocess.Popen(cmd, True, stdout=subprocess.PIPE,
> stderr=subprocess.STDOUT)
>
> Traceback (most recent call last):
>   File "<pyshell#31>", line 1, in <module>
>    subprocess.Popen(cmd, True, stdout=subprocess.PIPE,
> stderr=subprocess.STDOUT)
>  File "E:\Python26\lib\subprocess.py", line 621, in __init__
>    errread, errwrite)
>  File "E:\Python26\lib\subprocess.py", line 830, in _execute_child
>    startupinfo)
> WindowsError: [Error 2] The system cannot find the file specified
> >>>
>
> So apparently the exception is not being caught.
>
> Hmm, that is some ugly code. First of all it doesn't actually work:

>>> gcc_exists()
0
>>> p = subprocess.Popen(cmd, True, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
>>> str_result = p.stdout.read()
>>> str_result
'Using built-in specs.\nTarget: i686-apple-darwin10\nConfigured with:
/var/tmp/gcc/gcc-5646~6/src/configure --disable-checking --enable-werror
--prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++
--program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib
--build=i686-apple-darwin10 --with-gxx-include-dir=/include/c++/4.2.1
--program-prefix=i686-apple-darwin10- --host=x86_64-apple-darwin10
--target=i686-apple-darwin10\nThread model: posix\ngcc version 4.2.1 (Apple
Inc. build 5646)\n'
>>> 'Reading specs' in str_result
False

Then, I assume the True argument is meant as shell=True, not bufsize=True.
Can you specify shell=True and see if that fixes it? If not I think it must
be a Python bug, a blanket except statement not catching an exception should
be impossible.

The quick and dirty way to fix it would be to reuse the os.system call,
would fix both the exception and the function itself:

def gcc_exists(name = 'gcc'):
    """ Test to make sure gcc is found."""
    result = 0
    cmd = [str(name), '-v']
    result = not os.system(''.join(cmd))
    return result

Cheers,
Ralf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-dev/attachments/20100407/19beaf71/attachment.html 


More information about the SciPy-Dev mailing list