Menu

Automation (Linux/Mono/Pythonnet) exception by loading file or assembly

Natalie
2020-06-30
2020-07-06
  • Natalie

    Natalie - 2020-06-30

    Hi Daniel,

    For some time I am using DWSIM Automation with Python on Windows successful. Thanks to you and all related developers!

    But, if I am trying to realize something on Linux the following error appears:

    "
    Traceback (most recent call last):
    File "water.py", line 19, in <module>
    interface = dwa.Automation()
    System.TypeLoadException: Could not load type of field 'DWSIM.My.MyProject:m_ComputerObjectProvider' (0) due to: Could not load file or assembly 'Microsoft.VisualBasic, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
    at (wrapper remoting-invoke-with-check) DWSIM.FormMain..ctor()
    at DWSIM.Automation.Automation..ctor () [0x0000c] in <8f82409bbb9a4a7d9ff5af9df16f112a>:0
    at (wrapper managed-to-native) System.Reflection.MonoCMethod.InternalInvoke(System.Reflection.MonoCMethod,object,object[],System.Exception&)
    at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x00005] in <7cd4deb8302a478d9d393f24754841da>:0
    "</module>

    By removing the brackets at the end of line 19 another error appears.

    "
    ['CalculateFlowsheet', 'Equals', 'Finalize', 'GetHashCode', 'GetType', 'LoadFlowsheet', 'MemberwiseClone', 'Overloads', 'ReferenceEquals', 'SaveFlowsheet', 'ToString', 'call', 'class', 'delattr', 'delitem', 'dir', 'doc', 'eq', 'format', 'ge', 'getattribute', 'getitem', 'gt', 'hash', 'init', 'init_subclass', 'iter', 'le', 'lt', 'module', 'ne', 'new', 'overloads', 'reduce', 'reduce_ex', 'repr', 'setattr', 'setitem', 'sizeof', 'str', 'subclasshook']
    Traceback (most recent call last):
    File "water.py", line 26, in <module>
    flowsheet = interface.LoadFlowsheet("water.dwxml")
    TypeError: No method matches given arguments for LoadFlowsheet
    "</module>

    OS: Debian 10 (Kernel 5.6.14)
    Mono: 6.10.0 (example is running successful)
    pythonnet: 2.4.0
    DWSIM: 6.0.4 (GUI is running, path to dll files is known)

    Please, do you know what could be the solution to this issue?

    Thank you!

     
  • Daniel Medeiros

    Daniel Medeiros - 2020-06-30

    Automation was designed to work only on Windows. For Linux and macOS I'll have to create a new interface. Sorry.

    Daniel

     
  • Daniel Medeiros

    Daniel Medeiros - 2020-07-06

    Automation now works on v6.0 Update 5 running on macOS and Linux through the new Automation2 class. Give it a try and let me know if it works for you.