dgarana/vulcano

Running non-existent command with a parameter results in crash

Closed this issue · 4 comments

I really like the looks of your project and am keen to make use of it.

Noticed a breaking issue if you try running a non-existent command with a parameter. Can verify with the example your project provides: simple_example.py

>>by
Command by not found
Did you mean: "bye"?
>>bye Bob
Bye Bob!
>>by Bob
Traceback (most recent call last):
...
  File "/vulcano/command/completer.py", line 33, in get_completions
    completions = self.__get_current_completions(text_arr[:-1])
  File "/vulcano/command/completer.py", line 42, in __get_current_completions
    command_obj = self.manager.get(command)
  File "/vulcano/command/classes.py", line 118, in get
    raise CommandNotFound('Command {} not found'.format(command_name))

not sure it's the best solution, but my quick and dirty hack to fix it was just to wrap line 33 from completer.py above with a try/except

try:
    completions = self.__get_current_completions(text_arr[:-1])
except:
    completions = []

which results in

>> by Bob
Command by not found
Did you mean: "bye"?

Hi Measton, thanks for reporting this.

Could you please provide me the libraries versions you have installed on the environment? And which python version you are using?

I'm unable to reproduce this locally with latest library version.

Thanks a lot.

Hi dgarana,

Thanks for the quick response.

I'm on CentOS. I used conda to create an environment python=3.7.3 and then
pip install vulcano
which gave me 0.5.2

Here's the rest of what I have in my conda environment:

>python --version
Python 3.7.3

>pip freeze
autobahn==19.10.1
cached-property==1.5.1
certifi==2020.4.5.1
ConfigArgParse==0.14.0
configparser==3.7.4
cryptography==2.8
gevent==1.4.0
gevent-socketio==0.3.6
gevent-websocket==0.10.1
greenlet==0.4.15
netifaces==0.10.6
numpy==1.16.2
pandas==0.24.2
pipenv==2018.11.26
prompt-toolkit==3.0.5
Pygments==2.6.1
pynspector==0.0.4
pyparsing==2.4.7
python-dateutil==2.8.0
pytz==2019.1
six==1.14.0
socketIO-client==0.7.2
txaio==18.8.1
virtualenv==16.7.7
virtualenv-clone==0.5.3
vulcano==0.5.2
wcwidth==0.1.9
websocket-client==0.56.0

Please let me know if there's anything else I can help provide (or test).

Thanks.

Thanks, I've updated the library, looks like a problem with latest changes from the promptoolkit library, the FuzzyCompleter was raising that error and the app wasn't able to catch it, probably because it was running on another async job.

You should be good now with latest version: 0.5.3.

Thanks for your contribution and let me know if you need anything else.