# Python scripting not returning a response

**URL:** <https://community.dreamfactory.com/t/python-scripting-not-returning-a-response/2717>\
**Category:** Server-Side Scripting\
**Created:** [May 16, 2016, 5:23pm UTC](https://community.dreamfactory.com/t/python-scripting-not-returning-a-response/2717 "2016-05-16T17:23:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![phooper](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/phooper/32/1084_2.png) [@phooper](https://community.dreamfactory.com/u/phooper)\
**Post date:** [May 16, 2016, 5:23pm UTC](https://community.dreamfactory.com/t/python-scripting-not-returning-a-response/2717/1 "2016-05-16T17:23:23Z")

</div>

Hi there,

We recently upgraded our DF instance to 2.1.2 in order to use the Python custom scripting feature. When trying to run the example “Math” custom scripting service, no content is sent in the response. When I set the log level to DEBUG, I get the following output in the logs when I call the custom script using a GET request at /api/v2/math/add?n1=4&n2=5:

`{'resource': 'add', 'script_result': {'result': 9.0}, ' __tag__': 'exposed_event', 'request': {'parameters': {'n1': '4', 'n2': '5'}, 'payload': [], 'content': '', 'headers': {'postman-token': ['redacted'], 'content-length': ['0'], 'accept-language': ['en-US'], 'accept-encoding': ['gzip, deflate'], 'cache-control': ['no-cache'], 'x-dreamfactory-api-key': ['redacted'], 'content-type': [''], 'host': ['redacted'], 'accept': ['*/*'], 'user-agent': ['Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Postman/4.1.1 Chrome/47.0.2526.73 Electron/0.36.2 Safari/537.36']}, 'content_type': None, 'method': 'GET', 'api_version': '2.0'}, 'response': {'content': None, 'status_code': 200, 'content_type': None}}`

In the output, I can see the “script\_result” is what I wanted, which leads me to believe that DF is passing the script to Python correctly. However, the “response”: “content” is set to none, which is what’s confusing me; I have no idea why that is.

Not sure if this is related, but the following errors are generated from the admin web-interface for our DF instance:

`* System error building event map for service 'system'.`  
`Service configuration class name lookup failed for resource DreamFactory\Core\Resources\System\Setting`  
`* System error creating swagger file for service 'system'.`  
`Service configuration class name lookup failed for resource DreamFactory\Core\Resources\System\Setting`

I’ve included our DF details below. Any help would really be appreciated! Thank you!

* * *

**DreamFactory Instance**  
Admin Application Version: 2.1.6  
DreamFactory Version: 2.1.2  
System Database: mysql

**Server**  
Operating System: linux  
Release: 3.10.0-327.13.1.el7.x86\_64  
Version: #1 SMP Mon Feb 29 13:22:02 EST 2016  
Machine: x86\_64

---

<div class="post-metadata">

**Author:** ![benbusse](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/benbusse/32/4_2.png) [@benbusse](https://community.dreamfactory.com/u/benbusse)\
**Post date:** [May 16, 2016, 5:47pm UTC](https://community.dreamfactory.com/t/python-scripting-not-returning-a-response/2717/2 "2016-05-16T17:47:40Z")

</div>

we’re taking a look. will post soon.

---

<div class="post-metadata">

**Author:** ![aislam](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/aislam/32/421_2.png) [@aislam](https://community.dreamfactory.com/u/aislam)\
**Post date:** [May 16, 2016, 6:14pm UTC](https://community.dreamfactory.com/t/python-scripting-not-returning-a-response/2717/3 "2016-05-16T18:14:47Z")

</div>

Python scripting in 2.1.2 is currently in beta and unfortunately there is a bug that blocks the response. We have already addressed this issue and the fix will be available in the next release. However, if you really need to get this going before the next release comes out then feel free to make this small modification and it should work for you.

Edit file vendor/dreamfactory/df-core/src/Scripting/Engines/Python.php and drop the following code before the closing curly braces ( } ) near the end of this file.

`
/** @inheritdoc */
    protected function checkOutputStringForData($output)
    {
        return ((strlen($output) > 10) && (false !== strpos($output, 'request')));
    }
</code`

---

<div class="post-metadata">

**Author:** ![phooper](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/phooper/32/1084_2.png) [@phooper](https://community.dreamfactory.com/u/phooper)\
**Post date:** [May 16, 2016, 7:11pm UTC](https://community.dreamfactory.com/t/python-scripting-not-returning-a-response/2717/4 "2016-05-16T19:11:15Z")

</div>

Thanks, looks like that fixed what I was trying to do. I appreciate the help!
