8000 `foreach` over dynamic `PyObject` · Issue #1680 · pythonnet/pythonnet · GitHub
[go: up one dir, main page]

Skip to content
foreach over dynamic PyObject #1680
Closed
Closed
@CodingMadness

Description

@CodingMadness

Environment

  • Pythonnet version: 3.0.0
  • Python version: 3.9.5
  • Operating System: windows 10
  • .NET Runtime: .NET 6

Details

  • Describe what you were trying to get done.

  • foreach a tuple at runtime via "dynamic" keyword

  • What commands did you run to trigger this issue? If you can provide a
    [Minimal, Complete, and Verifiable example] (http://stackoverflow.com/help/mcve)
    this will help us understand the issue.
    `
    dynamic sys = Py.Import("sys");
    dynamic path2 = sys.path;

    foreach (PyObject item in path2)
    {
    Console.WriteLine(item);
    }
    `

  • If there was a crash, please include the traceback here.

Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: "Cannot implicitly convert type 'Python.Runtime.PyObject' to 'System.Collections.IEnumerable'. An explicit conversion exists (are you missing a cast?)"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0