I am trying to compile some inline c++ code inside python using weave.
I always get a similar problem where the compiled file cannot be found
(see below). I am not sure if the problem is with the compiler
or something else. I am a new user of scipy and a novice with python so
I would appreciate any direction someone can give me because I have not
been able to figure out a work around.

PS. I have also posted this on scipy list and have not received any feedback.

Thank you,
Michael

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
I have the following related applications installed:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Python:
2.4.1 (I am using an older version because this is what ESRI GIS application 
 supports)
 
Scipy:
scipy-0.6.0.win32-py2.4.exe

MinGW:
MinGW-5.1.3.exe
gcc-4.1.2-mingw-setup.exe

cygwin:
3.2.25

OS:
Windows XP SP2


+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
When I test the installation of Weave I get the following output:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>> weave.test()
  Found 1 tests for scipy.weave.ast_tools
  Found 2 tests for scipy.weave.blitz_tools
  Found 9 tests for scipy.weave.build_tools
  Found 0 tests for scipy.weave.c_spec
  Found 26 tests for scipy.weave.catalog
building extensions here: 
c:\docume~1\michael\locals~1\temp\Michael\python24_compiled\m3
  Found 1 tests for scipy.weave.ext_tools
  Found 0 tests
 for scipy.weave.inline_tools
  Found 74 tests for scipy.weave.size_check
  Found 16 tests for scipy.weave.slice_handler
  Found 3 tests for
 scipy.weave.standard_array_spec
  Found 0 tests for __main__
...warning: specified build_dir '_bad_path_' does not exist or is not writable. 
Trying default locations
.....warning: specified build_dir '_bad_path_' does not exist or is not 
writable. Trying default locations
............................removing 
'c:\docume~1\michael\locals~1\temp\tmpdqudhmcat_test' (and everything under it)
error
removing c:\docume~1\michael\locals~1\temp\tmpdqudhmcat_test:
c:\docume~1\michael\locals~1\temp\tmpdqudhmcat_test\win3224compiled_catalog:
Permission denied
error removing
c:\docume~1\michael\locals~1\temp\tmpdqudhmcat_test:
c:\docume~1\michael\locals~1\temp\tmpdqudhmcat_test: Directory not empty
.removing 'c:\docume~1\michael\locals~1\temp\tmpw144aycat_test' (and everything 
under
 it)
...............................................................................................
----------------------------------------------------------------------
Ran 132 tests in 2.625s

OK
<unittest.TextTestRunner object at 0x020D6F70>


+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
When I try to test the following script or any other script I get the following 
message:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def prod(m, v):
    #C++ version
    nrows, ncolumns = m.shape

    res = numpy.zeros((nrows, ncolumns), float)
    code = r"""
    for (int i=0; i<nrows; i++)
    {
        for (int j=0; j<ncolumns; j++)
       
 {
            res(i) += m(i,j)*v(j);
        }
    }
    """

   
#err = weave.inline(code,['nrows', 'ncolumns', 'res', 'm', 'v'],
type_converters=converters.blitz, compiler='mingw32', verbose=2)  
    err = weave.inline(code,['nrows', 'ncolumns', 'res', 'm', 'v'], verbose=2)

<weave: compiling>
running build_ext
running build_src
building extension "sc_045cfaf40ef1a0738b1066aaa886a55d7" sources
customize Mingw32CCompiler
customize Mingw32CCompiler using build_ext
customize Mingw32CCompiler
customize Mingw32CCompiler using build_ext
building 'sc_045cfaf40ef1a0738b1066aaa886a55d7' extension
compiling C++ sources
C compiler: g++ -mno-cygwin -O2 -Wall

compile
options: '-IC:\Python24\lib\site-packages\scipy\weave
-IC:\Python24\lib\site-packages\scipy\weave\scxx
-IC:\Python24\lib\site-packages\numpy\core\include
-IC:\Python24\include -IC:\Python24\PC -c'
g++
-mno-cygwin -O2 -Wall -IC:\Python24\lib\site-packages\scipy\weave
-IC:\Python24\lib\site-packages\scipy\weave\scxx
-IC:\Python24\lib\site-packages\numpy\core\include
-IC:\Python24\include -IC:\Python24\PC -c
c:\docume~1\michael\locals~1\temp\Michael\python24_compiled\sc_045cfaf40ef1a0738b1066aaa886a55d7.cpp
-o
c:\docume~1\michael\locals~1\temp\Michael\python24_intermediate\compiler_c8350d870e6c54e8f29dd7094c2bfb45\Release\docume~1\michael\locals~1\temp\michael\python24_compiled\sc_045cfaf40ef1a0738b1066aaa886a55d7.o
Traceback (most recent call last):
  File 
"C:\Python24\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 
310, in RunScript
    exec codeObject in __main__.__dict__
  File "C:\Documents and Settings\Michael\Application
 Data\ESRI\ArcToolbox\scripts\test_weave.py", line 179, in ?
    main()
  File "C:\Documents and Settings\Michael\Application 
Data\ESRI\ArcToolbox\scripts\test_weave.py", line 170, in main
    prod(m, v)
  File "C:\Documents and Settings\Michael\Application 
Data\ESRI\ArcToolbox\scripts\test_weave.py", line 44, in prod
    err = weave.inline(code,['nrows', 'ncolumns', 'res', 'm', 'v'], verbose=2)
  File "C:\Python24\Lib\site-packages\scipy\weave\inline_tools.py", line 338, 
in inline
    auto_downcast = auto_downcast,
  File "C:\Python24\Lib\site-packages\scipy\weave\inline_tools.py", line 447, 
in compile_function
    verbose=verbose, **kw)
  File "C:\Python24\Lib\site-packages\scipy\weave\ext_tools.py", line 365, in 
compile
    verbose = verbose, **kw)
  File
 "C:\Python24\Lib\site-packages\scipy\weave\build_tools.py", line 269, in 
build_extension
    setup(name = module_name, ext_modules = [ext],verbose=verb)
  File "C:\Python24\lib\site-packages\numpy\distutils\core.py", line 173, in 
setup
    return old_setup(**new_attr)
  File "C:\Python24\lib\distutils\core.py", line 159, in setup
    raise SystemExit, error
CompileError: error: c:\docume~1\michael\locals~1\temp\tmp2dwbkp: No such file 
or directory

This file is created and automatically opens in python:
import os
import sys
sys.path.insert(0,'C:\\Python24\\lib\\site-packages\\numpy\\distutils')
from exec_command import exec_command
del sys.path[0]
cmd
= ['g++', '-mno-cygwin', '-O2', '-Wall',
'-IC:\\Python24\\lib\\site-packages\\scipy\\weave',
'-IC:\\Python24\\lib\\site-packages\\scipy\\weave\\scxx',
'-IC:\\Python24\\lib\\site-packages\\scipy\\weave\\blitz',
'-IC:\\Python24\\lib\\site-packages\\numpy\\core\\include',
'-IC:\\Python24\\include', '-IC:\\Python24\\PC', '-c',
'c:\\docume~1\\michael\\locals~1\\temp\\Michael\\python24_compiled\\sc_e6928d48a5ee12fb55c3b29ed6bf49ef4.cpp',
'-o',
'c:\\docume~1\\michael\\locals~1\\temp\\Michael\\python24_intermediate\\compiler_921933e1c4e3c013306c4ed6f4c15144\\Release\\docume~1\\michael\\locals~1\\temp\\michael\\python24_compiled\\sc_e6928d48a5ee12fb55c3b29ed6bf49ef4.o']
os.environ
= {'TMP': 'C:\\WINDOWS\\TEMP', 'COMPUTERNAME': 'ALDER', 'USERDOMAIN':
'ALDER', 'ARCHOME': 'C:\\arcgis\\arcexe9x', 'COMMONPROGRAMFILES':
'C:\\Program Files\\Common Files', 'PROCESSOR_IDENTIFIER': 'x86 Family
6 Model 13 Stepping 8, GenuineIntel', 'PROGRAMFILES': 'C:\\Program
Files', 'PROCESSOR_REVISION': '0d08', 'PATH':
'c:\\mingw\\bin;C:\\Program Files\\Common Files\\Roxio
Shared\\DLLShared;C:\\arcgis\\arcexe9x\\bin;C:\\Program
Files\\FWTools1.2.2\\pymod;C:\\Program
Files\\R\\R-2.5.1\\bin;C:\\Documents and Settings\\Michael\\My
Documents\\mod_web\\ems_web\\web-content\\mapserver-4.8.1bin;C:\\cygwin\\bin;C:\\program
files\\imagemagick-6.3.6-q16;C:\\Python24;C:\\Program
Files\\gs\\gs8.51\\lib;C:\\Program
Files\\gnuplot\\bin;C:\\ModisTools\\MRT\\bin;C:\\ModisTools\\LDOPE\\LDOPE_Win_bin\\ANCILLARY;C:\\Documents
and Settings\\Michael\\My
Documents\\my_home\\py_scripting\\src\\tools;C:\\Program
Files\\HEG\\HEG_Win\\bin;C:\\Perl\\site\\bin;C:\\Perl\\bin;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\Program
Files\\Microsoft SQL Server\\80\\Tools\\Binn\\;C:\\Program
Files\\MySQL\\MySQL Server 5.0\\bin;C:\\Program
Files\\QuickTime\\QTSystem;C:\\WINDOWS\\system32\\config\\systemprofile\\Local
Settings\\Temp;C:\\ModisTools\\MRT\\bin;
C:\\ModisTools\\LDOPE\\LDOPE_Win_bin\\ANCILLARY;C:\\Program
Files\\R\\R-2.5.1\\bin;;c:\\Program
Files\\HEG\\HEG_Win\\bin;c:\\Program
Files\\HEG\\HEG_Win\\bin;c:\\Program Files\\HEG\\HEG_Win\\bin',
'SYSTEMROOT': 'C:\\WINDOWS', 'ATHOME':
'C:\\arcgis\\arcexe9x\\arctools', 'SCRIPTING': 'C:\\Documents and
Settings\\Michael\\My Documents\\my_home\\py_scripting',
'ARCHOME_USER': 'C:\\arcgis\\arcexe9x', 'TEMP':
'C:\\DOCUME~1\\Michael\\LOCALS~1\\Temp', 'PROCESSOR_ARCHITECTURE':
'x86', 'ANCPATH': 'C:\\ModisTools\\LDOPE\\LDOPE_Win_bin\\ANCILLARY',
'ALLUSERSPROFILE': 'C:\\Documents and Settings\\All Users',
'SESSIONNAME': 'Console', 'ARCINFOFONTSIZE': '8', 'HOMEPATH':
'\\Documents and Settings\\Michael', 'USERNAME': 'Michael',
'LOGONSERVER': '\\\\ALDER', 'COMSPEC':
'C:\\WINDOWS\\system32\\cmd.exe', 'QTJAVA': 'C:\\Program
Files\\Java\\jre1.6.0_01\\lib\\ext\\QTJava.zip', 'PYTHONPATH':
'C:\\Program
Files\\ArcGIS\\bin;C:\\Python24\\Lib\\site-packages\\gdal;C:\\Program
Files\\R\\R-2.5.1\\bin;C:\\Documents and Settings\\Michael\\My
Documents\\my_home\\py_scripting\\src\\tools;C:\\Documents and
Settings\\Michael\\My
Documents\\my_home\\py_scripting\\lib;C:\\WINDOWS\\system32\\config\\systemprofile\\Local
Settings\\Temp;C:\\cygwin\\bin;C:\\mingw\\bin;c:\\mingw\\bin;C:\\Program
Files\\Common Files\\Roxio
Shared\\DLLShared;C:\\arcgis\\arcexe9x\\bin;C:\\Program
Files\\FWTools1.2.2\\pymod;C:\\Program
Files\\R\\R-2.5.1\\bin;C:\\Documents and Settings\\Michael\\My
Documents\\mod_web\\ems_web\\web-content\\mapserver-4.8.1bin;C:\\cygwin\\bin;C:\\program
files\\imagemagick-6.3.6-q16;C:\\Python24;C:\\Program
Files\\gs\\gs8.51\\lib;C:\\Program
Files\\gnuplot\\bin;C:\\ModisTools\\MRT\\bin;C:\\ModisTools\\LDOPE\\LDOPE_Win_bin\\ANCILLARY;C:\\Documents
and Settings\\Michael\\My
Documents\\my_home\\py_scripting\\src\\tools;C:\\Program
Files\\HEG\\HEG_Win\\bin;C:\\Perl\\site\\bin;C:\\Perl\\bin;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\Program
Files\\Microsoft SQL Server\\80\\Tools\\Binn\\;C:\\Program
Files\\MySQL\\MySQL Server 5.0\\bin;C:\\Program
Files\\QuickTime\\QTSystem;%USERPROFILE%\\Local Settings\\Temp;',
'CLASSPATH': '.;C:\\Program
Files\\Java\\jre1.6.0_01\\lib\\ext\\QTJava.zip', 'PLAT': 'win32',
'PYTHONSRC': 'C:\\Python24', 'PGSHOME': 'c:\\Program
Files\\HEG\\HEG_Win\\TOOLKIT_MTD', 'PATHEXT':
'.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.py;.pdf',
'CLIENTNAME': 'Console', 'FP_NO_HOST_CHECK': 'NO', 'WINDIR':
'C:\\WINDOWS', 'APPDATA': 'C:\\Documents and
Settings\\Michael\\Application Data', 'HOMEDRIVE': 'C:',
'ARCINFOFONTNAME': 'Courier New', 'SYSTEMDRIVE': 'C:',
'NUMBER_OF_PROCESSORS': '1', 'ARCGISHOME': 'C:\\Program
Files\\ArcGIS\\', 'MRTBINDIR': 'c:\\Program Files\\HEG\\HEG_Win\\bin',
'PROCESSOR_LEVEL': '6', 'MRTDATADIR': 'C:\\ModisTools\\MRT\\data',
'OS': 'Windows_NT', '__COMPAT_LAYER': 'EnableNXShowUI ', 'USERPROFILE': 
'C:\\Documents and Settings\\Michael'}
s,o = exec_command(cmd, _with_python=0,
 **{})
f=open('c:\\docume~1\\michael\\locals~1\\temp\\tmp0gk0g_',"w")
f.write(str(s))
f.close()
f=open('c:\\docume~1\\michael\\locals~1\\temp\\tmpadrrdg',"w")
f.write(o)
f.close()




      
____________________________________________________________________________________
Be a better sports nut!  Let your teams follow you 
with Yahoo Mobile. Try it now.  
http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to