Hello, I'm using ironpython for a while to operate a .dll library. This works, but I need to use some CPython libraries so I would like to try to integrate de .dll in python 2.7 I installed pythonnet through > pip install pythonnet (Windows 7) installing pythonnet-2.3.0-cp27-cp27m-win_amd64.whl I proceeded like in ironpython: import clr import sys sys.path.append("C:/Program Files (x86)/DHI/2016/bin/") clr.AddReference('DHI.Tornado.NET') import TornadoNET and meanwhile in ironpython it works, in using python with pythonnet I get: File "Automated.py", line 32, in <module> clr.AddReference('DHI.Tornado.NET') System.IO.FileNotFoundException: Unable to find assembly 'DHI.Tornado.NET'. at Python.Runtime.CLRModule.AddReference(String Name) DHI.Tornado.NET is a .net 4.0 I read everything I could on previous similar issues, but I haven't been able to solve it. Someone has an idea? Best regards
have you tried changing
sys.path.append("C:/Program Files (x86)/DHI/2016/bin/")
to
sys.path.append("C:\\Program Files (x86)\\DHI\\2016\\bin")
also, just to add, as I also use python with DHI toolbox, and I am assuming
it is the case here, you can do it without explicitly setting the path, as
when you install DHI tools or MIKE, it creates an environment variable, so
you can use something like this
sys.path.append(os.path.split(os.path.dirname(os.environ['DHI_MIKE']))[0])
However, to be certain, you can test the output of
os.path.split(os.path.dirname(os.environ['DHI_MIKE']))[0]
in your python console before using it.
On 21 June 2017 at 15:26, A M
Hello,
I'm using ironpython for a while to operate a .dll library. This works, but I need to use some CPython libraries so I would like to try to integrate de .dll in python 2.7
I installed pythonnet through > pip install pythonnet (Windows 7) installing pythonnet-2.3.0-cp27-cp27m-win_amd64.whl
I proceeded like in ironpython:
import clr import sys sys.path.append("C:/Program Files (x86)/DHI/2016/bin/") clr.AddReference('DHI.Tornado.NET') import TornadoNET
and meanwhile in ironpython it works, in using python with pythonnet I get:
File "Automated.py", line 32, in <module> clr.AddReference('DHI.Tornado.NET') System.IO.FileNotFoundException: Unable to find assembly 'DHI.Tornado.NET '. at Python.Runtime.CLRModule.AddReference(String Name)
DHI.Tornado.NET is a .net 4.0
I read everything I could on previous similar issues, but I haven't been able to solve it. Someone has an idea?
Best regards
_________________________________________________ Python.NET mailing list - PythonDotNet@python.org https://mail.python.org/mailman/listinfo/pythondotnet
-- Regards Nikhil ***************************************** When the present determines the future, but the approximate present does not approximately determine the future - Edward Lorenz *****************************************
Hi,
Are you able to load any other .NET dlls with pythonnet?
Can you try inspecting the assembly binding log viewer according to this
troubleshooting wiki:
https://github.com/pythonnet/pythonnet/wiki/Troubleshooting-on-Windows-and-L...
Also in Process Explorer (Sysinternals tool) you can see if there are any
implicit assembly (.DLL) references, e.g. from GAC for CLR2/4
(C:/Windows/assembly, C:/Windows/Microsoft.NET/assembly). ILSPY can
generate similar information.
Finally try loading this assembly using .NET Reflection API:
https://stackoverflow.com/a/6365969/2230844
Thanks for trying pythonnet,
Denis
On Wed, Jun 21, 2017 at 2:26 AM, A M
Hello,
I'm using ironpython for a while to operate a .dll library. This works, but I need to use some CPython libraries so I would like to try to integrate de .dll in python 2.7
I installed pythonnet through > pip install pythonnet (Windows 7) installing pythonnet-2.3.0-cp27-cp27m-win_amd64.whl
I proceeded like in ironpython:
import clr import sys sys.path.append("C:/Program Files (x86)/DHI/2016/bin/") clr.AddReference('DHI.Tornado.NET') import TornadoNET
and meanwhile in ironpython it works, in using python with pythonnet I get:
File "Automated.py", line 32, in <module> clr.AddReference('DHI.Tornado.NET') System.IO.FileNotFoundException: Unable to find assembly 'DHI.Tornado.NET '. at Python.Runtime.CLRModule.AddReference(String Name)
DHI.Tornado.NET is a .net 4.0
I read everything I could on previous similar issues, but I haven't been able to solve it. Someone has an idea?
Best regards
_________________________________________________ Python.NET mailing list - PythonDotNet@python.org https://mail.python.org/mailman/listinfo/pythondotnet
I just looked again at your problem and noticed that you have 32-bit .NET
API, but using 64-bit CPython. Have you tried loading this .NET DLL from
32-bit and 64-bit IronPython or from 32-bit CPython?
On Wed, Jun 21, 2017, 2:36 AM A M
Hello,
I'm using ironpython for a while to operate a .dll library. This works, but I need to use some CPython libraries so I would like to try to integrate de .dll in python 2.7
I installed pythonnet through > pip install pythonnet (Windows 7) installing pythonnet-2.3.0-cp27-cp27m-win_amd64.whl
I proceeded like in ironpython:
import clr import sys sys.path.append("C:/Program Files (x86)/DHI/2016/bin/") clr.AddReference('DHI.Tornado.NET') import TornadoNET
and meanwhile in ironpython it works, in using python with pythonnet I get:
File "Automated.py", line 32, in <module> clr.AddReference('DHI.Tornado.NET') System.IO.FileNotFoundException: Unable to find assembly 'DHI.Tornado.NET '. at Python.Runtime.CLRModule.AddReference(String Name)
DHI.Tornado.NET is a .net 4.0
I read everything I could on previous similar issues, but I haven't been able to solve it. Someone has an idea?
Best regards _________________________________________________ Python.NET mailing list - PythonDotNet@python.org https://mail.python.org/mailman/listinfo/pythondotnet
Indeed, that WAS the issue. My system runs Windows 64-bit but for software
issues, I had to run a DHI software on the 32-bit version. Checking I see
that the working ironpython version is also 32-bit. Meanwhile my current
python version is 64-bit.
I installed python 32 bits and installed pythonnet through pip and it works
perfectly.
Thanks Nikhil and Denis
On 21 June 2017 at 18:27, Denis Akhiyarov
I just looked again at your problem and noticed that you have 32-bit .NET API, but using 64-bit CPython. Have you tried loading this .NET DLL from 32-bit and 64-bit IronPython or from 32-bit CPython?
On Wed, Jun 21, 2017, 2:36 AM A M
wrote: Hello,
I'm using ironpython for a while to operate a .dll library. This works, but I need to use some CPython libraries so I would like to try to integrate de .dll in python 2.7
I installed pythonnet through > pip install pythonnet (Windows 7) installing pythonnet-2.3.0-cp27-cp27m-win_amd64.whl
I proceeded like in ironpython:
import clr import sys sys.path.append("C:/Program Files (x86)/DHI/2016/bin/") clr.AddReference('DHI.Tornado.NET') import TornadoNET
and meanwhile in ironpython it works, in using python with pythonnet I get:
File "Automated.py", line 32, in <module> clr.AddReference('DHI.Tornado.NET') System.IO.FileNotFoundException: Unable to find assembly 'DHI.Tornado.NET '. at Python.Runtime.CLRModule.AddReference(String Name)
DHI.Tornado.NET is a .net 4.0
I read everything I could on previous similar issues, but I haven't been able to solve it. Someone has an idea?
Best regards _________________________________________________ Python.NET mailing list - PythonDotNet@python.org https://mail.python.org/mailman/listinfo/pythondotnet
_________________________________________________ Python.NET mailing list - PythonDotNet@python.org https://mail.python.org/mailman/listinfo/pythondotnet
участники (3)
-
A M
-
Denis Akhiyarov
-
Nikhil Garg