I am writing a python script which uses the argparse module and some paraview.simple functions and I am facing an odd problem.
When the script has to exit due to lack of arguments for the parser, the terminal freezes.
I have checked the script with python under Paraview versions 5.5 to 5.8. It works fine for Paraview 5.5 and 5.6 and does not work for the newer versions.
I have made a simple example to reproduce this problem:
Steps to reproduce
- Save the following code in a python file “test.py”:
#!/usr/bin/env python
from paraview.simple import *
import argparse
if __name__ == "__main__":
# parse command line argument
parser = argparse.ArgumentParser(prog='PROG',description='Test')
parser.add_argument("-f",metavar="File",required=True, type=str)
args = vars(parser.parse_args())
- Run:
pvpython test.py -h
Expected Output
The following text should be printed and the code exit.
usage: PROG [-h] -f File
Test
optional arguments:
-h, --help show this help message and exit
-f File
Observed behavior
After printing the usage message the code does not exit and pressing Ctrl+C will result in the following:
VisRTX 0.1.6, using devices:
0: GeForce GTX 1660 Ti (Total: 6.2 GB, Available: 5.4 GB)
usage: PROG [-h] -f File
Test
optional arguments:
-h, --help show this help message and exit
-f File
^C
Loguru caught a signal: SIGINT
malloc(): unsorted double linked list corrupted
Loguru caught a signal: SIGABRT
My operating system is Centos 8 and my only option here is to close the terminal (Ctrl+q).
Possible cause
This problem does not occur if the following line in the code is commented:
from paraview.simple import *
so importing paraview.simple breaks the code.