Skip to content
Advertisement

UnboundLocalError: local variable ‘dest_file_name’ referenced before assignment

Having issue with the code, I’m getting error with this code, was trying to make script to take a backup of a file scheduled

JavaScript

Advertisement

Answer

dest_file_name is a global variable, as it is defined at the top-level of a script. When you assign a new value to a global variable within a function, you have to declare that variable to be global:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement