{"action":"created","issue":{"url":"https://api.github.com/repos/AllenDowney/ThinkStats2/issues/101","repository_url":"https://api.github.com/repos/AllenDowney/ThinkStats2","labels_url":"https://api.github.com/repos/AllenDowney/ThinkStats2/issues/101/labels{/name}","comments_url":"https://api.github.com/repos/AllenDowney/ThinkStats2/issues/101/comments","events_url":"https://api.github.com/repos/AllenDowney/ThinkStats2/issues/101/events","html_url":"https://github.com/AllenDowney/ThinkStats2/issues/101","id":307047796,"number":101,"title":"Chapter 11 Exercises - PatsyError bug in pre-made code","user":{"login":"jmauritzDRG","id":35504842,"avatar_url":"https://avatars1.githubusercontent.com/u/35504842?v=4","gravatar_id":"","url":"https://api.github.com/users/jmauritzDRG","html_url":"https://github.com/jmauritzDRG","followers_url":"https://api.github.com/users/jmauritzDRG/followers","following_url":"https://api.github.com/users/jmauritzDRG/following{/other_user}","gists_url":"https://api.github.com/users/jmauritzDRG/gists{/gist_id}","starred_url":"https://api.github.com/users/jmauritzDRG/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmauritzDRG/subscriptions","organizations_url":"https://api.github.com/users/jmauritzDRG/orgs","repos_url":"https://api.github.com/users/jmauritzDRG/repos","events_url":"https://api.github.com/users/jmauritzDRG/events{/privacy}","received_events_url":"https://api.github.com/users/jmauritzDRG/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-03-20T21:36:19Z","updated_at":"2018-03-21T00:01:52Z","closed_at":null,"author_association":"NONE","body":"I've been loving ThinkStats2 so far for learning statistics and expanding my knowledge of Python simultaneously.\r\n\r\nIn chapter 11's exercises, I'm seeing something that has never happened before: an error in the pre-made code that comes with the exercises. After defining GoMining, when the notebook tries to call it, I get an error: \"NameError: name 'patsy' is not defined\"\r\n\r\nAfter importing patsy in an earlier block, I try to run the code again, and then I get the error: \"NameError: name 'MESSAGE' is not defined\"\r\n\r\nAt that point, I tried defining MESSAGE and removing it from raise ValueError() entirely, but both of those attempts produced more errors. I'm not clued in on how this module needs to be talked to in order to function, thus I cannot work with this portion of the exercises, and I imagine nobody else can either.\r\n\r\nThanks again for making this fantastic book!!\r\n\r\nEDIT: When I replace raise ValueError(MESSAGE) with print('ERROR'), it seems like I get a step further, but then I get another error -- UnboundLocalError: local variable 'results' referenced before assignment -- that I am having a lot of trouble troubleshooting on my own. I would be grateful for any insight, as I am really excited about this concept!"},"comment":{"url":"https://api.github.com/repos/AllenDowney/ThinkStats2/issues/comments/374798054","html_url":"https://github.com/AllenDowney/ThinkStats2/issues/101#issuecomment-374798054","issue_url":"https://api.github.com/repos/AllenDowney/ThinkStats2/issues/101","id":374798054,"user":{"login":"mica5","id":7075901,"avatar_url":"https://avatars2.githubusercontent.com/u/7075901?v=4","gravatar_id":"","url":"https://api.github.com/users/mica5","html_url":"https://github.com/mica5","followers_url":"https://api.github.com/users/mica5/followers","following_url":"https://api.github.com/users/mica5/following{/other_user}","gists_url":"https://api.github.com/users/mica5/gists{/gist_id}","starred_url":"https://api.github.com/users/mica5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mica5/subscriptions","organizations_url":"https://api.github.com/users/mica5/orgs","repos_url":"https://api.github.com/users/mica5/repos","events_url":"https://api.github.com/users/mica5/events{/privacy}","received_events_url":"https://api.github.com/users/mica5/received_events","type":"User","site_admin":false},"created_at":"2018-03-21T00:01:52Z","updated_at":"2018-03-21T00:01:52Z","author_association":"NONE","body":"MESSAGE is not defined anywhere, so even if a patsy.PatsyError occurs and you catch it, the following line will fail. maybe the intention was to print the error, in which case (at least in python 3) the fix would be adding \"as MESSAGE\" so it says \"except patsy.PatsyError as MESSAGE:\".\r\n\r\nif an exception occurs before \"results\" variable is defined on line 21, then results will not be defined, and trying to use \"results\" on line 27 will fail. if defining \"results\" fails then you probably don't want to use it on line 27, especially because if the for loop succeeds once and then fails for every following iteration afterwards, then the same result will be used n times (where n is the number of iterations). I recommend placing \"variables.append((results.rsquared, name))\" right after line 21, so if defining results fails then it won't attempt to use it.\r\n\r\nI look forward to reading the book when I have time! I purchased a physical copy!"}}
{"actor":{"display_login":"mica5"}}