[SciPy-user] extra_compile_args in weave

Christopher Fonnesbeck chris at fonnesbeck.org
Sun Feb 8 13:15:01 CST 2004


I am trying to write a GRASS GIS module (ANSI C) using weave.inline, so  
that I can interface my python simulation code with a GIS to get  
spatial information. As such, I need some GRASS header files. However,  
I am having trouble setting the GRASS include directory for weave. Here  
is a very simple example that simply initializes the GIS:

import os,weave

'Set GRASS environment variables'
os.putenv('GISBASE','/usr/local/grass57')
os.putenv('GISRC','$HOME/.grassrc57')
os.putenv('PATH','$PATH:$GISBASE/bin:$GISBASE/scripts')

def test(foo):

	code = """
	#include "gis.h"
	#include <stdio.h>
	#include <string.h>
	#include <math.h>
	
	G_gisinit(argv[0]);
	
	return foo;
	
	"""
	
	weave.inline(code,[foo],
		extra_compile_args=["-I/usr/local/grass57/include"])
		
if __name__=='__main__':

	test(3)


However, when I run this, I get:

Traceback (most recent call last):
   File "grasstest.py", line 27, in ?
     test(3)
   File "grasstest.py", line 23, in test
     extra_compile_args=["-I/usr/local/grass57/include"])
   File  
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
python2.3/site-packages/weave/inline_tools.py", line 335, in inline
     auto_downcast = auto_downcast,
   File  
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
python2.3/site-packages/weave/inline_tools.py", line 421, in  
compile_function
     type_converters = type_converters)
   File  
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
python2.3/site-packages/weave/ext_tools.py", line 176, in __init__
     auto_downcast, type_converters)
   File  
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
python2.3/site-packages/weave/ext_tools.py", line 391, in  
assign_variable_types
     errors[var] = ("The type and dimensionality specifications" +
TypeError: cannot concatenate 'str' and 'int' objects


It doesnt seem to like the extra_compile_args. How else am I to set  
this include directory?

Thanks,
Chris
--
Christopher J. Fonnesbeck ( c h r i s @ f o n n e s b e c k . o r g )
Georgia Cooperative Fish & Wildlife Research Unit, University of Georgia



More information about the SciPy-user mailing list