setup_path_on_import: Don’t re-add BASE_DIR to sys.path.

BASE_DIR must already be in sys.path if we got as far as importing
this.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
Anders Kaseorg
2019-02-07 04:49:13 -08:00
committed by Tim Abbott
parent 8fdb62a6bc
commit e4832cc9da

View File

@@ -1,6 +1,5 @@
"""
Use libraries from a virtualenv (by modifying sys.path) in production.
Also add Zulip's root directory to sys.path
"""
import os
@@ -17,5 +16,3 @@ if sys.prefix != venv:
exec(open(activate_this).read(), {}, activate_locals)
if not os.path.exists(activate_locals["site_packages"]):
raise RuntimeError(venv + " was not set up for this Python version")
sys.path.append(BASE_DIR)