{"action":"opened","issue":{"url":"https://api.github.com/repos/uqfoundation/dill/issues/123","labels_url":"https://api.github.com/repos/uqfoundation/dill/issues/123/labels{/name}","comments_url":"https://api.github.com/repos/uqfoundation/dill/issues/123/comments","events_url":"https://api.github.com/repos/uqfoundation/dill/issues/123/events","html_url":"https://github.com/uqfoundation/dill/issues/123","id":99914949,"number":123,"title":"serialized module fails if module is not in PYTHONPATH","user":{"login":"mmckerns","id":321534,"avatar_url":"https://avatars.githubusercontent.com/u/321534?v=3","gravatar_id":"","url":"https://api.github.com/users/mmckerns","html_url":"https://github.com/mmckerns","followers_url":"https://api.github.com/users/mmckerns/followers","following_url":"https://api.github.com/users/mmckerns/following{/other_user}","gists_url":"https://api.github.com/users/mmckerns/gists{/gist_id}","starred_url":"https://api.github.com/users/mmckerns/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmckerns/subscriptions","organizations_url":"https://api.github.com/users/mmckerns/orgs","repos_url":"https://api.github.com/users/mmckerns/repos","events_url":"https://api.github.com/users/mmckerns/events{/privacy}","received_events_url":"https://api.github.com/users/mmckerns/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-09T17:33:02Z","updated_at":"2015-08-09T17:33:02Z","closed_at":null,"body":"Question from SO: http://stackoverflow.com/questions/31884640/does-the-dill-python-module-handle-importing-modules-when-sys-path-differs\r\n\r\nCan I use dill to serialize and then load that module in a different process that has a different sys.path which doesn't include that module? Right now I get import failures:\r\n\r\nHere's an example.  I run this script where the foo.py module's path is in my sys.path:\r\n```\r\n    % cat dill_dump.py \r\n    import dill\r\n    import foo\r\n    myFile = \"./foo.pkl\"\r\n    fh = open(myFile, 'wb')\r\n    dill.dump(foo, fh)\r\n```\r\nNow, I run this script where I do not have foo.py's directory in my PYTHONPATH:\r\n```\r\n    % cat dill_load.py \r\n    import dill\r\n    myFile = \"./foo.pkl\"\r\n    fh = open(myFile, 'rb')\r\n    foo = dill.load(fh)\r\n    print foo\r\n```\r\nIt fails with this stack trace:\r\n```\r\n    Traceback (most recent call last):\r\n      File \"dill_load.py\", line 4, in <module>\r\n        foo = dill.load(fh)\r\n      File \"/home/b/lib/python/dill-0.2.4-py2.6.egg/dill/dill.py\", line 199, in load\r\n        obj = pik.load()\r\n      File \"/rel/lang/python/2.6.4-8/lib/python2.6/pickle.py\", line 858, in load\r\n        dispatch[key](self)\r\n      File \"/rel/lang/python/2.6.4-8/lib/python2.6/pickle.py\", line 1133, in load_reduce\r\n        value = func(*args)\r\n      File \"/home/b/lib/python/dill-0.2.4-py2.6.egg/dill/dill.py\", line 678, in _import_module\r\n        return __import__(import_name)\r\n    ImportError: No module named foo\r\n```\r\nSo, if I need to have the same python path between the two processes, then what's the point of serializing a python module? "}}