Python accesses environment variables through the environ dictionary in the os library. So your script needs to include
import os
to import the library. Most people put their import statements up near the top of the script. Then you access the value of fName this way:
with open(os.environ["KMVAR_fName"]) as f: