[Python.NET] Python, the CLR and System.Security?

michael_sweeney at agilent.com michael_sweeney at agilent.com
Tue Oct 5 00:37:26 CEST 2004


Hi,

I am trying to integrate NUnit with our current automated test tool. 

I copied the two PythonNet dlls, Python.Runtime.dll and CLR.dll, into
the ActiveState Python 2.3 directory.

When I try to run my wrapper module, ATFAdaptor.cs, which is a stripped
down/modified version of the ConsoleUi.cs file, I receive the following
CLR Exception:


ex.Message:

Request for the permission of type
System.Security.Permissions.FileIOPermission, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
failed.

ex.Stacktrace:

Server stack trace:
   at System.Security.CodeAccessSecurityEngine.CheckHelper(PermissionSet
grantedSet, PermissionSet deniedSet, CodeAccess
Permission demand, PermissionToken permToken)
   at System.Security.CodeAccessSecurityEngine.Check(PermissionToken
permToken, CodeAccessPermission demand, StackCrawlM
ark& stackMark, Int32 checkFrames, Int32 unrestrictedOverride)
   at
System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission cap,
StackCrawlMark& stackMark)
   at System.Security.CodeAccessPermission.Demand()
   at System.IO.Directory.GetCurrentDirectory()
   at System.Environment.get_CurrentDirectory()
   at NUnit.Core.TestSuiteBuilder.Load(String assemblyName)
   at NUnit.Core.TestSuiteBuilder.Build(String assemblyName, Int32
assemblyKey)
   at NUnit.Core.TestSuiteBuilder.Build(String assemblyName)
   at NUnit.Core.RemoteTestRunner.Load(String assemblyName)
   at
System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage
(MethodBase mb, Object[] args, Object serv
er, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
   at
System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IM
essage msg, Int32 methodPtr, Boolean fExec
uteInContext)

Exception rethrown at [0]:
   at
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg)
   at
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type)
   at NUnit.Core.TestRunner.Load(String assemblyName)
   at NUnit.Util.TestDomain.Load(String assemblyFileName, String
testFixture)
   at NUnit.Util.TestDomain.Load(NUnitProject project, String
testFixture)
   at NUnit.ATF.ATFAdaptor.Run() in c:\documents and
settings\sweeneym\my documents\visual studio projects\nunit-2.2.0\a
tf2nunitadaptor\atfadaptor.cs:line 277

It looks like the regular CPython version has some sort of permission
problems interacting between managed code and python. 

Is this something I can work around, or fix? 

Also, if I run the wrapper module with the PythonNET version of the
python.exe, the wrapper can execute the NUnit test, but hangs
afterwards.


Thanks in advance...

Mike



More information about the PythonDotNet mailing list