Clayton Kirkwood
2015-08-15 20:51:50 UTC
10 top_directory = "/users/Clayton/Pictures"
def override_defaults():
56 return( top_directory, filetypes, target_directory )
80 top_directory, filetypes, target_directory = override_defaults()
File "C:/Users/Clayton/python/find picture duplicates/find picture
duplicates", line 80, in <module>
top_directory, filetypes, target_directory = override_defaults()
File "C:/Users/Clayton/python/find picture duplicates/find picture
duplicates", line 56, in override_defaults
return( top_directory, filetypes, target_directory )
UnboundLocalError: local variable 'top_directory' referenced before
assignment
I am facing the above error:
10 occurs first
80 then runs
56 appears to not work, the function logically does nothing
I thought that variables in the main were visible to defined functions in
the same file, as long as the assignment occurs physically before use. When
debugging, inside of override_defaults sees the correct value.
What am I not seeing?
TIA,
Clayton
_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
def override_defaults():
56 return( top_directory, filetypes, target_directory )
80 top_directory, filetypes, target_directory = override_defaults()
File "C:/Users/Clayton/python/find picture duplicates/find picture
duplicates", line 80, in <module>
top_directory, filetypes, target_directory = override_defaults()
File "C:/Users/Clayton/python/find picture duplicates/find picture
duplicates", line 56, in override_defaults
return( top_directory, filetypes, target_directory )
UnboundLocalError: local variable 'top_directory' referenced before
assignment
I am facing the above error:
10 occurs first
80 then runs
56 appears to not work, the function logically does nothing
I thought that variables in the main were visible to defined functions in
the same file, as long as the assignment occurs physically before use. When
debugging, inside of override_defaults sees the correct value.
What am I not seeing?
TIA,
Clayton
_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor