Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot implicitly convert type 'void' to 'object' from readme #563

Closed
denfromufa opened this issue Oct 23, 2017 · 6 comments
Closed

Cannot implicitly convert type 'void' to 'object' from readme #563

denfromufa opened this issue Oct 23, 2017 · 6 comments

Comments

@denfromufa
Copy link
Contributor

denfromufa commented Oct 23, 2017

Based on #554

> #r C:\\Python\\Python35_64b\\lib\\site-packages\\Python.Runtime.DLL
> using Python.Runtime;
> dynamic np; using (Py.GIL()) { np = Py.Import("numpy");};
> using System.Collections.Generic;
> using System.Collections;
> dynamic a = np.array(new List<float> { 1, 2, 3 });
> dynamic b = np.array(new List<float> { 6, 5, 4 }, dtype: np.int32);
> Console.WriteLine(a.dtype);
Cannot implicitly convert type 'void' to 'object'
> a.ToString()
[ 1.  2.  3.]
> b.ToString()
[6 5 4]
@das-anubhav
Copy link

das-anubhav commented Aug 22, 2021

Hi!
Can I take this issue?

@lostmsu
Copy link
Member

lostmsu commented Aug 22, 2021

@das-anubhav you're free to submit a PR, sure

@lijozech-12
Copy link

lijozech-12 commented Aug 24, 2021

Hey, I know python and C++ very well. Is my skills fit into this issue ?

@lostmsu
Copy link
Member

lostmsu commented Aug 24, 2021

In general, this is going to require understanding how interperters work

@shashwatsaket46
Copy link

shashwatsaket46 commented Aug 25, 2021

This issue is arising because you have put the int32 return type for the function but you want it to return an Object datatype. Here you need to add str instead of int32 for dynamic b.
so try this:

#r C:\Python\Python35_64b\lib\site-packages\Python.Runtime.DLL
using Python.Runtime;
dynamic np; using (Py.GIL()) { np = Py.Import("numpy");};
using System.Collections.Generic;
using System.Collections;
dynamic a = np.array(new List { 1, 2, 3 });
dynamic b = np.array(new List { 6, 5, 4 }, dtype: np.str);
Console.WriteLine(a.dtype);

@josbinjoseph005
Copy link

josbinjoseph005 commented Sep 5, 2021

try to add str instead of int32 in dynamic b

@filmor filmor closed this as not planned Won't fix, can't repro, duplicate, stale Aug 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants