{"action":"closed","issue":{"url":"https://api.github.com/repos/GENI-NSF/geni-ch/issues/488","repository_url":"https://api.github.com/repos/GENI-NSF/geni-ch","labels_url":"https://api.github.com/repos/GENI-NSF/geni-ch/issues/488/labels{/name}","comments_url":"https://api.github.com/repos/GENI-NSF/geni-ch/issues/488/comments","events_url":"https://api.github.com/repos/GENI-NSF/geni-ch/issues/488/events","html_url":"https://github.com/GENI-NSF/geni-ch/issues/488","id":151372636,"number":488,"title":"Too many directories in sys.path","user":{"login":"tcmitchell","id":340136,"avatar_url":"https://avatars.githubusercontent.com/u/340136?v=3","gravatar_id":"","url":"https://api.github.com/users/tcmitchell","html_url":"https://github.com/tcmitchell","followers_url":"https://api.github.com/users/tcmitchell/followers","following_url":"https://api.github.com/users/tcmitchell/following{/other_user}","gists_url":"https://api.github.com/users/tcmitchell/gists{/gist_id}","starred_url":"https://api.github.com/users/tcmitchell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tcmitchell/subscriptions","organizations_url":"https://api.github.com/users/tcmitchell/orgs","repos_url":"https://api.github.com/users/tcmitchell/repos","events_url":"https://api.github.com/users/tcmitchell/events{/privacy}","received_events_url":"https://api.github.com/users/tcmitchell/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/GENI-NSF/geni-ch/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":{"login":"tcmitchell","id":340136,"avatar_url":"https://avatars.githubusercontent.com/u/340136?v=3","gravatar_id":"","url":"https://api.github.com/users/tcmitchell","html_url":"https://github.com/tcmitchell","followers_url":"https://api.github.com/users/tcmitchell/followers","following_url":"https://api.github.com/users/tcmitchell/following{/other_user}","gists_url":"https://api.github.com/users/tcmitchell/gists{/gist_id}","starred_url":"https://api.github.com/users/tcmitchell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tcmitchell/subscriptions","organizations_url":"https://api.github.com/users/tcmitchell/orgs","repos_url":"https://api.github.com/users/tcmitchell/repos","events_url":"https://api.github.com/users/tcmitchell/events{/privacy}","received_events_url":"https://api.github.com/users/tcmitchell/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/GENI-NSF/geni-ch/milestones/57","html_url":"https://github.com/GENI-NSF/geni-ch/milestones/2.12","labels_url":"https://api.github.com/repos/GENI-NSF/geni-ch/milestones/57/labels","id":1734169,"number":57,"title":"2.12","description":"","creator":{"login":"tcmitchell","id":340136,"avatar_url":"https://avatars.githubusercontent.com/u/340136?v=3","gravatar_id":"","url":"https://api.github.com/users/tcmitchell","html_url":"https://github.com/tcmitchell","followers_url":"https://api.github.com/users/tcmitchell/followers","following_url":"https://api.github.com/users/tcmitchell/following{/other_user}","gists_url":"https://api.github.com/users/tcmitchell/gists{/gist_id}","starred_url":"https://api.github.com/users/tcmitchell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tcmitchell/subscriptions","organizations_url":"https://api.github.com/users/tcmitchell/orgs","repos_url":"https://api.github.com/users/tcmitchell/repos","events_url":"https://api.github.com/users/tcmitchell/events{/privacy}","received_events_url":"https://api.github.com/users/tcmitchell/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":11,"state":"open","created_at":"2016-04-27T14:28:00Z","updated_at":"2016-05-06T19:38:58Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2016-04-27T12:26:51Z","updated_at":"2016-05-06T19:38:58Z","closed_at":"2016-05-06T19:38:58Z","body":"Imports are happening via different paths in `sys.path` (set in `ch_server.wsgi`). For example, Exceptions.py is imported as either `plugins.chapiv1rpc.chapi.Exceptions` or as `chapi.Exceptions`. This causes `isinstance` to fail unexpectedly in some (but not all) cases. This is because both `/usr/share/geni-ch/chapi/chapi` and `/usr/share/geni-ch/chapi/chapi/plugins/chapiv1rpc` are on the path and Exceptions is sometimes imported as `chapi.Exceptions` (e.g. `SAv1PersistentImplementation.py`).\r\n\r\nStraighten out the directories in `sys.path`, then make the import statements match. I recommend including only the top level directory (`/usr/share/geni-ch/chapi/chapi`, but use automake replacement) in the `sys.path`, and then importing as either `plugins.foo.bar` or `tools.foo.bar`.\r\n\r\nA meta question: should `sys.path` be set by `ch_server.wsgi` at all? Or should the path be set in WSGI config instead?"}}