Install Python in Bitnami

Hello all,

I’m using Bitnami Dreamfactory 2.3.1-0 and I tried to use the Math service in Python given in the example scripts but I always have the same error

{
“error”: {
“context”: null,
“message”: “Executed command returned with error code: 1”,
“code”: 500
}
}

I tried to edit the .env file

DF_PYTHON_PATH=C:\PROGRA~1\Python36\python.exe

and reload the environment with the command

php artisan dreamfactory:setup

but I still have the 500 error with trace array… Did I miss something ?

@Julien_Tissier After you edit the .env file, run ../../../php/php artisan config:clear to clear the cached config and ../../../php/php artisan cache:clear . The php artisan dreamfactory:setup command is only used when setting up the DF environment.

It’s also important to note that if you intend to use Python for scripting you will need to install the ‘bunch’ module pip install bunch

Hello, thanks for you answer

I already did everything (see below), I redo it but still have the error.

I finally resolved my issue !

It seems Dreamfactory only supports Python 2 and I had 3.6 version

I launched the service.math python script directly in cmd and I got the error “ImportError: No module named httplib”

This error means I am running Python 2 code on Python 3. In Python 3, the module has been renamed to http.client.

Then I removed Python 3.6 and added python 2.7, updated the .env file, launched artisan commands and tested my python script and… I got a new error !

It appeats the script given (in https://wiki.dreamfactory.com/DreamFactory/Features/Scripting/Python and https://wiki.dreamfactory.com/DreamFactory/Tutorials/Python_Custom_scripting_service_math) uses em-dash in a comment.

But when you save the script, the em-dash is saved as an encoded character and everybody know Python 2.7 has encoding issues (sorry I can not display a second picture)…

So I resolved my problem but please, if someone can update links given above and tell users they need python 2 and remove the em-dash in examples !