Results 1 to 3 of 3

Thread: Store doesn't execute my python script

  1. #1
    Sencha User
    Join Date
    Sep 2013
    Posts
    4
    Answers
    1

    Default Answered: Store doesn't execute my python script

    I'm using ExtJs 4.2.2 on Windows and I'm willing to execute a python script to load my json data.
    I'm following the example in the documentation and I'm facing an error I can't understand : my store doesn't seem to execute my python script to get a response, instead it tries to load my source code as a json file.

    test.py :
    Code:
    #!C:\Python27\python.exe
    import json
    print "Content-type: application/json\n\n"
    print("{\"text\":\".\",\"UserStories\":[{\"id\": \"1\", \"State\":\"hello\", \"headline\": \"world\", \"category\": \"rien\"}]}")
    my store TreeGrid.js:
    Code:
    Ext.define
    (
        'CMS.store.TreeGrid', 
        {
            extend: 'Ext.data.TreeStore',
            
            model: 'CMS.model.TreeGrid',
            storeId: 'TreeGrid',
            autoLoad: false,
            autoSync: true,
            proxy: 
            {
                type: 'ajax',
                url: 'pythonScripts/test.py',
    
                reader:
                {
                    type: 'json',
                    root: 'UserStories'
                },
                
            },
            folderSort: true
        }
    );
    the function in my controller :
    Code:
    onRequest: function()
    {
         var myStore = this.getTreeGridStore();
         myStore.load
         (
              {
                    scope: this
               }
         );
         Ext.Ajax.request
                (
                    {
                        url: 'pythonScripts/test.py',
                        success: function(response, opts) 
                        {
                            var obj = Ext.decode(response.responseText);
                            console.dir(obj);
                        },
                        failure: function(response, opts) 
                        {
                            console.dir('server-side failure with status code ' + response.status);
                        }
                    }
                );
    }
    And here is the response I get on FireBug:
    errorPython.png

    I just can't get why it's not executing the script but tries to get the raw code in it.
    Any help would be appreciated, thank you.

  2. It appeared my Apache server was simply not configured to deal with python scripts. I only had to modify my httpd.conf file and now it works just fine.

  3. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985
    Answers
    506

    Default

    Sounds like it's not executing. Check that your permissions and ownership settings allow Ext to execute your python script, and that the first line actually points correctly to your Python installation.

  4. #3
    Sencha User
    Join Date
    Sep 2013
    Posts
    4
    Answers
    1

    Default

    It appeared my Apache server was simply not configured to deal with python scripts. I only had to modify my httpd.conf file and now it works just fine.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •