title: Inno setup code to install python
body: <p>I have an inno set up code , which installs python . It works fine and I am getting the <strong>setup.exe</strong> file with the set up file having the python in it. But when I tried installing   python with that setup file , it didnt  work.Is that  because the setup file is looking for the python file specified in the <strong>file</strong> section, If so How can I change the code so that the <strong>python inside the setup.exe</strong> will be used .Also the setup  is creating a default application every time when I  install the set up.I have tried the attribute <strong>DisableDirPage=yes</strong> ,but it didnt work. Can any body suggest some solution to this.</p>
  
  <pre><code>             #define MyAppName "My Program"
               #define MyAppVersion "1.5"
  
  
  
                      [Setup]
             AppId={{BD59E856-F194-4E05-A93B-89089F3E3E9D}
             AppName={#MyAppName}
             AppVersion={#MyAppVersion}
            ;AppVerName={#MyAppName} {#MyAppVersion}
            ;AppPublisher={#MyAppPublisher}
            ;AppPublisherURL={#MyAppURL}
            ;AppSupportURL={#MyAppURL}
             ;AppUpdatesURL={#MyAppURL}
             DefaultDirName={pf}\{#MyAppName}
             DefaultGroupName={#MyAppName}
             OutputBaseFilename=setup
             Compression=lzma
             SolidCompression=yes
             DisableDirPage=yes
  
  
            [Files]
               Source: "H:\python-2.7.5.msi"; DestDir: "{app}"; Flags: ignoreversion
  
  
  
  
              [code]
               #define MinJRE "1.6"
              #define WebJRE "H:\python-2.7.5.msi"
  
             function InitializeSetup(): Boolean;
             var
            ErrorCode: Integer;
           PythonInstalled : Boolean;
            Result1 : Boolean;
            begin
                PythonInstalled :=                      RegKeyExists(HKLM,'SOFTWARE\Wow6432Node\Python\PythonCore\2.7\InstallPath');
            if PythonInstalled then
              begin
            MsgBox('installed', mbInformation, MB_OK);
             end
                  else
              begin
  
             Result1 := MsgBox('2222222222222222This tool requires python Runtime Environment  to run.  Do you want to install it now?',
              mbConfirmation, MB_YESNO) = idYes;
            if Result1 = false then
               begin    
               Result:=false;
               end 
           else
              begin
  
               MsgBox('not installed', mbInformation, MB_OK);
                Result:=true;
                ShellExec('',
                 '{#WebJRE}',
                '','',SW_SHOWNORMAL,ewNoWait,ErrorCode);
               end;
                    end;
                  end;
  </code></pre>