[Ironpython-users] AccessViolationException on Python.CreateEngine() call

Igor Brejc igor.brejc at gmail.com
Sun Aug 7 08:12:11 CEST 2011


I'm developing a cartography application (http://maperitive.net) in C#
and I plan to use IronPython as a scripting extension of the
application. I've been successfully using IronPython for several
months and most users don't have any issues with it, but a small
percentage of users is having problems.

With the help from one of them I managed to dig out the exception
stack trace. The exception occurs while calling the
Python.CreateEngine() method:

System.Reflection.TargetInvocationException: Exception has been thrown
by the target of an invocation.
---> System.Reflection.TargetInvocationException:
Failed to load language 'IronPython 2.6.2': Attempted to read or write
protected memory. This is often an indication that other memory is
---> System.AccessViolationException: Attempted to read or write
protected memory. This is often an indication that other memory is
at Microsoft.Scripting.Actions.TopNamespaceTracker.PublishComTypes(Assembly
at IronPython.Runtime.Binding.PythonBinder.DomainManager_AssemblyLoaded(Object
sender, AssemblyLoadedEventArgs e)
at IronPython.Runtime.Binding.PythonBinder..ctor(PythonContext
pythonContext, CodeContext context)
at IronPython.Runtime.PythonContext..ctor(ScriptDomainManager manager,
IDictionary`2 options)
--- End of inner exception stack trace ---
at Microsoft.Scripting.Runtime.LanguageConfiguration.LoadLanguageContext(ScriptDomainManager
domainManager, Boolean& alreadyLoaded)
at Microsoft.Scripting.Runtime.DlrConfiguration.LoadLanguageContext(ScriptDomainManager
manager, LanguageConfiguration config)
at Microsoft.Scripting.Runtime.DlrConfiguration.TryLoadLanguage(ScriptDomainManager
manager, AssemblyQualifiedTypeName providerName, LanguageContext&
at Microsoft.Scripting.Runtime.ScriptDomainManager.GetLanguageByTypeName(String
at Microsoft.Scripting.Hosting.ScriptRuntime.GetEngineByTypeName(String
at IronPython.Hosting.Python.GetEngine(ScriptRuntime runtime)

I couldn't find anything on Google that would be related to this. Some
info about the user's environment:

- Win7 64bit
- Using .NET 2.0-3.5 (not 4.0)
- IronPython is not installed in GAC, the app uses assemblies locally
on the disk (v 2.6.2)
- The user runs the application as an ordinary user (not administrator)

I use Win7 64bit myself, but I didn't have any such problems and I
cannot reproduce this problem on any of my machines (Win7, Ubuntu).

Thanks for any help,
Igor Brejc

More information about the Ironpython-users mailing list