{"action":"created","issue":{"url":"https://api.github.com/repos/scrapy/scrapy/issues/2229","repository_url":"https://api.github.com/repos/scrapy/scrapy","labels_url":"https://api.github.com/repos/scrapy/scrapy/issues/2229/labels{/name}","comments_url":"https://api.github.com/repos/scrapy/scrapy/issues/2229/comments","events_url":"https://api.github.com/repos/scrapy/scrapy/issues/2229/events","html_url":"https://github.com/scrapy/scrapy/pull/2229","id":176268973,"number":2229,"title":"[MRG+1] Fix completion in `scrapy shell` for new imports","user":{"login":"ahlinc","id":14666676,"avatar_url":"https://avatars.githubusercontent.com/u/14666676?v=3","gravatar_id":"","url":"https://api.github.com/users/ahlinc","html_url":"https://github.com/ahlinc","followers_url":"https://api.github.com/users/ahlinc/followers","following_url":"https://api.github.com/users/ahlinc/following{/other_user}","gists_url":"https://api.github.com/users/ahlinc/gists{/gist_id}","starred_url":"https://api.github.com/users/ahlinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahlinc/subscriptions","organizations_url":"https://api.github.com/users/ahlinc/orgs","repos_url":"https://api.github.com/users/ahlinc/repos","events_url":"https://api.github.com/users/ahlinc/events{/privacy}","received_events_url":"https://api.github.com/users/ahlinc/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/scrapy/scrapy/milestones/8","html_url":"https://github.com/scrapy/scrapy/milestones/v1.2","labels_url":"https://api.github.com/repos/scrapy/scrapy/milestones/8/labels","id":1541425,"number":8,"title":"v1.2","description":"","creator":{"login":"redapple","id":886296,"avatar_url":"https://avatars.githubusercontent.com/u/886296?v=3","gravatar_id":"","url":"https://api.github.com/users/redapple","html_url":"https://github.com/redapple","followers_url":"https://api.github.com/users/redapple/followers","following_url":"https://api.github.com/users/redapple/following{/other_user}","gists_url":"https://api.github.com/users/redapple/gists{/gist_id}","starred_url":"https://api.github.com/users/redapple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/redapple/subscriptions","organizations_url":"https://api.github.com/users/redapple/orgs","repos_url":"https://api.github.com/users/redapple/repos","events_url":"https://api.github.com/users/redapple/events{/privacy}","received_events_url":"https://api.github.com/users/redapple/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":26,"state":"closed","created_at":"2016-01-25T12:36:50Z","updated_at":"2016-11-16T16:09:50Z","due_on":null,"closed_at":"2016-11-16T16:09:50Z"},"comments":5,"created_at":"2016-09-11T22:23:17Z","updated_at":"2016-11-30T08:00:50Z","closed_at":"2016-09-22T14:15:30Z","pull_request":{"url":"https://api.github.com/repos/scrapy/scrapy/pulls/2229","html_url":"https://github.com/scrapy/scrapy/pull/2229","diff_url":"https://github.com/scrapy/scrapy/pull/2229.diff","patch_url":"https://github.com/scrapy/scrapy/pull/2229.patch"},"body":"Hi,\nThis PR fixes an issue in `scrapy shell` command with IPython shell on attempt to import some new module and complete its name with `<TAB>`, like:\n\n``` python\n>>> import srap<TAB>\n```\n\nThe following traceback occurs:\n\n``` python\nIn [1]: import scrException in thread Thread-16:\nTraceback (most recent call last):\n  File \"/home/ahlin/.pyenv/versions/2.7.11/lib/python2.7/threading.py\", line 801, in __bootstrap_inner\n    self.run()\n  File \"/home/ahlin/.pyenv/versions/2.7.11/lib/python2.7/threading.py\", line 754, in run\n    self.__target(*self.__args, **self.__kwargs)\n  File \"/home/ahlin/.pyenv/versions/2.7.11/envs/scrape27/lib/python2.7/site-packages/prompt_toolkit/interface.py\", line 836, in run\n    completions = list(buffer.completer.get_completions(document, complete_event))\n  File \"/home/ahlinc/dev/ipython/IPython/terminal/ptutils.py\", line 44, in get_completions\n    cursor_pos=document.cursor_position_col\n  File \"/home/ahlinc/dev/ipython/IPython/core/completer.py\", line 84, in comp\n    text, matches =  complete(*args, **kwargs)\n  File \"/home/ahlinc/dev/ipython/IPython/core/completer.py\", line 1193, in complete\n    custom_res = self.dispatch_custom_completer(text)\n  File \"/home/ahlinc/dev/ipython/IPython/core/completer.py\", line 1117, in dispatch_custom_completer\n    res = c(event)\n  File \"/home/ahlinc/dev/ipython/IPython/core/completerlib.py\", line 253, in module_completer\n    return module_completion(event.line)\n  File \"/home/ahlinc/dev/ipython/IPython/core/completerlib.py\", line 229, in module_completion\n    return get_root_modules()\n  File \"/home/ahlinc/dev/ipython/IPython/core/completerlib.py\", line 119, in get_root_modules\n    rootmodules_cache = ip.db.get('rootmodules_cache', {})\nAttributeError: 'NoneType' object has no attribute 'db'\n```\n\nAnd after that exception completion doesn't work anymore.\n"},"comment":{"url":"https://api.github.com/repos/scrapy/scrapy/issues/comments/263807804","html_url":"https://github.com/scrapy/scrapy/pull/2229#issuecomment-263807804","issue_url":"https://api.github.com/repos/scrapy/scrapy/issues/2229","id":263807804,"user":{"login":"ahlinc","id":14666676,"avatar_url":"https://avatars.githubusercontent.com/u/14666676?v=3","gravatar_id":"","url":"https://api.github.com/users/ahlinc","html_url":"https://github.com/ahlinc","followers_url":"https://api.github.com/users/ahlinc/followers","following_url":"https://api.github.com/users/ahlinc/following{/other_user}","gists_url":"https://api.github.com/users/ahlinc/gists{/gist_id}","starred_url":"https://api.github.com/users/ahlinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahlinc/subscriptions","organizations_url":"https://api.github.com/users/ahlinc/orgs","repos_url":"https://api.github.com/users/ahlinc/repos","events_url":"https://api.github.com/users/ahlinc/events{/privacy}","received_events_url":"https://api.github.com/users/ahlinc/received_events","type":"User","site_admin":false},"created_at":"2016-11-30T08:00:50Z","updated_at":"2016-11-30T08:00:50Z","body":"@redapple yes, I've tested it and confirm that the #396 bug is re-triggered by this change and the cause of the issue was that IPython Shell is a singleton. Fixed in #2418."}}
{"actor":{"display_login":"ahlinc"}}