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

swallow_startup_errors wall text not helpful #850

Open stdedos opened 4 years ago

stdedos commented 4 years ago

Expected Behaviour

I can debug swallow_startup_errors wall of error

Actual Behaviour

>>> import socket; socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect(/home/luser/.local/share/anaconda/run/anaconda-5/anaconda.sock)
  File "<string>", line 1
    import socket; socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect(/home/luser/.local/share/anaconda/run/anaconda-5/anaconda.sock)
                                                                             ^
SyntaxError: invalid syntax
>>> import socket; socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect('/home/luser/.local/share/anaconda/run/anaconda-5/anaconda.sock')
Traceback (most recent call last):
  File "<string>", line 1, in <module>
TypeError: getsockaddrarg: AF_INET address must be tuple, not str
>>> import socket; socket.socket((socket.AF_INET, socket.SOCK_STREAM)).connect('/home/luser/.local/share/anaconda/run/anaconda-5/anaconda.sock')
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "./python3.3/socket.py", line 94, in __init__
TypeError: an integer is required (got type tuple)
$ ps aux | grep anaconda
python3 -B /home/luser/.config/sublime-text-3/Packages/Anaconda/anaconda_server/jsonserver.py -p anaconda-46 21210
$ ls -lah /home/luser/.local/share/anaconda/run/anaconda-5/anaconda.sock
srwxr-xr-x 1 u u 0 Μάρ  27  2018 /home/luser/.local/share/anaconda/run/anaconda-5/anaconda.sock

Steps to Reproduce

??

ST3, Anaconda and OS versions

3211 / ?? / Ubuntu 16.04

ST3 Console Logs

anacondaST3: ERROR - <Anaconda.anaconda_lib.workers.local_worker.LocalWorker object at 0x7f906c6add90> initial check failed because:

can not connect to /home/luser/.local/share/anaconda/run/anaconda-5/anaconda.sock. tried to connect 21 times during 2.0 seconds

check that there is Python process executing the anaconda jsonserver.py script running in your system. If there is, check that the Unix Domain Socket file /home/luser/.local/share/anaconda/run/anaconda-5/anaconda.sock exists and that you can connect to it writing the following script in your Sublime Text 3 console:

import socket; socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect(/home/luser/.local/share/anaconda/run/anaconda-5/anaconda.sock)

If anaconda works just fine after you received this error and the command above worked you can make anaconda to do not show you this error anymore setting the 'swallow_startup_errors' to 'true' in your configuration file.

Anaconda's JsonServer Logs

Note: Anaconda's JsonServer logs can be found in:

A lot of data, with a lot of names and A LOT of history. You'll have to settle for:

2018-03-27 15:43:58,527: DEBUG   : bind: address=/home/luser/.local/share/anaconda/run/anaconda-5/anaconda.sock
2018-03-27 15:43:58,527: DEBUG   : listen: backlog=5
2018-03-27 15:43:58,527: INFO    : Anaconda Server started in /home/luser/.local/share/anaconda/run/anaconda-5/anaconda.sock for PID 28898 with cache dir /home/luser/.cache/jedi/anaconda-5
2018-03-27 15:43:58,620: INFO    : Incomming connection from b''
2018-03-27 15:43:58,620: INFO    : Incomming connection from b''
2018-03-27 15:43:58,625: INFO    : client requests: lint
2018-03-27 15:44:00,653: INFO    : client requests: lint
2018-03-27 15:44:09,547: INFO    : client requests: lint
2018-03-27 15:44:13,528: INFO    : client requests: lint
2018-03-27 15:44:28,769: INFO    : client requests: lint
2018-03-27 15:44:32,645: INFO    : client requests: lint
2018-03-27 15:44:35,234: INFO    : client requests: lint
2018-03-27 15:49:10,020: INFO    : client requests: lint
2018-03-27 15:49:22,863: INFO    : process 28898 does not exists stopping server...
2018-03-27 15:49:22,864: INFO    : Closing the socket, server will be shutdown now...
DamnWidget commented 4 years ago

Does this issue comes with a suggestion for improvement? The other option is to ignore errors by default and hide any possible legit error.

I really don't understand what is the purpose of this issue if it is not start a conversation about possible better approaches but is not the case :thinking:

stdedos commented 4 years ago

The suggestion is:

I can understand somehow what swallow_startup_errors wall of error means

If I knew what the problem is, or was able to somehow understand it, we could discuss about something. If I don't know, I can only say: "Anaconda barfed - here's what it tried to tell me"

Even the code provided at the Console Logs seems broken (or I am doing something wrong - enlighten me)

DamnWidget commented 4 years ago

That error is telling you that for unknown reasons to the plugin, it is having a hard time trying to connect the ST3 side with the background server side and that it failed 21 times to do in 2 seconds. That can be fine or can make the plugin to don't work at all and it might surface other issues that you can have in your setup.

The code, looks like is missing quotes around the path for the UNIX socket file and then that AF_INET should be AF_UNIX as you are trying to access a UNIX socket and not a TCP endpoint, will take a look to the code that generates that code, apart from that I can not tell you anything about this, if anaconda works fine for you, just set the swallowing option to true and call it day.

stdedos commented 4 years ago

[...] if anaconda works fine for you, just set the swallowing option to true and call it day.

In all honesty, Anaconda never fully worked for me the way I expected it to work.

So, I am not sure what works and what not 😕

cogmind commented 4 years ago

I have a similar error when opening a file through drag and drop (in Origami):

<Anaconda.anaconda_lib.workers.local_worker.LocalWorker object at 0x130000229C4DE8CC0> initial check failed because:

connection to localhost:53849 timed out after 0.2s. tried to conned 7 times during 2.0 seconds

check that there is Python process executing the anaconda jsonserver.py script running in your system. If there is, check that you can conned to your localhost writing the following script in your Sublime Text 3 console:

import socket socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect("("localhost", 53849)")

If anaconda works just fine after you received this error and the command above worked you can make anaconda to do not show you this error anymore setting the 'swallow_startup_errors' to 'true' in your configuration file.

frankrolf commented 4 years ago

I get this popup periodically, too. Anaconda works as expected. The problem with the suggested resolution is that the snippet contains a syntax error:

suggested:

import socket; socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect("("localhost", 49878)")

should be:

import socket; socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect(("localhost", 49878))