Using the Windows "embedded" distribution of Python

Paul Moore p.f.moore at gmail.com
Fri Sep 30 07:02:39 EDT 2016


On Thursday, 29 September 2016 12:56:28 UTC+1, eryk sun  wrote:
> In that case you can use an application manifest with a dependent
> assembly. Say embedded Python 3.6 is in the "py3embed" subdirectory.
> Add the following manifest file to that directory:
> 
> py3embed.manifest:
> 
>     <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
>     <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
>         <assemblyIdentity name="py3embed"
>                           version="3.6.111.1013"
>                           type="win32"
>                           processorArchitecture="amd64" />
>         <file name="python3.dll" />
>         <file name="python36.dll" />
>         <file name="vcruntime140.dll" />
>     </assembly>
> 
> Add this assembly as a dependency in the application manifest, either
> embedded in the executable (resource #1) or as a separate file named
> the same as the executable plus ".manifest", e.g. "app.exe.manifest".
> You can start with the manifest that's used by python.exe, from
> PC\python.manifest.
> 
>   <dependency>
>     <dependentAssembly>
>       <assemblyIdentity name="py3embed"
>                         version="3.6.111.1013"
>                         type="win32"
>                         processorArchitecture="amd64" />
>     </dependentAssembly>
>   </dependency>

OK, I thought I understood this, but it's not quite working.

I have the following directory structure:

    py3embed
        py3embed.manifest
        ... an unpacked Python 3.6b0 embedded distribution
    ssh.exe
    ssh.exe.manifest

(ssh.exe is my embedded Python program)

py3embed.manifest is

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <assemblyIdentity name="py3embed"
                      version="3.6.111.1013"
                      type="win32"
                      processorArchitecture="amd64" />
    <file name="python3.dll" />
    <file name="python36.dll" />
    <file name="vcruntime140.dll" />
</assembly>

ssh.exe.manifest is:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>                                                   
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">                                 
  <trustInfo>                                                                                             
    <security>                                                                                            
      <requestedPrivileges>                                                                               
        <requestedExecutionLevel level="asInvoker" uiAccess="false"/>                                     
      </requestedPrivileges>                                                                              
    </security>                                                                                           
  </trustInfo>                                                                                            
  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">                                      
    <application>                                                                                         
      <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>                                          
      <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>                                          
      <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>                                          
      <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>                                          
      <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>                                          
    </application>                                                                                        
  </compatibility>                                                                                        
  <application xmlns="urn:schemas-microsoft-com:asm.v3">                                                  
    <windowsSettings>                                                                                     
      <longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>   
    </windowsSettings>                                                                                    
  </application>                                                                                          
  <dependency>                                                                                            
    <dependentAssembly>                                                                                   
      <assemblyIdentity name="py3embed"                                                                   
                        version="3.6.111.1013"                                                            
                        type="win32"                                                                      
                        processorArchitecture="amd64" />                                                  
    </dependentAssembly>                                                                                  
  </dependency>                                                                                           
</assembly>

When I run ssh.exe, it fails with the message "The program cannot start because python3.dll is missing from your computer". I tried running it with sxstrace active, but the resulting log file is empty.

I'm not sure where to go next debugging this. Do you have any suggestions?

Paul



More information about the Python-list mailing list