@jacovangelder thanks but the error was solved by adding this in my UDF.

user = os.environ.get("USER")

 

View solution in original post