Skip to content

C# .NET windows form example with python calls #318

@tarpista

Description

@tarpista

I would like to ask that would it be possible to have an example .NET winform application which imports some python module, (ie numpy) and makes some call from it? I could not realy find such anywhere, and my trial fails right at the begining with

An unhandled exception of type 'System.ArgumentNullException' occurred in mscorlib.dll

Additional information: Value cannot be null.

Here is my code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Python.Runtime;

public partial class frmMain : Form
{
    public frmMain()
    {
        InitializeComponent();

        PythonEngine.Initialize(); //<- Error occurs here.
    }
}

Error details:
error

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