c9 / core

Cloud9 Core - Part of the Cloud9 SDK for Plugin Development https://c9.github.io/core/ https://c9.io
Other
2.56k stars 922 forks source link

Python Autocomplete Error (Error: Command failed: bash -c #!/usr/bin/env bash) #475

Open marcoarruda opened 6 years ago

marcoarruda commented 6 years ago

Hello,

I've configured the python path and everything is working, but there's a console error message everytime I use the autocomplete (Ctrl+Space)

2931: 11960: Error: Command failed: bash -c #!/usr/bin/env bash
# Helper script to launch jedi/pylint in a python2/3 virtualenv
set -e

PYTHON=$1
COMMAND=$2

SHAREDENV="/mnt/shared/lib/$PYTHON"
FALLBACKENV="$HOME/.c9/$PYTHON"

if [[ -d $SHAREDENV ]]; then
 ENV=$SHAREDENV
 source $ENV/bin/activate
 PYTHON="$ENV/bin/$PYTHON"
elif which virtualenv &>/dev/null; then
 ENV=$FALLBACKENV
 if ! [[ -d $ENV ]]; then
 VERSION=
 if [ "$PYTHON" = "python3" ]; then
 VERSION=--python=python3
 fi
 virtualenv $VERSION $ENV
 fi

 source $ENV/bin/activate

 if ! python -c 'import jedi' &>/dev/null; then
 echo "Installing python support dependencies" >&2
 pip install --upgrade jedi pylint pylint-flask pylint-django >&2
 fi

 PYTHON=$ENV/bin/$PYTHON
else
 echo "Python support fatal error: virtualenv not installed" >&2
 echo "try 'pip install virtualenv' or 'sudo pip install virtualenv'" >&2
 exit 1
fi

COMMAND=${COMMAND/\$PYTHON/$PYTHON}
COMMAND=${COMMAND/\$ENV/$ENV}
eval "$COMMAND" -- python2 $ENV/bin/pylint -d all -e E -e F -e W0101 -e W0109 -e W0199 -e W0612 -e W0602 -r n --msg-template={line}:{column}:\ [{msg_id}]\ {msg} --load-plugins pylint_flask,pylint_django '/home/user/catkin_ws/src/mypkg/scripts/.~c9_invoke_oE2J4Y.py'
Traceback (most recent call last):
  File "/home/user/.c9/python2/bin/pylint", line 11, in <module>
    sys.exit(run_pylint())
  File "/home/user/.c9/python2/local/lib/python2.7/site-packages/pylint/__init__.py", line 16, in run_pylint
    Run(sys.argv[1:])
  File "/home/user/.c9/python2/local/lib/python2.7/site-packages/pylint/lint.py", line 1268, in __init__
    linter.load_plugin_modules(self._plugins)
  File "/home/user/.c9/python2/local/lib/python2.7/site-packages/pylint/lint.py", line 495, in load_plugin_modules
    module.register(self)
  File "/home/user/.c9/python2/local/lib/python2.7/site-packages/pylint_django/plugin.py", line 22, in register
    start = name_checker.config.const_rgx.pattern[:-2]
AttributeError: 'NoneType' object has no attribute 'pattern'

    at ChildProcess.exithandler (child_process.js:213:12)
    at emitTwo (events.js:87:13)
    at ChildProcess.emit (events.js:172:7)
    at maybeClose (internal/child_process.js:827:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)

Did I forget to install anything?

Up to now, I've installed virtualenv, so I suppose it install the rest of the dependencies inside the virtualenv used by C9, right?

Thanks!

marcoarruda commented 6 years ago

I found this error in pylint-django repo issues: https://github.com/landscapeio/pylint-django/issues/108 After downgrading pylint to version 1.7.5, it was solved. Another error comes up though.

This message comes up in the console the first time I try to use the autocomplete: Error: Warning: python_linter not initialized yet

Error: Warning: python_linter not initialized yet
    at Object.handler.analyze (python_linter.js:62)
    at worker.js:632
    at loop (worker.js:234)
    at module.exports.asyncForEach (worker.js:220)
    at exports.LanguageWorker.asyncForEachHandler (worker.js:382)
    at analyzeParsed (worker.js:620)
    at worker.js:448
    at loop (worker.js:231)
    at module.exports.asyncForEach (worker.js:220)
    at exports.LanguageWorker.asyncForEachHandler (worker.js:382)

Is it normal? Because in the frontend nothing is shown. I was expecting a loading window or maybe a message that informs me to wait for python suggestion server. If not, I'd suggest this feature because as an user, no feedback after pressing Ctrl+Space is bad.

Thanks!