unable to install plugin via Python Api

Ouss
Level 1
unable to install plugin via Python Api

I'm Trying to install a plugin through running this python code on dataiku server and i'm getting error of  

DataikuException: java.lang.Exception: Could not install the plugin

this is the code

import dataikuapi

import urllib3

urllib3.disable_warnings()


apiKey = [removed]
client = dataikuapi.DSSClient(host, apiKey)
client._session.verify = False
with open("/busdata/dss-plugin-pi-system-1.0.1.zip", "r", encoding='latin1') as f:
   client.install_plugin_from_archive("/busdata/dss-plugin-pi-system-1.0.1.zip")


โš ๏ธPS: if i remove encoding='latin1'
I get error 
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x96 in position 11: invalid start byte

Operating system used: Centos
0 Kudos
1 Reply
GuillaumeDubois
Level 2

Hello,

Contrary to what appears in the doc:

 

with open("myplugin.zip", "r") as f:
    client.install_plugin_from_archive(f)

 

You should use rb (read bytes) to read the archive correctly and have it installed in the instance:

 

with open("dss-plugin-pi-system-1.0.1.zip", "rb") as plugin:
    client.install_plugin_from_archive(plugin)

 

I tested it, works fine in version 11.2.

 

Cheers.

0 Kudos