{"action":"created","issue":{"url":"https://api.github.com/repos/python/mypy/issues/1293","repository_url":"https://api.github.com/repos/python/mypy","labels_url":"https://api.github.com/repos/python/mypy/issues/1293/labels{/name}","comments_url":"https://api.github.com/repos/python/mypy/issues/1293/comments","events_url":"https://api.github.com/repos/python/mypy/issues/1293/events","html_url":"https://github.com/python/mypy/issues/1293","id":141128618,"number":1293,"title":"MyPy cannot find module","user":{"login":"DavidCookBrite","id":16768531,"avatar_url":"https://avatars.githubusercontent.com/u/16768531?v=3","gravatar_id":"","url":"https://api.github.com/users/DavidCookBrite","html_url":"https://github.com/DavidCookBrite","followers_url":"https://api.github.com/users/DavidCookBrite/followers","following_url":"https://api.github.com/users/DavidCookBrite/following{/other_user}","gists_url":"https://api.github.com/users/DavidCookBrite/gists{/gist_id}","starred_url":"https://api.github.com/users/DavidCookBrite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DavidCookBrite/subscriptions","organizations_url":"https://api.github.com/users/DavidCookBrite/orgs","repos_url":"https://api.github.com/users/DavidCookBrite/repos","events_url":"https://api.github.com/users/DavidCookBrite/events{/privacy}","received_events_url":"https://api.github.com/users/DavidCookBrite/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-03-15T23:37:54Z","updated_at":"2016-04-07T18:57:32Z","closed_at":"2016-04-07T18:57:32Z","body":"I'm adding MyPy annotations to a single Python 2 file that uses the `py2neo` package, here's what I have so far (just 2 functions annotated). The file is called `gdb.py`.\r\n\r\n```\r\nfrom py2neo import Graph\r\nfrom contexttimer import Timer\r\nimport simpleflake\r\nfrom datetime import datetime\r\n\r\ngraph   = None\r\n\r\ndef init(neo4j_uri):\r\n    # type: (str) -> None\r\n    global graph\r\n    graph = Graph('{}/db/data'.format(neo4j_uri))\r\n\r\n\r\ndef _exec(cypher_text, params):\r\n    # type: (str, Dict[str,Any]) -> Tuple[RecordListList,Timer]\r\n    with Timer() as t:\r\n        result = graph.cypher.execute( cypher_text, params )\r\n    return result, t\r\n```\r\n\r\nI run MyPy from the terminal in the same directory and virtual-environment as normal Python `> mypy --py2 gdb.py`\r\n\r\nI get this error output:\r\n```\r\nfugu_gdb.py:15: error: Cannot find module named 'py2neo'\r\nfugu_gdb.py:15: note: (Perhaps setting MYPYPATH would help)\r\nfugu_gdb.py:16: error: Cannot find module named 'contexttimer'\r\nfugu_gdb.py:17: error: Cannot find module named 'simpleflake'\r\nfugu_gdb.py: note: In function \"_exec\":\r\nfugu_gdb.py:34: error: Name 'RecordListList' is not defined\r\n```\r\n\r\nI can't find any documentation on how `MYPYPATH` is meant to be set.\r\n\r\nMy `__init__.py` file doesn't contain anything of significance, just futures imports.\r\n\r\nPython itself works fine - `python gdb.py` runs without any errors when run from the same terminal session as `mypy`."},"comment":{"url":"https://api.github.com/repos/python/mypy/issues/comments/207049612","html_url":"https://github.com/python/mypy/issues/1293#issuecomment-207049612","issue_url":"https://api.github.com/repos/python/mypy/issues/1293","id":207049612,"user":{"login":"gvanrossum","id":2894642,"avatar_url":"https://avatars.githubusercontent.com/u/2894642?v=3","gravatar_id":"","url":"https://api.github.com/users/gvanrossum","html_url":"https://github.com/gvanrossum","followers_url":"https://api.github.com/users/gvanrossum/followers","following_url":"https://api.github.com/users/gvanrossum/following{/other_user}","gists_url":"https://api.github.com/users/gvanrossum/gists{/gist_id}","starred_url":"https://api.github.com/users/gvanrossum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gvanrossum/subscriptions","organizations_url":"https://api.github.com/users/gvanrossum/orgs","repos_url":"https://api.github.com/users/gvanrossum/repos","events_url":"https://api.github.com/users/gvanrossum/events{/privacy}","received_events_url":"https://api.github.com/users/gvanrossum/received_events","type":"User","site_admin":false},"created_at":"2016-04-07T18:57:32Z","updated_at":"2016-04-07T18:57:32Z","body":"Closing as dupe of #1339."}}