I built a Windows Form to gather information about projects. This information is then uploaded to a database.
Actually, I'm using a Python script to do that (the required information is therefore hardcoded in the script by the user).
I would like to use my WindowsForm to set the variable for my script. I'm getting an IronPython runtime exception : cannot import _psycopg from psycopg2
Here's the code that set up the variables and run the script:
private void btn_uploaddata_Click(object sender, EventArgs e)
{
var engine = Python.CreateEngine();
var scope = engine.CreateScope();
engine.SetSearchPaths(new Collection<string>(new[]
{
@"C:\Python27_XY",
@"C:\Python27_XY\DLLs",
@"C:\Python27_XY\Lib",
@"C:\Python27_XY\Lib\site-packages",
}));
scope.SetVariable("project_num", tb_projnum.Text);
scope.SetVariable("project_name", tb_projname.Text);
scope.SetVariable("proj_client", tb_projclient.Text);
engine.ExecuteFile(@"path/to/script.py", scope);
}
Is it only possible to use psycopg2 with IronPython ?