Home
Categories
Dictionary
Glossary
Download
Project Details
Changes Log
What Links Here
FAQ
License

Waiting for Python initialization



Python socket modules work by starting an external Python runtime an interacting with it. It is important to wait for:
  • The Python runtime to properly instanciate the Python script
  • The Python script to initialize if it need a lenghty time to initialize

sequencepythonstartjson

WaitAtStart

The waitAtStart property for Python modules allows to specify the time to wait for the Python runtime to properly instanciate the Python script[1]
If not specified, the value is set to 200 ms
.

For example:
      <pythonModule name="FlightManagementSystem" id="1" >
         <pythonImplementation path="pythonAppli" waitAtStart="500ms" inputPort="6000" outputPort="6005" inputSize="1024" outputSize="1024"/>
      </pythonModule>
If this value is not correctly set (ie, is too small, or even equal to 0), you will see the following exception even before the Python script has time to start:Exception ignored in: _io.TextIOWrapper name='' mode='w' encoding='cp1252'> OSError: [Errno 22] Invalid argument It is also possible to specify this value by default for all Python modules in the framework properties. For example:
      <files>
      ...
         <property key="pyWaitAtStart" value="500ms" />
      </files>

WaitAtInit

The waitAtInit property for Python modules allows to specify the time to wait for the Python modules for the init EntryPoint[2]
If not specified, the value is set to 500 ms
. It is useufl to set for Python modyules which take a long time to initialize.

For example:
      <pythonModule name="FlightManagementSystem" id="1" >
         <pythonImplementation path="pythonAppli" waitAtInit="2000ms" inputPort="6000" outputPort="6005" inputSize="1024" outputSize="1024"/>
      </pythonModule>
It is also possible to specify this value by default for all Python modules in the framework properties. For example:
      <files>
      ...
         <property key="pyWaitAtInit" value="2000ms" />
      </files>

Notes

  1. ^ If not specified, the value is set to 200 ms
  2. ^ If not specified, the value is set to 500 ms

See also


Categories: python

Copyright 2017-2020 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v3 licence