<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="FR" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">Hello,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-US">I am struggling using correctly Type169 “Calling Python Script”.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">In order to use our former homemade Types, I am using TRNSYS18 32bits.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I have re-compiled Type169 in 32bits with Microsoft Visual C++ Express 2010 and Python 3.5 (I did not succeed with more recent version of Python3).<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I have first created a test project in “TRNSYS18/MyProjects” folder, using this type and it works perfectly.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">But if I copy/paste the exact same project folder – with the exact same Python script – on another computer with the same configuration or even on my Desktop folder, I have most of the time the following error “The Python
 script failed to load”.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">And sometimes, depending on where I try to run the simulation, I have the error : "Failed to load the function…” (while the function name is correctly written).<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">When looking at the Type169.cpp code in Debug mode, it seems that the problem comes from the “PyImport_Import” function.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Arguments in previous functions seem correct in any case (scriptPath and scriptName). But in problematic cases, the function returns an empty object (pModule).
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">And I can’t go further with my limited knowledge of Python.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Has anyone encountered such a problem ?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal">Best regards,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#1F497D;mso-fareast-language:FR">Antoine Leconte<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;color:#004080;mso-fareast-language:FR">------------------------------------------------------------------------------------------</span><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#1F497D;mso-fareast-language:FR"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#1F497D;mso-fareast-language:FR">tel. +33(0)479792138 – CEA INES ☼ – LITEN/DTS/SBST/LSTB –  Le Bourget du Lac (73), FRANCE – bât. HELIOS/3117
</span><span style="mso-fareast-language:FR"><a href="Liten.cea.fr"><span style="color:#1F497D">Liten.cea.fr</span></a></span><span style="color:#1F497D;mso-fareast-language:FR"><o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>