Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Cannot compile example from tutorial in VS2015 because of named argument #543

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

Closed
atm84a opened this issue Sep 15, 2017 · 6 comments
Closed

Comments

@atm84a
Copy link

atm84a commented Sep 15, 2017

Environment

  • Pythonnet 2.3.0:
  • Python 3.5:
  • Operating System : Windows 7 SP1
  • Visual Studio 2015 Update 3 with latest Resharper

Details

I'm trying to run the first c# example from tutorial, but it looks like my VS2015 doesn't recognize named arguments for for dynamic objects.
Looks like it is the problem of environment, but its resolution will also be useful for other users.

Screenshots

code snippet with compile error:

image

console output with another issue (possibly related), where dtype of numpy array is printed as "object" instead of "int", printing an array also results in "object":

image

@den-run-ai
Copy link
Contributor

For this syntax to work you need to use pythonnet from the master. Note that we are planning to adopt slightly different syntax for calling into numpy arrays:

#514

@atm84a
Copy link
Author

atm84a commented Sep 15, 2017

I installed managed assembly via nuget as described in "installation" section of wiki. So what do you mean by "to use pythonnet from the master"?
It looks like named arguments for methods of dynamic objects violate c# syntax (I have never used them before in such manner).

@den-run-ai
Copy link
Contributor

https://github.com/pythonnet/pythonnet/wiki/Installation

pip install git+https://github.com/pythonnet/pythonnet

@atm84a
Copy link
Author

atm84a commented Sep 15, 2017

I installed pythonnet with given cmd params. But the problem still exists. Are you sure that c# cyntax isn't violated with named params for dynamics? Or maybe problem is with VS version or resharper?

image

@den-run-ai
Copy link
Contributor

@UNdedss that is my bad! The syntax on C# side for keyword arguments is colon sign :, not equal sign =, unlike Python:

https://github.com/pythonnet/pythonnet/blob/master/src/embed_tests/TestNamedArguments.cs

I fixed this in readme now:

4bac694

More details about this feature in this pull request:

#461

@den-run-ai
Copy link
Contributor

This looks fixed, so I'm closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants