{"action":"created","issue":{"url":"https://api.github.com/repos/brython-dev/brython/issues/378","repository_url":"https://api.github.com/repos/brython-dev/brython","labels_url":"https://api.github.com/repos/brython-dev/brython/issues/378/labels{/name}","comments_url":"https://api.github.com/repos/brython-dev/brython/issues/378/comments","events_url":"https://api.github.com/repos/brython-dev/brython/issues/378/events","html_url":"https://github.com/brython-dev/brython/issues/378","id":133165977,"number":378,"title":"[BUG] __import__('.main')","user":{"login":"githob605608886","id":13626487,"avatar_url":"https://avatars.githubusercontent.com/u/13626487?v=3","gravatar_id":"","url":"https://api.github.com/users/githob605608886","html_url":"https://github.com/githob605608886","followers_url":"https://api.github.com/users/githob605608886/followers","following_url":"https://api.github.com/users/githob605608886/following{/other_user}","gists_url":"https://api.github.com/users/githob605608886/gists{/gist_id}","starred_url":"https://api.github.com/users/githob605608886/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/githob605608886/subscriptions","organizations_url":"https://api.github.com/users/githob605608886/orgs","repos_url":"https://api.github.com/users/githob605608886/repos","events_url":"https://api.github.com/users/githob605608886/events{/privacy}","received_events_url":"https://api.github.com/users/githob605608886/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-02-12T06:17:16Z","updated_at":"2016-02-12T15:21:51Z","closed_at":null,"body":"# [brython edit ](http://brython.info/tests/editor.html?lang=en) Test\r\n```\r\n>>> __import__('.main')\r\nInternal Javascript error: TypeError: Cannot read property '0' of null\r\n  module 'editor' line 97\r\n        exec(src, ns)\r\n<completed in   6.00 ms>\r\n```\r\n# Cpython 3.5\r\n```\r\n>>> __import__('.main')\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 1, in <module>\r\nImportError: No module named '.main'\r\n```\r\n\r\n# Again a test code  for  [brython edit ](http://brython.info/tests/editor.html?lang=en) \r\n```\r\ntry:\r\n__import__('.main')\r\nexcept:\r\n    print(1)\r\nelse:\r\n    print(2)\r\nfinally:\r\n    print(3)\r\n```\r\n```\r\n module $exec_212 line 2\r\n  __import__('.main')\r\n   ^\r\nIndentationError: expected an indented block\r\n<completed in  10.00 ms>\r\n```"},"comment":{"url":"https://api.github.com/repos/brython-dev/brython/issues/comments/183371539","html_url":"https://github.com/brython-dev/brython/issues/378#issuecomment-183371539","issue_url":"https://api.github.com/repos/brython-dev/brython/issues/378","id":183371539,"user":{"login":"githob605608886","id":13626487,"avatar_url":"https://avatars.githubusercontent.com/u/13626487?v=3","gravatar_id":"","url":"https://api.github.com/users/githob605608886","html_url":"https://github.com/githob605608886","followers_url":"https://api.github.com/users/githob605608886/followers","following_url":"https://api.github.com/users/githob605608886/following{/other_user}","gists_url":"https://api.github.com/users/githob605608886/gists{/gist_id}","starred_url":"https://api.github.com/users/githob605608886/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/githob605608886/subscriptions","organizations_url":"https://api.github.com/users/githob605608886/orgs","repos_url":"https://api.github.com/users/githob605608886/repos","events_url":"https://api.github.com/users/githob605608886/events{/privacy}","received_events_url":"https://api.github.com/users/githob605608886/received_events","type":"User","site_admin":false},"created_at":"2016-02-12T15:21:51Z","updated_at":"2016-02-12T15:21:51Z","body":"# url load py\r\n\r\n```\r\nimport sys,os\r\ndef import_lib2(url):\r\n    temp_dir = os.path.split(url)\r\n    temp = sys.path\r\n    sys.path = [temp_dir[0]]\r\n    val =__import__(temp_dir[1])\r\n    sys.path = temp\r\n    return val\r\n```\r\n# e.g\r\n```\r\nmain = import_lib2('http://xxx.com/test/main.py')\r\n\r\n```"}}