[Ironpython-users] Importing .NET Lib Error

Chris phatfish at gmail.com
Mon Jul 11 21:16:15 CEST 2011


Hi all,

Sorry im a .NET newbie so im going to ask here without really trying to fix
this myself.

I want to import a CSV lib, as explained here:

http://www.ironpython.info/index.php/Reading_CSV_Files

My code is this, im just testing the import works at the moment:

import clr
from System.Reflection import Assembly
assembly_path = "C:\Program Files (x86)\IronPython
2.7\DLLs\LumenWorks.Framework.IO.dll"
assembly = Assembly.LoadFile(assembly_path)
clr.AddReference(assembly)

I receive this error (im on Win7 with .NET4 installed):

Running E:\Users\Chris\Documents\Visual Studio 2010\Projects\BACS18
Converter\BACS18 Converter\Program.py
Traceback (most recent call last):
  File "c:\Program Files (x86)\Microsoft Visual Studio
10.0\Common7\IDE\Extensions\Microsoft\Python Tools for Visual
Studio\1.0\visualstudio_py_repl.py", line 358, in run_file_as_main
    exec(code, self.exec_mod.__dict__, self.exec_mod.__dict__)
  File "E:\Users\Chris\Documents\Visual Studio 2010\Projects\BACS18
Converter\BACS18 Converter\Program.py", line 2, in <module>
    import SPA
  File "E:\Users\Chris\Documents\Visual Studio 2010\Projects\BACS18
Converter\BACS18 Converter\SPA.py", line 4, in <module>
    assembly = Assembly.LoadFile(assembly_path)
SystemError: An attempt was made to load an assembly from a network location
which would have caused the assembly to be sandboxed in previous versions of
the .NET Framework. This release of the .NET Framework does not enable CAS
policy by default, so this load may be dangerous. If this load is not
intended to sandbox the assembly, please enable the loadFromRemoteSources
switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more
information.
>>>

Two questions:
Is this the best way to be importing a .NET lib, that tutorial appears to
have been written in 2007?
If it is, how do i fix that error, im not loading from a network location..?

Many thanks,
Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20110711/905fb90f/attachment.html>


More information about the Ironpython-users mailing list