DamnWidget / anaconda

Anaconda turns your Sublime Text 3 in a full featured Python development IDE including autocompletion, code linting, IDE features, autopep8 formating, McCabe complexity checker Vagrant and Docker support for Sublime Text 3 using Jedi, PyFlakes, pep8, MyPy, PyLint, pep257 and McCabe that will never freeze your Sublime Text 3
http://damnwidget.github.io/anaconda/
GNU General Public License v3.0
2.22k stars 259 forks source link

Sublime Text seems to be having trouble reaching my vagrant machine #539

Open tamakisquare opened 8 years ago

tamakisquare commented 8 years ago

Continuing from after #537 is resolved.

Now that I have made vagrant available in my PATH for Sublime Text 3, I am facing a different problem. The errors that I get, however, are different depending on whether my vagrant machine is already running.

In the case that the vagrant machine is already running, when I open my sublime project, I get two of the same prompt that reads

rose virtual machine is not running, do you want to start it now (it may take a while)?

Note rose is the machine name. In this prompt, there are two choices, "Cancel" and "Start Now". Regardless which one I click on, on top of that prompt, another same prompt gets spawned. It's basically endless and a force quit on Sublime Text is inevitable.

On the other hand, if the vagrant machine is poweroff when I open the sublime project, I get the same two prompts mentioned above. But the difference is when I click on "Start Now", I get the following error (stack trace), without having another prompt spawned.

Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 231, in run_callback
    expr()
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 252, in <lambda>
    run_callback('on_load', callback, lambda: callback.on_load(v))
  File "/Users/windbottle/Library/Application Support/Sublime Text 3/Packages/Anaconda/listeners/linting.py", line 80, in on_load
    self.run_linter(view)
  File "/Users/windbottle/Library/Application Support/Sublime Text 3/Packages/Anaconda/anaconda_lib/linting/sublime.py", line 347, in run_linter
    Worker().execute(Callback(on_success=parse_results), **data)
  File "/Users/windbottle/Library/Application Support/Sublime Text 3/Packages/Anaconda/anaconda_lib/workers/market.py", line 108, in execute
    _start_worker(worker, callback, **data)
  File "/Users/windbottle/Library/Application Support/Sublime Text 3/Packages/Anaconda/anaconda_lib/workers/market.py", line 75, in _start_worker
    wk.start()
  File "/Users/windbottle/Library/Application Support/Sublime Text 3/Packages/Anaconda/anaconda_lib/workers/vagrant_worker.py", line 29, in start
    if not self.check_config():
  File "/Users/windbottle/Library/Application Support/Sublime Text 3/Packages/Anaconda/anaconda_lib/workers/vagrant_worker.py", line 92, in check_config
    self.interpreter.machine, self.interpreter.vagrant_root
  File "/Users/windbottle/Library/Application Support/Sublime Text 3/Packages/Anaconda/anaconda_lib/vagrant.py", line 219, in __init__
    with vagrant_root(directory):
  File "./python3.3/contextlib.py", line 48, in __enter__
  File "/Users/windbottle/Library/Application Support/Sublime Text 3/Packages/Anaconda/anaconda_lib/contexts.py", line 17, in vagrant_root
    os.chdir(os.path.expanduser(directory))
  File "./python3.3/posixpath.py", line 252, in expanduser
AttributeError: 'NoneType' object has no attribute 'startswith'

Please advise how I should continue with my troubleshooting. Thanks.

DamnWidget commented 8 years ago

I think I know what the problem is, you have two options to solve it until I fix this and release the fix (it will wait a while as I am currently working in the Golang plugin for anaconda).

One of the ways is tedious and requires you to hack into anaconda's in memory data structures so let's go with the manual method better.

That will work, I will let you know when this issue is fixed, let me know if you could make it work in the way explained above.

trojkat commented 8 years ago

@DamnWidget This workaround is not fully working, because I see some requests on minserver.py console, but there is integration with my virtual env.

"python_interpreter": "tcp://localhost:19360?network=public&dev=eth0&interpreter=/src/my_env/bin/python&extra=/src/my_project"

How to run minserver to access virtual env? I'm running:

python -B /anaconda/anaconda_server/minserver.py -p my_project -e /src/my_project 19360
DamnWidget commented 8 years ago

@trojkat Start the minserver with /src/my_env/bin/python -B /anaconda/anaconda_server/minserver.py -p my_project -e /src/my_project 19360

trojkat commented 8 years ago

Lol, now everything works even without workaround, I just restarted ST3...

tamakisquare commented 8 years ago

@DamnWidget - The workaround works great. Thank you. Tag me when you have the patch in place and I'll help with verifying it. Cheers.