andrewshilliday / garage-door-controller

Software to monitor and control garage doors via a raspberry pi
MIT License
327 stars 127 forks source link

Scope of "controller" variable #2

Closed roberttstephens closed 7 years ago

roberttstephens commented 10 years ago

I do not feel comfortable making changes that alter behavior at this time, since I do not have an environment to test at this time.

At first inspection, it looks like the variable "controller" would be undefined on lines 149 and 198. At second glance, it looks like it's reading from the module level controller variable, defined on line 212.

So to me it looks like the controller should be self.controller in the above two cases.

In addition, it looks like the name 'controller' is getting redefined from the module scope on lines 132, 143, and 156. In order to avoid confusion, perhaps the block of code inside of "if name == 'main'": could be put into a main function?

andrewshilliday commented 7 years ago

@roberttstephens Well it only took several years. But I fixed the code. Good catch.