Remove GIL and redirect python stderr to logfile