Skip to content

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

Closed

Description

@atm84a

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

Activity

  1. den-run-ai commented on Sep 15, 2017

    @den-run-ai
    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

  2. atm84a commented on Sep 15, 2017

    @atm84a
    Author

    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).

  3. den-run-ai commented on Sep 15, 2017

    @den-run-ai
    Contributor

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

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

  4. atm84a commented on Sep 15, 2017

    @atm84a
    Author

    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

  5. den-run-ai commented on Sep 15, 2017

    @den-run-ai
    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

  6. den-run-ai commented on Dec 14, 2017

    @den-run-ai
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions