This is simply because mono cannot load the flowsheet form's icon. Even if it is not displayed, I need to create a new instance of the flowsheet, which is a Form... I don't know what else to do.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
gives the error below. Do you know the reason for this error? Thanks!
FileNotFoundException: Could not load file or assembly 'OpenTK, Version=3.1.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4' or one of its dependencies. The system cannot find the file specified.
at DWSIM.FlowsheetSurface_SkiaSharp..ctor()
at DWSIM.FormFlowsheet..ctor() in C:\Users\Daniel\source\repos\DanWBR\dwsim6\DWSIM\Forms\Flowsheet\FormFlowsheet.vb:line 75
at DWSIM.FormMain.LoadXML(String path, Action`1 ProgressFeedBack, String simulationfilename, Boolean forcommandline) in C:\Users\Daniel\source\repos\DanWBR\dwsim6\DWSIM\Forms\Main Window\FormMain.vb:line 1573
at DWSIM.Automation.Automation.LoadFlowsheet(String filepath) in C:\Users\Daniel\source\repos\DanWBR\dwsim6\DWSIM.Automation\Interface.cs:line 41
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes. I set the directory to directory contialing DWSIM.exe and the dll files using System.IO.Directory.SetCurrentDirectory(). In addition, I tried running the .py script from the same directory with all the dll files and that didn't work either
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I still have not resolved the above 'OpenTK' error when trying to run DWSIM Automation using pythonnet on windows (from outside of DWSIM). Could you please advise?
I am wondering if it is a problem on my end or a bug with DWSIM Automation. Are you able to interface with DWSIM using python outside of DWSIM?
I think others may desire this same functionality. Please advise if it is possible
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
v6.0 Update 5 fixed the automation issue on Windows. Also, automation now works on macOS and Linux through the new Automation2 class. Give it a try and let me know if it works for you.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I tested my python code with the v6.0 Update 5 for Windows and automation is now working! Thanks for the update. It seems I can now do everything from python outside of DWSIM which allows for using external python packages.
I have not had a chance to test the automation on macOS yet, I will reply to this thread if I have a chance to test that
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Try replacing DWSIM.exe with this one: https://drive.google.com/open?id=1iv3g7bBWsItlDNYYw0iiWA5Sp5aWHmwA
Then use System.Windows.Forms and System.Drawing from DWSIM app bundle.
when I replace DWSIM.exe I get the same System.ArgumentNullException: Value cannot be null error as I had previously
This is simply because mono cannot load the flowsheet form's icon. Even if it is not displayed, I need to create a new instance of the flowsheet, which is a Form... I don't know what else to do.
is this something that you intend to provide support for? Or is my best bet for using automation with python to remote into a windows machine
Yes, but I can't give you a release date... I could try working around this mono bug but it is a very time consuming task.
OK thanks. I am now trying to use automation with python and pythonnet on a windows machine to bypass the Mono issue. Now
interf = DWSIM.Automation.Automation()
suceeds but
sim = interf.LoadFlowsheet("samples/Cavett's Problem.dwxml")
gives the error below. Do you know the reason for this error? Thanks!
FileNotFoundException: Could not load file or assembly 'OpenTK, Version=3.1.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4' or one of its dependencies. The system cannot find the file specified.
at DWSIM.FlowsheetSurface_SkiaSharp..ctor()
at DWSIM.FormFlowsheet..ctor() in C:\Users\Daniel\source\repos\DanWBR\dwsim6\DWSIM\Forms\Flowsheet\FormFlowsheet.vb:line 75
at DWSIM.FormMain.LoadXML(String path, Action`1 ProgressFeedBack, String simulationfilename, Boolean forcommandline) in C:\Users\Daniel\source\repos\DanWBR\dwsim6\DWSIM\Forms\Main Window\FormMain.vb:line 1573
at DWSIM.Automation.Automation.LoadFlowsheet(String filepath) in C:\Users\Daniel\source\repos\DanWBR\dwsim6\DWSIM.Automation\Interface.cs:line 41
Did you set the current directory to DWSIM's?
Yes. I set the directory to directory contialing DWSIM.exe and the dll files using System.IO.Directory.SetCurrentDirectory(). In addition, I tried running the .py script from the same directory with all the dll files and that didn't work either
Hi Daniel,
I still have not resolved the above 'OpenTK' error when trying to run DWSIM Automation using pythonnet on windows (from outside of DWSIM). Could you please advise?
I am wondering if it is a problem on my end or a bug with DWSIM Automation. Are you able to interface with DWSIM using python outside of DWSIM?
I think others may desire this same functionality. Please advise if it is possible
Can you share your python code so I can try it from here?
Thanks for your help. Code below. Running Python 3.6 on Windows 7 with latest DWSIM
import clr
import sys
import System
sys.path.append('C:/Users/ryan/AppData/Local/DWSIM6')
System.IO.Directory.SetCurrentDirectory('C:/Users/ryan/AppData/Local/DWSIM6')
clr.AddReference("System.Core")
clr.AddReference("System.IO")
clr.AddReference("System.Collections")
clr.AddReference("System.Memory")
clr.AddReference("System.Windows.Forms")
clr.AddReference('DWSIM')
clr.AddReference('DWSIM.Automation')
clr.AddReference('DWSIM.Interfaces')
clr.AddReference('CapeOpen')
import DWSIM
interf = DWSIM.Automation.Automation()
sim = interf.LoadFlowsheet("samples/Cavett's Problem.dwxml")
v6.0 Update 5 fixed the automation issue on Windows. Also, automation now works on macOS and Linux through the new Automation2 class. Give it a try and let me know if it works for you.
I've added a sample project to test automation on macOS to github, which you can run using VS for Mac: https://github.com/DanWBR/DWSIM.Automation.Test.macOS
Hi Daniel,
I tested my python code with the v6.0 Update 5 for Windows and automation is now working! Thanks for the update. It seems I can now do everything from python outside of DWSIM which allows for using external python packages.
I have not had a chance to test the automation on macOS yet, I will reply to this thread if I have a chance to test that