When calling the GtCalculators.findGtTask() function from an external script file, GTlab crashes unexpectedly.
Steps to Reproduce
- Start GTlab version 2.0.10 and ensure that the GTlab Python Module 1.6.0 is loaded.
- Create a directory named
python_scripts in the same directory as GTlab.exe.
- In the
python_scripts directory, create a Python script named external_script.py that calls GtCalculators.findGtTask(). Here is an example code to copy:
from GtCalculators import findGtTask
def external_find_task(task_name: str):
task = findGtTask(task_name)
- In GTlab create a Simple Task named
Task.
- Create a Python Task and copy the following code into it:
import os
import sys
external_scripts_dir = os.path.join(os.getcwd(), 'python_scripts')
sys.path.append(external_scripts_dir)
# Load the external module
from external_script import external_find_task
del sys.modules['external_script']
from external_script import external_find_task
external_find_task('Task')
- Run the script and observe that GTlab crashes.
When calling the GtCalculators.findGtTask() function from an external script file, GTlab crashes unexpectedly.
Steps to Reproduce
python_scriptsin the same directory asGTlab.exe.python_scriptsdirectory, create a Python script namedexternal_script.pythat callsGtCalculators.findGtTask(). Here is an example code to copy:Task.