[Fixed]-Ajax call to local .py script works fine until I add a simple import at the top, upon which it fails with a 500 error

1👍

Try adding

import cgitb
cgitb.enable()

to the top of the python file. This should redirect the traceback to the browser when the Internal Server Error occurs and give you more information. Remember to remove this for production.

0👍

I had a similar problem working on the web server because when I created new documents they did not have correct read/write/execute permissions. Could that be the issue with the document you are trying to include? And do you need to include the “py” file extension to the file name ” in the ajax call?

$.ajax({
        type: 'GET',
        url: 'get-dropdown-contents.py', //a url mapping to controller_ajax.py
        dataType:'json',
        data: {'selection_path': selectionPath},
        success: function (data) {
               //blah blah blah.... it doesn't reach here

Leave a comment