Forums

Error epylint

A get an error when a try run lint.py_run:

/usr/local/bin/uwsgi: unrecognized option '--msg-template={msg_id}:{line:3d}'#012getopt_long() error

my code: from pylint import epylint as lint fileName = "/test1234.py" ARGS = " -r n --msg-template={msg_id}:{line:3d}" (pylint_stdout, pylint_stderr) = lint.py_run( fileName + ARGS, return_std=True)

Where are you getting that error? Is it in a console or in the website's logs?

On Web Site!

In Console is ok!

This error occurs only inside my controller in the flask. It looks like uWSGI does not allow the execution of the subprocess, in this the pylint.

My Code = https://www.pythonanywhere.com/user/renatosantos/files/home/renatosantos/TutorDevChatBeta/app/controllers/default.py?edit

URL:

http://renatosantos.pythonanywhere.com/teste

try:
    fileName =  "test.py"
    ARGS = " -r n --msg-template={msg_id}:{line:3d}"
    (pylint_stdout, pylint_stderr) = lint.py_run(fileName + ARGS, return_std=True)
except Exception as e:
    raise Exception(e)

if pylint_stderr.getvalue():
    print("Entrou no IF")
    print(pylint_stderr.getvalue())
    print("Command Args-->")
    print(fileName + ARGS)
    print("Output-->")
    print(pylint_stdout.getvalue())
    #raise Exception("Issue with pylint configuration")
else:
    print("Ok!")
    print(pylint_stdout.getvalue())

return jsonify(success="OK!")

That sounds like you're using 2 different versions of pylint between the console and the web app. Make sure you're using the same version in both and it should be fine.

My Console is same VirtualEnv! UWSGI is blocked my subprocess! It run only without Flask. Why?

take a look at your webapp error log, and also take a look at how py_run is supposed to work. You can't add args to it the filename like that.