Discussion:
[Python.NET] I can't run test_engine.py with nPython.exe. Would you tell me why?
Seungweon Park
2013-04-04 15:34:55 UTC
Permalink
Hi,

I ran every tests from src\tests. However, I can't run runtests.py and
test_module.py.

test_module.py has an error message in console window and pops up "Python
Console" with "Python Console has stopped working" message. Would you tell
me what I need to check to run this script? It looks to me having a problem
when loading a module.

Thanks,
Spark.

C:\Automation\PythonNet\src\tests>..\..\npython test_engine.py

Unhandled Exception: System.Reflection.TargetInvocationException: Exception
has been thrown by the target of an invocati
on. ---> System.AccessViolationException: Attempted to read or write
protected memory. This is often an indication that
other memory is corrupt.
at Python.Runtime.Runtime.PyImport_ImportModule(String name)
at Python.Runtime.PythonEngine.ImportModule(String name) in
c:\Automation\PythonNet\src\runtime\pythonengine.cs:line
276
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[]
arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj,
Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters
, CultureInfo culture)
at Python.Runtime.MethodBinder.Invoke(IntPtr inst, IntPtr args, IntPtr
kw, MethodBase info, MethodInfo[] methodinfo)
in c:\Automation\PythonNet\src\runtime\methodbinder.cs:line 356
at Python.Runtime.MethodObject.Invoke(IntPtr target, IntPtr args, IntPtr
kw, MethodBase info) in c:\Automation\Python
Net\src\runtime\methodobject.cs:line 63
at Python.Runtime.MethodBinding.tp_call(IntPtr ob, IntPtr args, IntPtr
kw) in c:\Automation\PythonNet\src\runtime\met
hodbinding.cs:line 135
at Python.Runtime.Runtime.Py_Main(Int32 argc, String[] argv)
at Python.Runtime.PythonConsole.Main(String[] args) in
c:\Automation\PythonNet\src\console\pythonconsole.cs:line 24

C:\Automation\PythonNet\src\tests>
Seungweon Park
2013-04-04 17:49:08 UTC
Permalink
Now I'm getting different error message after I have nPython.exe which I
compiled from source code.

According to the comments from test_module.py,

Line 209
# This should fail until System.Windows.Forms has been
# imported or that assembly has been explicitly loaded.
# True for Windows; Not so for Mono 2.8.1

Line 214
# The test fails when the project is compiled with MS VS
2005. Dunno why :(
# Fails (as expected) on Late Binding model. Works as expected on an
interactive sesson.

Is this failure as we expected in windows machine?

Thanks,
Spark.

C:\Automation\PythonNet\src\tests>..\..\npython test_module.py
........F................
======================================================================
FAIL: testImplicitAssemblyLoad (__main__.ModuleTests)
Test implicit assembly loading via import.
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_module.py", line 216, in testImplicitAssemblyLoad
self.assertRaises(ImportError, test)
AssertionError: ImportError not raised

----------------------------------------------------------------------
Ran 25 tests in 1.445s

FAILED (failures=1)
Post by Seungweon Park
Hi,
I ran every tests from src\tests. However, I can't run runtests.py and
test_module.py.
test_module.py has an error message in console window and pops up "Python
Console" with "Python Console has stopped working" message. Would you tell
me what I need to check to run this script? It looks to me having a problem
when loading a module.
Thanks,
Spark.
C:\Automation\PythonNet\src\tests>..\..\npython test_engine.py
Exception has been thrown by the target of an invocati
on. ---> System.AccessViolationException: Attempted to read or write
protected memory. This is often an indication that
other memory is corrupt.
at Python.Runtime.Runtime.PyImport_ImportModule(String name)
at Python.Runtime.PythonEngine.ImportModule(String name) in
c:\Automation\PythonNet\src\runtime\pythonengine.cs:line
276
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[]
arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj,
Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters
, CultureInfo culture)
at Python.Runtime.MethodBinder.Invoke(IntPtr inst, IntPtr args, IntPtr
kw, MethodBase info, MethodInfo[] methodinfo)
in c:\Automation\PythonNet\src\runtime\methodbinder.cs:line 356
at Python.Runtime.MethodObject.Invoke(IntPtr target, IntPtr args,
IntPtr kw, MethodBase info) in c:\Automation\Python
Net\src\runtime\methodobject.cs:line 63
at Python.Runtime.MethodBinding.tp_call(IntPtr ob, IntPtr args, IntPtr
kw) in c:\Automation\PythonNet\src\runtime\met
hodbinding.cs:line 135
at Python.Runtime.Runtime.Py_Main(Int32 argc, String[] argv)
at Python.Runtime.PythonConsole.Main(String[] args) in
c:\Automation\PythonNet\src\console\pythonconsole.cs:line 24
C:\Automation\PythonNet\src\tests>
Loading...