IronPython API

note Details

From C 39.5.21

  • A detailed description of the API is located in the client's help folder (%client_folder%\help).
  • If you have trouble opening the file, see the hints below.
  • Another version can be found here: Iron_python_API_C39521.chm

From C 39.5.17

  • A detailed description of the API is located in the client's help folder (%client_folder%\help).
  • If you have trouble opening the file, see the hints below.
  • Another version can be found here: Iron_python_API_C39517.chm

From C 39.5.11

  • A detailed description of the API is located in the client's help folder (%client_folder%\help).
  • If you have trouble opening the file, see the hints below.
  • Another version can be found here: Iron_python_API_C39511.chm

From C 39.5.8

  • A detailed description of the API is located in the client's help folder (%client_folder%\help).
  • If you have trouble opening the file, see the hints below.
  • Another version can be found here: Iron_python_API_C3958.chm

From C 39.5.6

  • A detailed description of the API is located in the client's help folder (%client_folder%\help).
  • If you have trouble opening the file, see the hints below.
  • Another version can be found here: Iron_python_API_C3956.chm

From C 39.5.2

  • A detailed description of the API is located in the client's help folder (%client_folder%\help).
  • If you have trouble opening the file, see the hints below.
  • Another version can be found here: Iron_python_API_C3952.chm

Up to C 39.5.2

  • A detailed description of the API is located in the client's help folder (%client_folder%\help).
  • If you have trouble opening the file, see the hints below.
  • Another version can be found here: Iron_python_API.chm

more How to

  • To access to the documentation, download the file mentioned above.
  • Right click on the file and select properties.
  • Click on Unblock and then on Apply.

stop Please note

  • We only support the methods listed in the appropriate IronPythonAPI.
  • Every Client function that is used via IronPython but is not part of the official API may not work anymore after a Client update.

Various Know-how

Embedding IronPython code in a module

more How to
  • Select a DA in your module
  • Insert a new DF with ID 004336 and change DF-Verhalten to py
  • Close the DA and reopen it
  • Expand the DI and paste your code into IronPython Skript
  • Save and start the module
  • Add the following code at the top:
     # coding: latin-1"
  • Code that looks like this in C#:
    GetValue<T>()
  • Will look like this in IronPython:
    GetValue[T]()

warning Note

  • Keep in mind for C#, Visual Basic and Visual C++ it is "String" but in Python it is "str"
  • For reason of the IronPython bug, the indexers of the generic .NET collections will not work if a first access to them was not correct (for example the indexer requires int but you put a string value). So use the attribute _getitem_ instead of [] explicitly or please be sure that indexers are used correct.

Reload modules on local client without client restart

info Information
  • In order to apply code changes without the need of a client restart, use the following guideline.

more How to

  • Insert the following code prior to the import statement of the target module:
    sys.modules.Remove("MyModule")
  • After the statement above, place your unchanged import statement:
    from MyModule import MyModule
  • The conditions for your AddReference-statement stays the same as before - it needs to stay prior to your import statement but it can stay before or after the statement of step 1.

Remembering data across multiple modules

  • Data can be stored somewhere in the __builtins__ dictionary
  • Unlike the server, each Client has its own IronPython interpreter, so everyone has their own copy of __builtins__

stop Stop

  • Do not use __builtins__ when calling server code, for example with server_execute()

Useful snippets

Method Parameter Return value Comment
df   Returns the DF the IronPython script was executed from

Getting the value of a DI that is in the same DA as the IronPython macro:

df.DataArea.ChildrenDF[df.DataArea.Customizing.get_df_by_name(DF-Python-ID)].GetValue[T]()

Microsoft .NET Framework

Topic attachments
I Attachment Action Size Date Who Comment
elsechm Iron_python_API.chm manage 443.8 K 2013-06-06 - 11:49 IrinaZieger  
elsechm Iron_python_API_C39511.chm manage 414.4 K 2014-06-02 - 12:50 JuliaSchwarz  
elsechm Iron_python_API_C39517.chm manage 416.8 K 2016-11-24 - 11:42 JuliaSchwarz  
elsechm Iron_python_API_C3952.chm manage 452.0 K 2013-07-18 - 13:30 IrinaZieger  
elsechm Iron_python_API_C39521.chm manage 330.1 K 2017-09-05 - 10:18 JuliaSchwarz  
elsechm Iron_python_API_C3956.chm manage 405.0 K 2013-11-07 - 18:06 JuliaSchwarz  
elsechm Iron_python_API_C3958.chm manage 405.4 K 2014-01-17 - 15:23 JuliaSchwarz  
Topic revision: r34 - 2018-01-10 - 12:59:23 - IrinaZieger








 
  • Suche in Topic-Namen

  • Suche in Topic-Inhalten