[Python.NET] DocStringAttribute Example

Jonno jonnojohnson at gmail.com
Thu Mar 13 16:20:41 CET 2014


Only way I could get this to work is to copy the files: clr.pyd,
nPython.exe, Python.Runtime.dll to the directory c:\Python27 (rather
than c:\Python27\DLLs).

Does anyone know why this would not work? Using sys.path.append() while
keeping the files elsewhere also doesn't work.


On Thu, Mar 13, 2014 at 8:57 AM, Jonno <jonnojohnson at gmail.com> wrote:

> Also when using clr.pyd from
> pythonnet-2.0-Beta0-clr4.0_140_py27_UCS2_x86.zip I cannot import clr. I get
> the following error:
> "dynamic module not initialized properly"
> I'm on CPython 2.7.5, Win7 32bit.
> Can anyone suggest what might be causing this? I have .NET Framework 4.5
> installed.
>
>
> On Wed, Mar 12, 2014 at 2:33 PM, Jonno <jonnojohnson at gmail.com> wrote:
>
>> Is it possible to compile the 2.0 Beta version containing the
>> DocStringAttribute for clr version 2.0 or is there some incompatibility?
>>
>> I'm not familiar with how to build the pythondotnet source.
>>
>>
>> On Wed, Mar 12, 2014 at 11:59 AM, Jonno <jonnojohnson at gmail.com> wrote:
>>
>>> My mistake Tony,
>>>
>>> I was using the 2.0 CLR version of pythondotnet which doesn't have the
>>> DocStringAttribute class.
>>>
>>>
>>> On Wed, Mar 12, 2014 at 9:46 AM, Tony Roberts <tony at pyxll.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> have you added the Python.Runtime to your project references? Take a
>>>> look at the Python.Test project that's used by the unit tests if you're not
>>>> sure how to set up your project.
>>>>
>>>> cheers,
>>>> Tony
>>>>
>>>>
>>>> On Wed, Mar 12, 2014 at 2:33 PM, Jonno <jonnojohnson at gmail.com> wrote:
>>>>
>>>>> Thanks Tony,
>>>>>
>>>>> This is probably my ignorance of C# but I get the following error
>>>>> using the same syntax as the example:
>>>>>
>>>>> The type or namespace name 'DocStringAttribute' could not be found
>>>>> (are you missing a using directive or an assembly reference?)
>>>>>
>>>>> I have the:
>>>>> using Python.Runtime
>>>>> statement.
>>>>>
>>>>>
>>>>> On Fri, Mar 7, 2014 at 12:19 PM, Tony Roberts <tony at pyxll.com> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> if your class has a constructor then the class docstring will get
>>>>>> replaced with a description of the constructor, even if you explicitly gave
>>>>>> the class a docstring using DocStringAttribute.
>>>>>>
>>>>>> I've created an issue for github for this and fixed it:
>>>>>> https://github.com/pythonnet/pythonnet/issues/14
>>>>>>
>>>>>> In the same commit I added some unit tests which should do as an
>>>>>> example for you to see how it should work (see the newly added file
>>>>>> pythonnet/src/testing/doctest.cs and pythonnet/src/tests/test_docstring.py).
>>>>>>
>>>>>> cheers,
>>>>>> Tony
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Wed, Mar 5, 2014 at 3:59 PM, Jonno <jonnojohnson at gmail.com> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> Is there an example how to format documentation in classes & methods
>>>>>>> so that a python docstring will be produced?
>>>>>>>
>>>>>>> I found the following in a thread a while back but it's not working
>>>>>>> for me:
>>>>>>>
>>>>>>> ### test.cs ##
>>>>>>> using System;
>>>>>>> using System.Runtime.InteropServices;
>>>>>>> using Python.Runtime;
>>>>>>>
>>>>>>> namespace PinvokeTest
>>>>>>> {
>>>>>>> 	[DocStringAttribute("Interface class to external functions.")]
>>>>>>> 	public class Invoke {
>>>>>>> 		
>>>>>>> 		[DocStringAttribute("External funtion simulation: WriteToFile(char)
>>>>>>> will write a char to the terminal.")]
>>>>>>>          	public static void WriteToFile(char arg) {
>>>>>>>              		Console.WriteLine("Writing {0}", arg);
>>>>>>>                          return;
>>>>>>> 		}
>>>>>>> 	}
>>>>>>> }
>>>>>>>
>>>>>>>
>>>>>>> _________________________________________________
>>>>>>> Python.NET mailing list - PythonDotNet at python.org
>>>>>>> https://mail.python.org/mailman/listinfo/pythondotnet
>>>>>>>
>>>>>>
>>>>>>
>>>>>> _________________________________________________
>>>>>> Python.NET mailing list - PythonDotNet at python.org
>>>>>> https://mail.python.org/mailman/listinfo/pythondotnet
>>>>>>
>>>>>
>>>>>
>>>>> _________________________________________________
>>>>> Python.NET mailing list - PythonDotNet at python.org
>>>>> https://mail.python.org/mailman/listinfo/pythondotnet
>>>>>
>>>>
>>>>
>>>> _________________________________________________
>>>> Python.NET mailing list - PythonDotNet at python.org
>>>> https://mail.python.org/mailman/listinfo/pythondotnet
>>>>
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythondotnet/attachments/20140313/f510ada6/attachment.html>


More information about the PythonDotNet mailing list