sync-engine icon indicating copy to clipboard operation
sync-engine copied to clipboard

sys.path may be in wrong order when bin/create-db is run during setup.sh

Open armarti opened this issue 7 years ago • 3 comments

Hello, my git show --oneline -s shows 0d607a3 Release 17.1.6 (#424).

After running vagrant ssh after first setting up this repo, running ./setup.sh kept failing on NYLAS_ENV=dev bin/create-db with this error message:

File "bin/create-db", line 12, in <module> from inbox.config import config

And my path:

$ python -c 'import sys; print "\n".join(sys.path);' /usr/lib/python2.7 /usr/lib/python2.7/plat-linux2 /usr/lib/python2.7/lib-tk /usr/lib/python2.7/lib-old /usr/lib/python2.7/lib-dynload /usr/local/lib/python2.7/dist-packages /vagrant /usr/lib/python2.7/dist-packages /usr/lib/pymodules/python2.7

Notice /usr/local/lib/python2.7/dist-packages is in front of /vagrant.

I have:

$ ls -1 /usr/local/lib/python2.7/dist-packages/inbox __init__.py __init__.pyc $ ls -1 /vagrant/inbox ... config.py config.pyc ...

Thus, when from inbox.config import config is run in bin/create-db it is looking for a config module in /usr/local/lib/python2.7/dist-packages (it's not there).

There is probably a more elegant way of correcting this, adding this to /vagrant/bin/create-db worked:

import sys sys.path = ["/vagrant"] + [p for p in sys.path if p != "/vagrant"]

Then I run NYLAS_ENV=dev bin/create-db and everything works correctly.

armarti avatar Jan 17 '17 21:01 armarti