From e98edf717ceb09a182ff3fa9184644f05ba6b5bc Mon Sep 17 00:00:00 2001 From: Klaus Rabbertz <klaus.rabbertz@cern.ch> Date: Fri, 10 May 2024 17:58:06 +0200 Subject: [PATCH] Remove requirement of recent env executable to ensure C++/Python unbuffered output; add env. var. to environment instead --- tools/fnlosrc_install.csh | 3 +++ v2.5/toolkit/src/fnlo-py-print.py | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/fnlosrc_install.csh b/tools/fnlosrc_install.csh index f7ad298c..84f51fc7 100755 --- a/tools/fnlosrc_install.csh +++ b/tools/fnlosrc_install.csh @@ -1190,6 +1190,9 @@ if ( $withpython ) then echo 'setenv PYTHONPATH '"${PYTHONPATHADD}" >> fnlosrc_source.csh echo 'export PYTHONPATH='"${PYTHONPATHADD}" >> fnlosrc_source.sh endif + # Unbuffered Python output to avoid mixing C++/Python + echo 'setenv PYTHONUNBUFFERED 1' >> fnlosrc_source.csh + echo 'export PYTHONUNBUFFERED=1' >> fnlosrc_source.sh echo "" echo "ATTENTION: PYTHONPATH environment complemented!" echo " PYTHONPATH has been set to:" diff --git a/v2.5/toolkit/src/fnlo-py-print.py b/v2.5/toolkit/src/fnlo-py-print.py index f17047ed..42c93211 100755 --- a/v2.5/toolkit/src/fnlo-py-print.py +++ b/v2.5/toolkit/src/fnlo-py-print.py @@ -1,5 +1,7 @@ -#!/usr/bin/env -S python3 -u +#!/usr/bin/env python3 #-*- coding:utf-8 -*- +### This shebang line only works with recent enough env version: !/usr/bin/env -S python3 -u +### Set PYTHONUNBUFFERED environment variable instead to 1. # ######################################################################## # -- GitLab