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

Brian Lloyd brian at zope.com
Tue Oct 5 19:25:31 CEST 2004


Hi Michael - 

I know embarassingly little about the gory details of CAS, but 
I suspect that you may need to do some configuration to grant 
rights to the Python.Runtime assembly (generally you may as 
well grant it full trust, since all Python code generally runs 
under the radar of the .NET security system...)

HTH,


Brian Lloyd        brian at zope.com
V.P. Engineering   540.361.1716              
Zope Corporation   http://www.zope.com 


> -----Original Message-----
> From: pythondotnet-bounces at python.org
> [mailto:pythondotnet-bounces at python.org]On Behalf Of
> michael_sweeney at agilent.com
> Sent: Monday, October 04, 2004 5:37 PM
> To: pythondotnet at python.org
> Subject: [Python.NET] Python, the CLR and System.Security?
> 
> 
> 
> 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
> 
> _________________________________________________
> Python.NET mailing list - PythonDotNet at python.org
> http://mail.python.org/mailman/listinfo/pythondotnet
> 


More information about the PythonDotNet mailing list