To Solve Process finished with exit code 139 (interrupted by signal 11: SIGSEGV) Error Here you're trying to read/write a file which is open. In this case, simply closing the file and rerunning the script solved the issue. So That just close the file that you are trying to read or write and then run your script.