I tried using the clr.pyd from both python1.6-UCS2 and python2.6-UCS4 folders, same results.  I am running the current python windows build:<div><div>Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)] on win32</div>

<div><br></div><div>Has anyone built clr.pyd for this distribution. I am not that familiar with latest ms Visual Studio etc. Looking at src/ in svn I see mostly .cs files, I would really like to be able to </div><div>import clr</div>

<div>then clr.AddReferenct(somefile)</div><div># instantiat python object from somefile</div><div>xx = somefile.someobject()</div><div>...etc...</div><div><br></div><div>I can do this using the python.exe found in the python2.6-UCS2 folder, but I want to use my regular python that has numerous packages and where I build a product with py2exe...</div>

<div><br></div><div>What are my options, must I use the python distributed with pythonDotNet, and if so what are the repercussions when trying to use other packages. I see that if I run the python .exe that it gets my installed .site information and therefore has access to all my libraries. What has been done to this python.exe and can I simply move it to my python26/ directory?</div>

<div><br></div><div>It feels very strange to override the python.exe in the standard distribution, what about things built with py2exe will they still work?  </div><div><br></div><div>Any enlightenment would be much appreciated.</div>

<div><br></div><div>max</div><div><br></div><div><br></div><div> </div>Max Slimmer<br>eMail: max@SlimmerSoft.com<br>phone: 707 703-4396<br>
<br><br><div class="gmail_quote">On Sun, Oct 30, 2011 at 10:47 AM, Bradley Friedman <span dir="ltr">&lt;<a href="mailto:brad@fie.us">brad@fie.us</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div style="word-wrap:break-word"><div>CPython is compiled with one of two unicode modes.  The symbols in the dynamic library are different based on that original configuration flag.  Basically that config flag on python makes versions of python that are binary incompatible with one another even though they are the same version.  Native python extensions that link against python, need to therefore be linked against one or the other.  You can&#39;t link against both simultaneously.</div>

<div><br></div><div>Since most CPython native extensions are either pre built for a linux distribution (under the control of a managed package system), or are built on the target system itself, this is not an issue.   They know which flags were used by the python on the system.  In windows land, which is primarily a binary distribution land in which there is no cohesive binary package system managing the dependencies, your only real choice for binary distributions is to build both and provide them both.</div>

<div><br></div><div>If you try to run a mismatched binary with python, it will error out at runtime saying it can&#39;t find symbols, or entry points.  This would potentially look much like the error you post.  Though I would expect to see a more specific error info.  But at its base level, it would have trouble finding the function it was looking for, due to the function being fundamentally different in the data type of the parameters.  The symbol it was looking for would not be found.</div>

<div><br></div><div>Though there could be a myriad of other reasons why its having trouble finding that symbol.</div><br><div><div><div></div><div class="h5"><div>On Oct 27, 2011, at 11:16 PM, Max Slimmer wrote:</div><br>

</div></div><blockquote type="cite"><div><div></div><div class="h5">I am running python 2.6 under windows and would like to access some .net code. I have downloaded pythonnet-2.0-alpha2-136-py26.zip from source-forge. 
<div>I can run the python.exe in \python2.6-UCS2 folder and from there import clr, however I want to import and run from my existing python2.6 installation. I put the clr.pyd file in sitepackages and also in DLLs but when I get the following:</div>



<div><br></div><div><div>Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)] on</div><div>win32</div><div>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.</div>



<div>&gt;&gt;&gt; import clr</div><div>Traceback (most recent call last):</div><div>  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;</div><div>ImportError: dynamic module does not define init function (initclr)</div>



<div>&gt;&gt;&gt;</div></div><div><br></div><div>I also could use a bit more documentation, I went to Bryan Lloyd&#39;s blog and see:</div><div><span style="font-family:&#39;trebuchet ms&#39;, verdana, sans-serif;line-height:22px;background-color:rgb(245, 245, 245);font-size:medium">Refactored import syntax: now you can use un-prefixed namespace names ( &quot;from System import *&quot;) instead of the old &quot;magic CLR module&quot; syntax (&quot;from CLR.System...). The old &quot;CLR.&quot; syntax is still supported until 3.0, but now officially deprecated. This was the main compatibility problem with code targeted for IP.</span></div>



<div><span style="font-family:&#39;trebuchet ms&#39;, verdana, sans-serif;line-height:22px;background-color:rgb(245, 245, 245);font-size:medium"><br></span></div><div><font face="&#39;trebuchet ms&#39;, verdana, sans-serif" size="3"><span style="line-height:22px">I can&#39;t figure how to get here!  </span></font></div>



<div><font face="&#39;trebuchet ms&#39;, verdana, sans-serif" size="3"><span style="line-height:22px"><br></span></font></div><div><font face="&#39;trebuchet ms&#39;, verdana, sans-serif" size="3"><span style="line-height:22px">what is the difference between the -UCS2 and -UCS4 folders?</span></font></div>



<div><span style="color:rgb(85, 87, 83);font-family:georgia;font-size:11px;line-height:21px;background-color:rgb(255, 255, 255)"><br></span></div><div><span style="color:rgb(85, 87, 83);font-family:georgia;font-size:11px;line-height:21px;background-color:rgb(255, 255, 255)"><br>



</span></div></div></div>
_________________________________________________<br><a href="http://Python.NET" target="_blank">Python.NET</a> mailing list - <a href="mailto:PythonDotNet@python.org" target="_blank">PythonDotNet@python.org</a><br><a href="http://mail.python.org/mailman/listinfo/pythondotnet" target="_blank">http://mail.python.org/mailman/listinfo/pythondotnet</a></blockquote>

</div><br></div></blockquote></div><br></div>