allfro / canari

Local and Remote Maltego Rapid Transform Development Framework
http://www.canariproject.com
102 stars 27 forks source link

Fix Windows installs with Python 2.7 not located in the PATH variable #55

Open ameily opened 9 years ago

ameily commented 9 years ago

The fix addresses the situation where Python 2.7 is not located in the Windows PATH environmental variable. In my situation I have Python 3.3 located in PATH and, therefore, Maltego transforms fail to execute stating that the canari package is not installed.

The fix works by first checking if the script's parent directory contains the python.exe executable and, if it does, uses this executable rather than the one located in PATH.

For Windows installations, the Python directory structure is:

<root install> (C:\Python) \
    Python.exe
    Scripts\
        dispatcher.bat
        canari.bat

This way, canari.bat will check if <root install>\Python.exe exists, and if it does, execute that version of Python. If this executable doesn't exist, the Python version located in the PATH is executed.