Re: [Python.NET] Passing a C# DateTime object to a Python script

Denis Akhiyarov <[email protected]> Thu, 7 Jun 2018 22:22:00 -0500
Newsgroups gmane.comp.python.dotnet
Message-ID <CALxxJLQhF72Qei0edwmPi_jtBHZRzej9kOuXT0WmCsVnbC88mQ@mail.gmail.com>
There is a pythonnet branch with datetime conversion implementation. Is
this what you are looking for?

https://github.com/QuantConnect/pythonnet/pull/8/files


On Wed, May 30, 2018, 2:26 PM Ian Hannah <[email protected]> wrote:

> Hi,
>
>
>
> I have a simple python script:
>
>
>
> def test(datetime_or_doy):
>
>                 print datetime_or_doy.strftime('%m/%d/%Y')
>
>
>
> and I am using Python for .NET to try and call this method as follows:
>
>
>
> dynamic np = Py.Import(@"pvlib");
>
> double d = np.irradiance.test(DateTime.Now);
>
>
>
> and I get the error:
>
>
>
> *Python.Runtime.PythonException:* 'AttributeError : 'DateTime' object has
> no attribute 'strftime''
>
>
>
> Clearly I need to pass a Python datetime object from the C# code but how
> do I do that?
>
>
>
> Thanks
>
> Ian
>
>
> _________________________________________________
> Python.NET mailing list - [email protected]
> https://mail.python.org/mailman/listinfo/pythondotnet
>

_________________________________________________
Python.NET mailing list - [email protected]
https://mail.python.org/mailman/listinfo/pythondotnet