Search code examples
firefoxpython-2.7windows-7firefox-addonfirefox-addon-sdk

Error Installing Firefox Addon SDK Python


Hello im trying to figure out how to properly install Firefox Addon SDK, I've followed all the installation details such as: Installing Python 2.7, setting my PATH Variables correctly, and running the addon from my cmd.exe .. Everytime I run the command line to start developing an addon I get this error:

    C:\mozilla-build\addon-sdk\bin>activate.bat
    Warning: Failed to find Python installation directory

IFrom my understanding I have everything properly configured, Can anyone help with this error. And also my PATH variables are as below

   User Variables...;C:\mozilla-build\addon-sdk\bin;C:\mozilla-build\python;C:\Python27
   SYSTEM Variables ...;C:\mozilla-build\addon-sdk\bin;C:\mozilla-build\python;C:\Python27

Solution

  • The problem seems to be that the activate batch file having issues to set the write value of the variable PYTHONINSTALL. I solved this by setting it manually and deleting all the bloated function Mozilla used to detect the path.

    open the bin\activate.bat file with an editor (np++ makes it clear to work with) under the :CheckPython label delete the function and the comments and use this to set your python installation path:

    :CheckPython
    ::CheckPython(retVal, key)
    ::Reads the registry at %2% and checks if a Python exists there.
    ::Checks both HKLM and HKCU, then checks the executable actually exists.
    
    SET key=%2%
    SET "%~1="
    SET reg=reg
    if defined ProgramFiles(x86) (
    
      if exist %WINDIR%\sysnative\reg.exe SET reg=%WINDIR%\sysnative\reg.exe
    )
    rem here you should make sure to set the correct path
    set PYTHONINSTALL=C:\Program Files\Python27
    if exist %PYTHONINSTALL%\python.exe goto :EOF
    
    if exist %PYTHONINSTALL%\PCBuild\python.exe (set "PYTHONINSTALL=%PYTHONINSTALL%\PCBuild" & goto :EOF)
    
    if exist %PYTHONINSTALL%\PCBuild\amd64\python.exe (set "PYTHONINSTALL=%PYTHONINSTALL%\PCBuild\amd64" & goto :EOF)
    
    
    
    GOTO :EOF