unable to install plugin via Python Api

Ouss
Ouss Registered Posts: 2

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")
" height="20" loading="lazy">">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

Answers

  • GuillaumeDubois
    GuillaumeDubois Registered Posts: 5 ✭✭✭
    edited July 17

    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.

Setup Info
    Tags
      Help me…