{"action":"opened","issue":{"url":"https://api.github.com/repos/IteratorAdvance/taichi/issues/23","repository_url":"https://api.github.com/repos/IteratorAdvance/taichi","labels_url":"https://api.github.com/repos/IteratorAdvance/taichi/issues/23/labels{/name}","comments_url":"https://api.github.com/repos/IteratorAdvance/taichi/issues/23/comments","events_url":"https://api.github.com/repos/IteratorAdvance/taichi/issues/23/events","html_url":"https://github.com/IteratorAdvance/taichi/issues/23","id":199817222,"number":23,"title":"MacOSX: problem report of nbody_3d.py","user":{"login":"iamyoukou","id":7427716,"avatar_url":"https://avatars.githubusercontent.com/u/7427716?v=3","gravatar_id":"","url":"https://api.github.com/users/iamyoukou","html_url":"https://github.com/iamyoukou","followers_url":"https://api.github.com/users/iamyoukou/followers","following_url":"https://api.github.com/users/iamyoukou/following{/other_user}","gists_url":"https://api.github.com/users/iamyoukou/gists{/gist_id}","starred_url":"https://api.github.com/users/iamyoukou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iamyoukou/subscriptions","organizations_url":"https://api.github.com/users/iamyoukou/orgs","repos_url":"https://api.github.com/users/iamyoukou/repos","events_url":"https://api.github.com/users/iamyoukou/events{/privacy}","received_events_url":"https://api.github.com/users/iamyoukou/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-01-10T13:10:36Z","updated_at":"2017-01-10T13:10:36Z","closed_at":null,"body":"On MacOSX(10.11.6), some errors will happen when execute `nbody_3d.py`.  \r\nI fixed them in a not clever way, but it works for me.  \r\n\r\n1. \r\n ```\r\nTraceback (most recent call last):\r\n  File \"nbody_3d.py\", line 1, in <module>\r\n    from taichi.dynamics.nbody import NBody\r\n  File \"/Users/YJ-work/Desktop/taichi_root/taichi/python/taichi/dynamics/nbody.py\", line 6, in <module>\r\n    from taichi.tools.video import VideoManager\r\n  File \"/Users/YJ-work/Desktop/taichi_root/taichi/python/taichi/tools/video.py\", line 1, in <module>\r\n    from taichi import ndarray_to_array2d\r\nImportError: cannot import name ndarray_to_array2d\r\n```\r\nI replaced `from taichi import ndarray_to_array2d` with `from taichi.misc.util import ndarray_to_array2d` in `taichi.tools.video`.\r\n\r\n2.\r\n```\r\n[Errno 2] No such file or directory: '/Users/YJ-work/Desktop/taichi_root//taichi_outputs///task-2017-01-10-21-51-00-r07015'\r\nSimulation time: 0.0\r\nnbody.cpp[201]: node_end = 297117\r\nTime: 0.0983819961548\r\nSegmentation fault: 11\r\n```\r\nI replaced `self.directory = taichi.get_output_path(get_unique_task_id())` with a full path `self.directory = '/Users/YJ-work/Desktop/taichi_root/taichi/output/'` in `taichi.dynamics.nbody`\r\n\r\n3.\r\n```\r\nTraceback (most recent call last):\r\n  File \"nbody_3d.py\", line 6, in <module>\r\n    nbody.step(0.01)\r\n  File \"/Users/YJ-work/Desktop/taichi_root/taichi/python/taichi/dynamics/nbody.py\", line 49, in step\r\n    img = LDRDisplay(exposure=1, adaptive_exposure=False).process(img)\r\nNameError: global name 'LDRDisplay' is not defined\r\n```\r\nI added `from taichi.visual.post_process import LDRDisplay` in `taichi.dynamics.nbody`.\r\n\r\n4.\r\n```\r\nTraceback (most recent call last):\r\n  File \"nbody_3d.py\", line 6, in <module>\r\n    nbody.step(0.01)\r\n  File \"/Users/YJ-work/Desktop/taichi_root/taichi/python/taichi/dynamics/nbody.py\", line 53, in step\r\n    self.video_manager.write_frame(img)\r\n  File \"/Users/YJ-work/Desktop/taichi_root/taichi/python/taichi/tools/video.py\", line 18, in write_frame\r\n    ndarray_to_array2d(img).write(self.directory + '/%05d.png' % self.frame_counter)\r\nAttributeError: 'NoneType' object has no attribute 'write'\r\n```\r\nI commented out `self.video_manager.write_frame(img)` in `taichi.dynamics.nbody`.\r\n\r\nMaybe there is a clever way to fix this problem.\r\n\r\nBTW, I got this output (one of those frames)\r\n![image](https://cloud.githubusercontent.com/assets/7427716/21807319/85915a16-d781-11e6-8871-6f10d2c5f17c.png)\r\nIs it correct?\r\n\r\n"}}
{"actor":{"display_login":"iamyoukou"}}