Please dis-regard this issue. I have solved it.

I forgot that I turned on "Break when exceptions cross AppDomain or
managed/native boundaries" in options.

Thanks anyway

On Thu, Jan 31, 2013 at 12:18 PM, Ian Gorse <[email protected]> wrote:
> Hello List,
>
> I am having a very weird error when trying to execute a very simple
> python script from within a C# 2010 express project
> Everytime the application executes the script, It crashes with the
> following error
>
> IronPython.Runtime.Exceptions.ImportException crossed a native/managed 
> boundary
> not a Zip file
>
> I have managed to break down the issue into a small sample application as 
> below.
>
> The project is a blank project, that only contains the following code:
>
> using System;
> using System.Collections.Generic;
> using System.ComponentModel;
> using System.Data;
> using System.Drawing;
> using System.Linq;
> using System.Text;
> using System.Windows.Forms;
> using Microsoft.Scripting.Hosting;
> using IronPython.Hosting;
>
> namespace WindowsFormsApplication1
> {
>     public partial class Form1 : Form
>     {
>         public Form1()
>         {
>             InitializeComponent();
>         }
>
>         private void Form1_Load(object sender, EventArgs e)
>         {
>             ScriptEngine engine;
>             ScriptSource source;
>             ScriptScope sys;
>             ScriptScope scope;
>
>             String filename = @"c:\tmp\test.py";
>             engine = Python.CreateEngine();
>             source = engine.CreateScriptSourceFromFile(filename);
>             sys = Python.GetSysModule(engine);
>             scope = engine.CreateScope();
>             source.Execute();   // CRASHES HERE
>         }
>     }
> }
>
> and the test.py is even simpler
>
> import sys
> import clr
>
> clr.AddReference('System.Xml')
> from System.Xml import XmlDocument
>
> clr.AddReference('System.Windows.Forms')
> from System.Windows.Forms import MessageBox
>
> Oddly, if I comment out the 'from....' lines, then no error appears.
> What is even more confusing to me is that if I compile the application
> and run it using executable file, no error appears.
>
> My project was working fine 2 days ago, and the only change I made
> yesterday was that I un-installed C# 2010 express, rebooted and
> re-installed it.
>
> Does anyone know what is going wrong with my project
>
> Thanks
_______________________________________________
Ironpython-users mailing list
[email protected]
http://mail.python.org/mailman/listinfo/ironpython-users

Reply via email to