Search code examples
pythonmatlabsconstexmex

Python & SCons & Matlab: Wrong command input


I am using SCons to install a package, but when I try to compile with mex, the matlab compiler, it runs other command from pdfTeX with same name. To solve this problem on bash, I've just changed .bashrc:

alias mex="/Applications/MATLAB_R2009b.app/bin/mex"

but I dont know how to change it on SCons environment. Someone knows how to do it?

Thanks.


Solution

  • I've managed to fix this problem. On SCons, the environment it sees is from the instance:

    env = Environment(..., ENV = os.environ)
    

    What I did was to add to os.environ the path of the matlab mex, by doing:

    os.environ['PATH'] = matlabPath + '/bin:' +  os.environ['PATH'];
    

    Where matlabPath is the Matlab Path, e.g.:

    /Applications/MATLAB_R2009b.app
    

    That's it!