<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>This particular error is actually informative, and even gives a URL for how to fix it:&nbsp;<a href="http://go.microsoft.com/fwlink/?LinkId=155569" target="_blank">http://go.microsoft.com/fwlink/?LinkId=155569</a>. But I'll summarize:</div><div><br></div><div>You're running the script from a network share (looks like you're using Parallels with shared Mac drives?). Also looks like you're running this code from the Visual Studio repl? To get this to work you need to add the following to the &lt;runtime&gt; section of c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe.config:</div><div><br></div><div>&lt;loadFromRemoteSources enabled="true"/&gt;</div><div><br></div><div>Note: You'll have to add this to any .NET app that runs IronPython scripts from E:\ which load assemblies (eg, ipy.exe, yourhost.exe ...). I currently have the same setup with Paralles, and this is what I do. To avoid this, store all your .NET stuff on an drive actually mounted in Windows.</div><div><br></div><div>Also, You didn't need to copy your assembly into IronPython's directory. Store your assemblies in your own directory, add that directory to sys.path, sys.path.append("C:<a href="smb://path//to//assemblies">\\path\\to\\assemblies</a>"), and then clr.AddReference("LumensWorks.Framework.IO") will load it. Also, loading the assembly first and then adding it as a reference isn't necessary, just extra typing your your part.</div><div><br></div><div>~Jimmy</div><div><br></div><div>On Jul 11, 2011, at 3:48 PM, Slide wrote:</div><blockquote type="cite">The next version of IP should have csv module support in it...I know that doesn't help you NOW, but should in the future.If the DLL is in the DLLs directory, you should be able to load by just using the clr.AddReference method I believe.<div>
<br></div><div>Thanks,</div><div><br></div><div>slide<br><br><div class="gmail_quote">On Mon, Jul 11, 2011 at 12:16 PM, Chris <span dir="ltr">&lt;<a href="mailto:phatfish@gmail.com">phatfish@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto; ">Hi all,<br><br>Sorry im a .NET newbie so im going to ask here without really trying to fix this myself.<br><br>I want to import a CSV lib, as explained here:<br>
<br><a href="http://www.ironpython.info/index.php/Reading_CSV_Files" target="_blank">http://www.ironpython.info/index.php/Reading_CSV_Files</a><br>

<br>My code is this, im just testing the import works at the moment:<br><br>import clr<br>from System.Reflection import Assembly<br>assembly_path = "C:\Program Files (x86)\IronPython 2.7\DLLs\LumenWorks.Framework.IO.dll"<br>


assembly = Assembly.LoadFile(assembly_path)<br>clr.AddReference(assembly)<br><br>I receive this error (im on Win7 with .NET4 installed):<br><br>Running E:\Users\Chris\Documents\Visual Studio 2010\Projects\BACS18 Converter\BACS18 Converter\Program.py<br>


Traceback (most recent call last):<br>&nbsp; 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<br>


&nbsp;&nbsp;&nbsp; exec(code, self.exec_mod.__dict__, self.exec_mod.__dict__)<br>&nbsp; File "E:\Users\Chris\Documents\Visual Studio 2010\Projects\BACS18 Converter\BACS18 Converter\Program.py", line 2, in &lt;module&gt;<br>&nbsp;&nbsp;&nbsp; import SPA<br>


&nbsp; File "E:\Users\Chris\Documents\Visual Studio 2010\Projects\BACS18 Converter\BACS18 Converter\SPA.py", line 4, in &lt;module&gt;<br>&nbsp;&nbsp;&nbsp; assembly = Assembly.LoadFile(assembly_path)<br>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 <a href="http://go.microsoft.com/fwlink/?LinkId=155569" target="_blank">http://go.microsoft.com/fwlink/?LinkId=155569</a> for more information.<br>


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


<br>Many thanks,<br><font color="#888888">Chris<br>
</font><br>_______________________________________________<br>
Ironpython-users mailing list<br>
<a href="mailto:Ironpython-users@python.org">Ironpython-users@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/ironpython-users" target="_blank">http://mail.python.org/mailman/listinfo/ironpython-users</a><br>
</blockquote></div></div></blockquote></div><br><div><br></div><div><br></div></body></html>