Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
armarti opened this issue Jan 17, 2017 · 3 comments
Open

Comments

@armarti
Copy link

armarti commented Jan 17, 2017

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.

@itsjef
Copy link

itsjef commented Jan 18, 2017

Perfect! It works for me.

Plus, you have to put the very same line into both bin/inbox-start, bin/inbox-auth, and bin/inbox-api if you want to start the service.

@ajcollett
Copy link

Can this not be added in setup.sh to permanently add it to the system path? Specially if we are using a virtual machine.

@spang
Copy link
Contributor

spang commented Mar 8, 2017

Saw this while QAing the latest release today.

I think the root of this issue is actually that /usr/local/lib/python2.7/dist-packages/inbox is created at all during setup.sh—if you remove that empty directory, everything works fine.

Has anyone figured out what creates that directory?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants