I have a very simple script, message.py:

from CLR.System.Windows.Forms import MessageBox
MessageBox.Show("hello");

If I run this from the console it works fine and I see the MessageBox. 

However, if I embed PythonNet in my .Net 1.1 C# app, Python loads correctly, no exceptions are thrown, but I don't see the MessageBox. 

This is the C# code:

        PythonEngine.Initialize();

        IntPtr state = PythonEngine.AcquireLock();

        StreamReader sr = File.OpenText("C:/message.py");
        string pythoncode = sr.ReadToEnd();
        sr.Close();
        
        PythonEngine.RunString(pythoncode);

        PythonEngine.ReleaseLock(state);


Any idea what's going on?

Thanks,
n
_________________________________________________
Python.NET mailing list - PythonDotNet@python.org
http://mail.python.org/mailman/listinfo/pythondotnet

Reply via email to