{"action":"created","issue":{"url":"https://api.github.com/repos/google/mozc/issues/391","repository_url":"https://api.github.com/repos/google/mozc","labels_url":"https://api.github.com/repos/google/mozc/issues/391/labels{/name}","comments_url":"https://api.github.com/repos/google/mozc/issues/391/comments","events_url":"https://api.github.com/repos/google/mozc/issues/391/events","html_url":"https://github.com/google/mozc/issues/391","id":184025375,"number":391,"title":"ImportError: gen_zip_code_seed.py","user":{"login":"gary816","id":16699148,"avatar_url":"https://avatars.githubusercontent.com/u/16699148?v=3","gravatar_id":"","url":"https://api.github.com/users/gary816","html_url":"https://github.com/gary816","followers_url":"https://api.github.com/users/gary816/followers","following_url":"https://api.github.com/users/gary816/following{/other_user}","gists_url":"https://api.github.com/users/gary816/gists{/gist_id}","starred_url":"https://api.github.com/users/gary816/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gary816/subscriptions","organizations_url":"https://api.github.com/users/gary816/orgs","repos_url":"https://api.github.com/users/gary816/repos","events_url":"https://api.github.com/users/gary816/events{/privacy}","received_events_url":"https://api.github.com/users/gary816/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-10-19T17:27:54Z","updated_at":"2016-10-26T02:35:31Z","closed_at":"2016-10-26T02:35:31Z","body":"#### Mozc-2.18.2620.102+24.0.oss\r\n```\r\n$ cd mozc-2.18.2620.102/src/dictionary/\r\n$ python2 gen_zip_code_seed.py --zip_code=KEN_ALL.CSV --jigyosyo=JIGYOSYO.CSV >> test\r\nTraceback (most recent call last):\r\n  File \"gen_zip_code_seed.py\", line 59, in <module>\r\n    from dictionary import zip_code_util\r\nImportError: No module named dictionary\r\n```\r\n\r\nThis will fix it.\r\n```\r\nsed -i \"s/from dictionary import zip_code_util/import zip_code_util/g\" gen_zip_code_seed.py\r\n```"},"comment":{"url":"https://api.github.com/repos/google/mozc/issues/comments/256234252","html_url":"https://github.com/google/mozc/issues/391#issuecomment-256234252","issue_url":"https://api.github.com/repos/google/mozc/issues/391","id":256234252,"user":{"login":"yukawa","id":5861397,"avatar_url":"https://avatars.githubusercontent.com/u/5861397?v=3","gravatar_id":"","url":"https://api.github.com/users/yukawa","html_url":"https://github.com/yukawa","followers_url":"https://api.github.com/users/yukawa/followers","following_url":"https://api.github.com/users/yukawa/following{/other_user}","gists_url":"https://api.github.com/users/yukawa/gists{/gist_id}","starred_url":"https://api.github.com/users/yukawa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yukawa/subscriptions","organizations_url":"https://api.github.com/users/yukawa/orgs","repos_url":"https://api.github.com/users/yukawa/repos","events_url":"https://api.github.com/users/yukawa/events{/privacy}","received_events_url":"https://api.github.com/users/yukawa/received_events","type":"User","site_admin":false},"created_at":"2016-10-26T02:35:31Z","updated_at":"2016-10-26T02:35:31Z","body":"Thank you for the report and sorry about the trouble. This is actually a known issue regarding how Mozc team open-sources code from internal repository to GitHub. In internal repository, we assume that `PYTHONPATH` always includes the top directory of Mozc's source directory. Although we can forget about this when building Mozc because `build_mozc.py` automatically does this \\[1\\] for you, we have to do that manually when we manually run our Python scripts from console.\r\n\r\nCan you try the following command instead? \r\n```\r\ncd mozc-2.18.2620.102/src\r\nPYTHONPATH=\"${PYTHONPATH}:${PWD}\" python gen_zip_code_seed.py --zip_code=KEN_ALL.CSV --jigyosyo=JIGYOSYO.CSV >> test\r\n```\r\nWe will update the comment in [`src/data/dictionary_oss/README.txt`](https://github.com/google/mozc/blob/d87954bf3791fb871c6e16621077fb0b97cc10a5/src/data/dictionary_oss/README.txt) in a later commit to make it clear that we have to manually set `PYTHONPATH`.\r\n\r\n\\[1\\]: [src/build_mozc.py] (https://github.com/google/mozc/blob/f76c304164e54414b5310010bc26e27b37764822/src/build_mozc.py#L850) automatically updates `PYTHONPATH` as follows:\r\n```\r\n  # Add the mozc root directory to PYTHONPATH.\r\n  original_python_path = os.environ.get('PYTHONPATH', '')\r\n  depot_path = MOZC_ROOT\r\n  python_path = os.pathsep.join([original_python_path, depot_path])\r\n  os.environ['PYTHONPATH'] = python_path\r\n```\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"}}
{"actor":{"display_login":"yukawa"}}