Marty Nelson wrote:

One of our developers asked me this question today, I don’t have an answer, so any help would be appreciated:

We came across an issue while testing the NuGenesis extension related to assembly versioning in scripts. The extension has a custom assembly, which is called by script:

a = AssemblyCache.GetAssembly("Symyx.SDMS.NuGenesis.SN6, Version=1.2.3.4, Culture=neutral, PublicKeyToken=e5750cf9faec8249")

clr.AddReference(a)

from Symyx.SDMS.NuGenesis.SN6 import *

We are adding reference to a version-specific assembly, and then we import from a namespace inside the assembly.

We have two document templates - each of them calls a different version of the extension assembly from the script. After opening both templates within the same Notebook session, both versions of the assembly are in memory, and at this point the *import* call seems to import the version that was loaded the last time (as opposed to the one we reference by version in the script). Is there a way around this?


Instead of using imports could you fetch the classes you need (etc) from the assembly objects? Namespaces are normally available as attributes on the assembly objects from within IronPython.

After doing clr.AddReference the assembly just loaded is usually the last in clr.References - alternatively you can load them directly with Assembly.Load.

HTH

Michael

=======
Notice: This e-mail message, together with any attachments, contains
information of Symyx Technologies, Inc. or any of its affiliates or
subsidiaries that may be confidential, proprietary, copyrighted,
privileged and/or protected work product, and is meant solely for
the intended recipient. If you are not the intended recipient, and
have received this message in error, please contact the sender
immediately, permanently delete the original and any copies of this
email and any attachments thereto.

------------------------------------------------------------------------

_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog


_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to