'linux apache2.4 python3 CGI environment variables are different in command line and in browser

i get different values when i query the environment variables of python3 in CLI and apply the same code in a .py file and open in browser. Please find below a screen capture. i have tried to see the paths in which they are accessing, checked mod_env in apache, all working fine. this is driving me nuts. appreciate any inputs. thanks enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source