Skip to content Skip to sidebar Skip to footer

Exec Name "templet_1h" Is Not Defined

I'm trying to write a code with exec and eval function to read lists of variables from a numpy .npz file. When I ran the code without defining it as a function def, the code worked

Solution 1:

Use exec(evaluate_1, globals()) instead to use the global dictionary for global and local variables in exec.

The code adds the defined variable to the global dictionary. Adding it as local variable of a function is not possible.

Post a Comment for "Exec Name "templet_1h" Is Not Defined"