<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent changes to support-requests</title><link href="https://sourceforge.net/p/pythonnet/support-requests/" rel="alternate"/><link href="https://sourceforge.net/p/pythonnet/support-requests/feed.atom" rel="self"/><id>https://sourceforge.net/p/pythonnet/support-requests/</id><updated>2016-08-14T06:03:47.705000Z</updated><subtitle>Recent changes to support-requests</subtitle><entry><title>update license to MIT</title><link href="https://sourceforge.net/p/pythonnet/support-requests/7/" rel="alternate"/><published>2016-08-14T06:03:47.705000Z</published><updated>2016-08-14T06:03:47.705000Z</updated><author><name>Denis Akhiyarov</name><uri>https://sourceforge.net/u/denfromufa/</uri></author><id>https://sourceforge.net88e15738eef0e689b2aea5c7a2f6e0b3bfc7de4b</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;We propose to update license to MIT. We need permission from @tiran @barton_c @hardcoded &lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>One issue about multi-threading on python for DotNet</title><link href="https://sourceforge.net/p/pythonnet/support-requests/6/" rel="alternate"/><published>2015-03-05T14:05:10.886000Z</published><updated>2015-03-05T14:05:10.886000Z</updated><author><name>Longhui Xiong</name><uri>https://sourceforge.net/u/xionglonghui/</uri></author><id>https://sourceforge.net64f233e3b7146aad5d889d2b24fbfbf1c92d0db8</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi there,&lt;/p&gt;
&lt;p&gt;I am using python for DotNet, I have to say, it is great. &lt;/p&gt;
&lt;p&gt;As we know, cpython has the Global Interpreter Lock (GIL) on multi-threading. So it can not use multi-core. &lt;/p&gt;
&lt;p&gt;So I have one question, if I import CLR and use System.Threading on python for .net, but don't use cpython threading, &lt;/p&gt;
&lt;p&gt;My question: Does it still has GIL on multi-threading if I use DotNet threading lib? Can it use multi-core use DotNet threading lib.&lt;/p&gt;
&lt;p&gt;I know IronPython has no GIL and multi-threaded code can use multi core processors. So I pay attention this issue, on python for dotnet, if I use DotNet threading lib instead of cPython threading lib, Can multi-threaded code use multi core,  it still has GIL?&lt;/p&gt;
&lt;p&gt;I look forward to your reply.&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Longhui Xiong&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Possible bug in genericutil.cs (static Register method), and some support questions</title><link href="https://sourceforge.net/p/pythonnet/support-requests/5/" rel="alternate"/><published>2013-10-29T00:58:07.890000Z</published><updated>2013-10-29T00:58:07.890000Z</updated><author><name>Dean Wittmann</name><uri>https://sourceforge.net/u/deanwittmann/</uri></author><id>https://sourceforge.net1a95a9c1b21a61392d8e43defce9063dcaea24cb</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;This is my first time trying Python for .NET and I must say that this is an excellent resource.  This is also my first time developing with Python, so I have a couple of questions at the end of this request.  I am, however, a very seasoned C# and C/C++ developer.&lt;/p&gt;
&lt;p&gt;For reference, I am using Visual Studio Ultimate 2012 (with Update 3) and the .Net 4.0 32-bit runtime, Python 2.7.5 through the latest Spyder and Python(x,y) downloads.   I downloaded the latest source snapshot for Python for .NET, and debugged through both the clrmodule.il and Python.Runtime source to find the cause of this error.  I'm not sure that the fix I put in is correct, but here is what I was seeing...&lt;/p&gt;
&lt;p&gt;After the following Python source line:&lt;/p&gt;
&lt;p&gt;import clr&lt;/p&gt;
&lt;p&gt;I was receiving the console output message:&lt;/p&gt;
&lt;p&gt;SystemError: dynamic module not initialized properly&lt;/p&gt;
&lt;p&gt;I have my very short Python source file (Test.py) and the Python for .NET dll, pdb, and clr.pyd in the same folder (along with my C# dll in the same folder).&lt;/p&gt;
&lt;p&gt;I traced the error all the way into the GenericUtil.Register(Type t) static method when it was trying to Register the EmptyArray`1 type name (By the way, this is the only type name that was trying to register with a Namepace == null)&lt;/p&gt;
&lt;p&gt;The EmptyArray`1 Type has the Namespace property (string) set to null.&lt;/p&gt;
&lt;p&gt;The code in the Register method that tries to get the Namespace value:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;mapping&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;TryGetValue&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Namespace&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;out&lt;/span&gt; &lt;span class="n"&gt;nsmap&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;causes an ArgumentNullException when the key value (t.Namespace) is null.&lt;/p&gt;
&lt;p&gt;To fix the error, I just check for t.Namespace == null at the top of the method and immediately return from the method if it is null:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;   &lt;span class="c1"&gt;//====================================================================&lt;/span&gt;
    &lt;span class="c1"&gt;// Register a generic type that appears in a given namespace.&lt;/span&gt;
    &lt;span class="c1"&gt;//====================================================================&lt;/span&gt;

    &lt;span class="nx"&gt;internal&lt;/span&gt; &lt;span class="nx"&gt;static&lt;/span&gt; &lt;span class="bp"&gt;void&lt;/span&gt; &lt;span class="nb"&gt;Register&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;Type&lt;/span&gt; &lt;span class="nb"&gt;t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;t.Namespace&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="kt"&gt;null&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="nx"&gt;Dictionary&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;List&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;nsmap&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nx"&gt;mapping.TryGetValue&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;t.Namespace&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;out&lt;/span&gt; &lt;span class="nx"&gt;nsmap&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;nsmap&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="kt"&gt;null&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;nsmap&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;Dictionary&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;List&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
            &lt;span class="nx"&gt;mapping&lt;/span&gt;&lt;span class="err"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;t.Namespace&lt;/span&gt;&lt;span class="cp"&gt;]&lt;/span&gt; = nsmap;
        }
        string basename = t.Name;
        int tick = basename.IndexOf(&amp;quot;`&amp;quot;);
        if (tick &amp;gt; -1) {
            basename = basename.Substring(0, tick);
        }
        List&lt;span class="nt"&gt;&amp;lt;string&amp;gt;&lt;/span&gt; gnames = null;
        nsmap.TryGetValue(basename, out gnames);
        if (gnames == null) {
            gnames = new List&lt;span class="nt"&gt;&amp;lt;string&amp;gt;&lt;/span&gt;();
            nsmap&lt;span class="cp"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;basename&lt;/span&gt;&lt;span class="cp"&gt;]&lt;/span&gt; = gnames;
        }
        gnames.Add(t.Name);
    }
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This fix allowed me to then successfully import and use the Python for .NET functionality.  I'm not sure how to get this fix into the source and/or binaries for general use.  So, I'll leave that up to you.&lt;/p&gt;
&lt;p&gt;I don't want to take too much of your time, but I do have some questions (and these are due to the fact that I'm not a Python developer, yet):&lt;/p&gt;
&lt;p&gt;Here is my simple Test.py code:&lt;/p&gt;
&lt;h1 id="-coding-utf-8-"&gt;-&lt;em&gt;- coding: utf-8 -&lt;/em&gt;-&lt;/h1&gt;
&lt;p&gt;"""&lt;br /&gt;
Created on Thu Oct 24 16:08:49 2013&lt;/p&gt;
&lt;p&gt;@author: dwittma&lt;br /&gt;
"""&lt;/p&gt;
&lt;p&gt;import clr&lt;/p&gt;
&lt;p&gt;from System import *&lt;/p&gt;
&lt;p&gt;clr.AddReference("CoreTypes")&lt;/p&gt;
&lt;p&gt;from QuantaSoft import ProcessedWriter&lt;/p&gt;
&lt;p&gt;print ProcessedWriter.&lt;strong&gt;doc&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;pr = ProcessedWriter.Overloads&lt;a class="" href='../"D:\MyPython\Data\Test.qlp",%20"Ch1,Ch2",%20False,%20"",%20None,%20False'&gt;String, String, Boolean, String, Nullable&lt;span&gt;&lt;span&gt;[DateTime]&lt;/span&gt;&lt;/span&gt;, Boolean&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;pr.Close()&lt;/p&gt;
&lt;p&gt;and here is the console output:&lt;/p&gt;
&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;runfile('D:/MyPython/Test.py', wdir=r'D:/MyPython')&lt;br /&gt;
Void .ctor(System.String, Boolean)&lt;br /&gt;
Void .ctor(System.String, System.String, Boolean, System.String, System.Nullable`1&lt;span&gt;[System.DateTime]&lt;/span&gt;, Boolean)&lt;br /&gt;
Traceback (most recent call last):&lt;br /&gt;
  File "", line 1, in &lt;br /&gt;
  File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 540, in runfile&lt;br /&gt;
    execfile(filename, namespace)&lt;br /&gt;
  File "D:/MyPython/Test.py", line 18, in &lt;br /&gt;
    pr = ProcessedWriter.Overloads&lt;a class="" href='../"D:\MyPython\Data\Test.qlp",%20"Ch1,Ch2",%20False,%20"",%20None,%20False'&gt;String, String, Boolean, String, Nullable&lt;span&gt;&lt;span&gt;[DateTime]&lt;/span&gt;&lt;/span&gt;, Boolean&lt;/a&gt;&lt;br /&gt;
TypeError: no constructor matches given arguments&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;My C# overloaded constructor looks like this:&lt;/p&gt;
&lt;p&gt;public ProcessedWriter(string fileName, string channelDescriptor, bool columnBasedAcquisitionOrder,&lt;br /&gt;
                       string fileComments = QLBFileConst.EmptyString, DateTime? dateTime = null, bool appendChecksum = false)&lt;/p&gt;
&lt;p&gt;My questions are:&lt;/p&gt;
&lt;p&gt;How do I handle the Nullable (or DateTime?) type and how to pass an equivalent Python null argument for this type?&lt;/p&gt;
&lt;p&gt;And, as you can see, I have optional defaulted parameters in the constructor.  How does Python for .NET handle these?  (i.e., how to specify that they are optional, or must I pass in all arguments, even if the parameters are defaulted and optional)&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;-Dean&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Call .net from python</title><link href="https://sourceforge.net/p/pythonnet/support-requests/4/" rel="alternate"/><published>2012-04-05T23:32:10Z</published><updated>2012-04-05T23:32:10Z</updated><author><name>Xingying Cheng</name><uri>https://sourceforge.net/u/pangdou/</uri></author><id>https://sourceforge.net4df5878e8fadd311f43d9176eb3038c93dd807e8</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have some projects that i need to call .net dll from python. It contains namespaces and classed, and functions are embedded in the classes.&lt;br /&gt;
How should i call locate these functions and call them without using IronPython? Is there any detail instruction that i can follow?&lt;/p&gt;
&lt;p&gt;Thank you very much.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Embedding - Remoting </title><link href="https://sourceforge.net/p/pythonnet/support-requests/3/" rel="alternate"/><published>2012-03-12T04:28:47Z</published><updated>2012-03-12T04:28:47Z</updated><author><name>xeph</name><uri>https://sourceforge.net/u/christallire/</uri></author><id>https://sourceforge.net2b234ba163408f55ddc7dda9f9093be5d3980203</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I found stack corruption is caused while invoking&lt;br /&gt;
C/C++ Native/CLR calls somefunction1 in C# Module,&lt;br /&gt;
somefunction1 calls Python.Net invokation (PyObject_Call, etc) method,&lt;br /&gt;
While current Instruction Pointer (IP) is in python vm (which python modifies thread fs), then .NET GC kicks in,&lt;br /&gt;
GC looks up for thread fs, err, something is wrong. bam. stack corruption.&lt;/p&gt;
&lt;p&gt;i've tried all python invocation method, all same.&lt;br /&gt;
tried to Hold GC running while invoke, it was impossible. :)&lt;/p&gt;
&lt;p&gt;so I've end at.&lt;/p&gt;
&lt;p&gt;public static IPyObject InvokeSafe(this IPyObject inst, params IPyObject[] args)&lt;br /&gt;
        {&lt;br /&gt;
            PyTuple t = new PyTuple(args);&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;        &lt;span class="n"&gt;IntPtr&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;\&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;PythonEngine&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;IsRemoteAvailable&lt;/span&gt;&lt;span class="o"&gt;\&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;PythonEngine&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RemoteInvoke&lt;/span&gt;&lt;span class="o"&gt;\&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;inst&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;IntPtr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Zero&lt;/span&gt;&lt;span class="o"&gt;\&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;else&lt;/span&gt;
        &lt;span class="o"&gt;\&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;st&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Restart&lt;/span&gt;&lt;span class="o"&gt;\&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;\&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; 
            &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Runtime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;PyEval&lt;/span&gt;&lt;span class="o"&gt;\&lt;/span&gt;&lt;span class="n"&gt;_CallObjectWithKeywords&lt;/span&gt;&lt;span class="o"&gt;\&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;inst&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;IntPtr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Zero&lt;/span&gt;&lt;span class="o"&gt;\&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="n"&gt;st&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Stop&lt;/span&gt;&lt;span class="o"&gt;\&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;\&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;\&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;st&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ElapsedMilliseconds&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;gt&lt;/span&gt;&lt;span class="p"&gt;;=&lt;/span&gt; 1000&lt;span class="o"&gt;\&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;WriteLine&lt;/span&gt;&lt;span class="o"&gt;\&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&amp;quot;&lt;span class="n"&gt;Invoke&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;\&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;0&lt;span class="o"&gt;\&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="n"&gt;took&lt;/span&gt; &lt;span class="o"&gt;\&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;1&lt;span class="o"&gt;\&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&amp;quot;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;inst&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;st&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ElapsedMilliseconds&lt;/span&gt;&lt;span class="o"&gt;\&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="o"&gt;\&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;\&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;IntPtr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Zero&lt;/span&gt;&lt;span class="o"&gt;\&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="o"&gt;\&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;\&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;PythonEngine&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;IsRemoteAvailable&lt;/span&gt;&lt;span class="o"&gt;\&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="n"&gt;throw&lt;/span&gt; &lt;span class="n"&gt;PythonEngine&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SafeCreatePythonException&lt;/span&gt;&lt;span class="o"&gt;\&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;\&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="k"&gt;else&lt;/span&gt;
                &lt;span class="n"&gt;throw&lt;/span&gt; &lt;span class="n"&gt;new&lt;/span&gt; &lt;span class="n"&gt;PythonException&lt;/span&gt;&lt;span class="o"&gt;\&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;\&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="o"&gt;\&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;new&lt;/span&gt; &lt;span class="n"&gt;PyObject&lt;/span&gt;&lt;span class="o"&gt;\&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="o"&gt;\&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;\&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;RemoteInvokation...&lt;br /&gt;
Another native thread waits for remoting, python.net calls remoting method, native thread runs. python net waits for method ends.&lt;br /&gt;
Works very well.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Import build in module adn execute the statements</title><link href="https://sourceforge.net/p/pythonnet/support-requests/2/" rel="alternate"/><published>2011-10-13T15:55:18Z</published><updated>2011-10-13T15:55:18Z</updated><author><name>Anonymous</name><uri>https://sourceforge.net/u/userid-None/</uri></author><id>https://sourceforge.net80f83020a384be0d5e50318d5def749de232ff45</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;I am trying to embedded python with C#&lt;/p&gt;
&lt;p&gt;I need to execute commands like this&lt;/p&gt;
&lt;p&gt;print math.sin(90)&lt;/p&gt;
&lt;p&gt;I am writing my code in C# using wrapper classes.&lt;/p&gt;
&lt;p&gt;I wrote my code like this&lt;/p&gt;
&lt;p&gt;public void  TestCommandFileExecution(string code)&lt;br /&gt;
{&lt;/p&gt;
&lt;p&gt;IntPtr modulePtr = Runtime.PyImport_ImportModule("math");         &lt;br /&gt;
&lt;/p&gt;
&lt;p&gt;IntPtr appPtr = Runtime.PyEval_GetBuiltins();&lt;/p&gt;
&lt;p&gt;IntPtr srcCompilation = Runtime.Py_CompileString(code, "&amp;lt;stdin&amp;gt;", Runtime.Py_single_input); // I even tried making this into Py_file_input but no change&lt;/p&gt;
&lt;p&gt;IntPtr execution = ExtendedRuntime.PyEval_EvalCode(srcCompilation, appPtr, IntPtr.Zero);&lt;br /&gt;
Runtime.PyErr_Print();&lt;/p&gt;
&lt;p&gt;}&lt;br /&gt;
And I am sending a code like this&lt;/p&gt;
&lt;p&gt;CommandFileExecution("print 'test!'"); // Working fine&lt;/p&gt;
&lt;p&gt;CommandFileExecution("print math.sin(90)"); // Showing a error like this.&lt;/p&gt;
&lt;p&gt;Traceback &amp;lt;most recent call last&amp;gt;:&lt;br /&gt;
File”&amp;lt;stdin&amp;gt;”, line 1,in &amp;lt;module&amp;gt;&lt;br /&gt;
NameError: name ‘math’ is not defined&lt;/p&gt;
&lt;p&gt;Please help me &lt;/p&gt;
&lt;p&gt;Thank you&lt;br /&gt;
Manoj&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>py2.5</title><link href="https://sourceforge.net/p/pythonnet/support-requests/1/" rel="alternate"/><published>2007-02-20T23:27:19Z</published><updated>2007-02-20T23:27:19Z</updated><author><name>Anonymous</name><uri>https://sourceforge.net/u/userid-None/</uri></author><id>https://sourceforge.net4b1265ee0467d1a81d1f28e665d26bb5cfdf1bcd</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Tried to compile, but could not find any instructions... Could you please provide binaries for&lt;br /&gt;
Python 2.5 against CLR 1.1&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>