It’s already there, 3. line. The error disappears when I add DLL to GAC. But it’s a workaround. I am still interested can this be fixed otherwise.
From: Slide [mailto:slide.o....@gmail.com] Sent: 04 April 2017 17:54 To: Petri Alapiessa <petri.alapie...@varian.com>; ironpython-users@python.org Subject: Re: [Ironpython-users] Ironpython cannot load .Net DLL Please try adding the Dependencies directory to the sys.path. You can do it like this: sys.path.append('path/to/Dependencies') On Tue, Apr 4, 2017, 07:52 Petri Alapiessa <petri.alapie...@varian.com<mailto:petri.alapie...@varian.com>> wrote: Hi, My company uses .NET and has libraries to application interface. I would like to use python to invoke application functions. A prerequisite is that I can load .NET DLL that interacts with that application. But I am stuck here, Ironpython cannot load one of the dependent DLL's or it's dependency. My python script references Components.dll, which in turn references some other .NET DLL’s, including “Blaa.Blaa.Testing.Automation.dll”. That is not found, see log below Here is my Ironpython script: -------------------------------------------------------------------------------------------------------------------------- import clr import sys sys.path.append('D:\\tfs\\sandbox\\calculatordemo\\calculatordemo\\_Dependencies') from exceptions import SystemError, Exception import System import System.Reflection clr.AddReference('Components') from System.Reflection import ReflectionTypeLoadException try: from Components import Calculator calculator = Calculator() calculator.Start() print Calculator.Ready() except System.Reflection.ReflectionTypeLoadException as e2: print e2.LoaderExceptions[0] except Exception as e2: print('Exception occurred: ' + e2.message) -------------------------------------------------------------------------------------------------------------------------- Output: System.IO.FileNotFoundException: Could not load file or assembly 'Blaa.Blaa.Testing.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=bd317adc1d7d9856' or one of its dependencies. The system cannot find the file specified. File name: 'Blaa.Blaa.Testing.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=bd317adc1d7d9856' === Pre-bind state information === LOG: DisplayName = Blaa.Blaa.Testing.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=bd317adc1d7d9856 (Fully-specified) LOG: Appbase = file:///C:/Program<file:///C:\Program> Files (x86)/IronPython 2.7/ LOG: Initial PrivatePath = NULL Calling assembly : (Unknown). === LOG: This bind starts in default load context. LOG: Using application configuration file: C:\Program Files (x86)\IronPython 2.7\ipy64.exe.Config LOG: Using host configuration file: LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config. LOG: Post-policy reference: Blaa.Blaa.Testing.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=bd317adc1d7d9856 LOG: The same bind was seen before, and was failed with hr = 0x80070002. --------------------------------------------------------------------------------------------------------------------------- All dependencies should be in _Dependencies-folder. Similar script created as C# project works. IL Spy does not show any dependencies that should not be available. Thanks for any help in helping to solve this! I did not yet find any help after several days of studies. Best Wishes, Petri Alapiessa _______________________________________________ Ironpython-users mailing list Ironpython-users@python.org<mailto:Ironpython-users@python.org> https://mail.python.org/mailman/listinfo/ironpython-users<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail.python.org%2Fmailman%2Flistinfo%2Fironpython-users&data=01%7C01%7CPetri.Alapiessa%40varian.com%7C91f1d196159f413b32ae08d47b6a8149%7Cc49d9c494b114ccdb13772f88c68a252%7C1&sdata=xsNKnHG9P0ENq3vVKICi0wAPQbZK1ciYenkgtr6yRwo%3D&reserved=0>
_______________________________________________ Ironpython-users mailing list Ironpython-users@python.org https://mail.python.org/mailman/listinfo/ironpython-users