[SciPy-user] Problem with Weave

eric jones eric at enthought.com
Mon Jul 12 01:49:11 CDT 2004

Hey Bob,

The docs are seriously out of date.  Sorry about that.

Much of the crud that you used to need for handling C++->Python type 
conversions is now gone.  Here is how I wrote your example:

C:\Documents and Settings\eric>python
Enthought Edition build 1057
Python 2.3.3 (#51, Feb 16 2004, 04:07:52) [MSC v.1200 32 bit (Intel)] on 
Type "help", "copyright", "credits" or "license" for more information.
 >>> import weave
 >>> a=1
 >>> a=weave.inline("return_val=a+1;",['a'])
file changed
No module named msvccompiler in scipy_distutils, trying from distutils..
No module named msvccompiler in scipy_distutils, trying from distutils..
Missing compiler_cxx fix for MSVCCompiler
 >>> a

The output is quite verbose now (too verbose), but the amount of code 
you need to write is less.  The weave/examples files (weave will be 
installed in your site-packages directory) generally have been updated 
to the new syntax and will provide some help.  Also, if you are a C++ 
person, then looking at the weave/scxx/object.h file will give some 
hints as to what is going on.

see ya,

Bob.Cowdery at CGI-Europe.com wrote:

> I am about to convert some python code to 'C' so am going through the 
> Weave documentation. I can get most things to work except returning 
> values from the 'C' code. I would guess the correct libraries are not 
> getting into the compile but I don't know how to fix it. I can compile 
> and run any 'C' code fine until I use any of the Py:: classes.
> As an example if I type:
>>>> import weave 
>>>> a=1
>>>> a=weave.inline("return_val = 
> Py::new_reference_to(Py::Int(a+1));",['a'], verbose=2)
> this gives me:
> file changed
> running build_ext
> building 'sc_5b09eaf68ff529a1fbaedc892ca5a4531' extension
> C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\cl.exe /c 
> /nologo /Ox /MD /W3 /GX -IC:\Python22\lib\site-packages\weave 
> -IC:\Python22\lib\site-packages\weave\scxx -IC:\Python22\include 
> /TpC:\DOCUME~1\cowderyb\LOCALS~1\Temp\CowderyB\python22_compiled\sc_5b09eaf68ff529a1fbaedc892ca5a4531.cpp 
> /FoC:\DOCUME~1\cowderyb\LOCALS~1\Temp\CowderyB\python22_intermediate\compiler_ba943cc959c75c0df25fd4c114ec382f\Release\sc_5b09eaf68ff529a1fbaedc892ca5a4531.obj
> Traceback (most recent call last):
>   File "<input>", line 1, in ?
>   File "C:\Python22\lib\site-packages\weave\inline_tools.py", line 
> 335, in inline
>     auto_downcast = auto_downcast,
>   File "C:\Python22\lib\site-packages\weave\inline_tools.py", line 
> 439, in compile_function
>     verbose=verbose, **kw)
>   File "C:\Python22\lib\site-packages\weave\ext_tools.py", line 340, 
> in compile
>     verbose = verbose, **kw)
>   File "C:\Python22\lib\site-packages\weave\build_tools.py", line 272, 
> in build_extension
>     setup(name = module_name, ext_modules = [ext],verbose=verb)
>   File "C:\Python22\lib\site-packages\scipy_distutils\core.py", line 
> 42, in setup
>     return old_setup(**new_attr)
>   File "C:\Python22\lib\distutils\core.py", line 157, in setup
>     raise SystemExit, "error: " + str(msg)
> CompileError: error: command '"C:\Program Files\Microsoft Visual 
> Studio .NET 2003\Vc7\bin\cl.exe"' failed with exit status 2
> Any help appreciated.
> Thanks
> Bob
> Bob Cowdery
> CGI Senior Technical Architect
> +44(0)1438 791517
> Mobile: +44(0)7771 532138
> bob.cowdery at cgi-europe.com <mailto:bob.cowdery at cgi-europe.com>
> **** Confidentiality Notice **** Proprietary/Confidential
> Information belonging to CGI Group Inc. and its affiliates
> may be contained in this message. If you are not a recipient
> indicated or intended in this message (or responsible for
> delivery of this message to such person), or you think for
> any reason that this message may have been addressed to you
> in error, you may not use or copy or deliver this message
> to anyone else.  In such case, you should destroy this
> message and are asked to notify the sender by reply email.
>SciPy-user mailing list
>SciPy-user at scipy.net

More information about the SciPy-user mailing list