[Ironpython-users] not a Zip file error
Ian Gorse
unigee at gmail.com
Thu Jan 31 13:18:36 CET 2013
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
More information about the Ironpython-users
mailing list