jcartledge / sublime-worksheet

An inline REPL for JavaScript, PHP, Ruby & more in Sublime Text 2 and 3
MIT License
332 stars 18 forks source link

support tools like rvm which allow to switch between versions of interpreter #16

Closed jcartledge closed 10 years ago

jcartledge commented 11 years ago

not sure how.

adrien-f commented 11 years ago

It would be great to also be able to use virtualenvs for python.

I think specifying the path to the executable (in the project settings perhaps ?) would be a nice addition

jcartledge commented 11 years ago

Hi - you can specify the path in the settings; people are doing that to work around a path bug with node in #25. It's a bit cumbersome though.

I haven't tested with virtualenv but my feeling Based on what we're seeing in the bug above) is that it should just work if you start ST from a virtualenv shell because the environment vars will be set correctly.

Feel free to check this out and confirm or refute my hypothesis ;)

adrien-f commented 11 years ago

Hi - thanks for your answer :+1:

I tried launching sublime from the command line with the virtualenv but it sadly doesn't get the path changes, here's what the script eval:

import pexpect as pex
import sys
print(pex.which('python'))
# > /usr/bin/python
print(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', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PIL', '/usr/lib/python2.7/dist-packages/gst-0.10', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/python2.7/dist-packages/ubuntuone-client', '/usr/lib/python2.7/dist-packages/ubuntuone-couch', '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol']

Of course, if I change the python path in the worksheet settings, it works, but that's not very useable day to day, having it reading from the project config would be awesome. I saw that you can get the view settings with view.settings().get('foo') so you can use this value or fallback on default, that would be awesome.

I can try to submit a pullrequest if I have some time tonight !

jcartledge commented 11 years ago

That's a great idea - please do.