Cannot use external CURRENT source

Hello, I am trying to plug an external current source into a circuit I made with Pyspice. I first wanted to test the one in this example. I modyfied the code such that the plug source was a current one and not a voltage. However I haven’t had any sucess because every attempt I make to solve this this error is always raised:

"Circuit: Voltage Divider
Error on line 2 :
itest input 0 dc 0 external
parameter value out of range or the wrong type"

The code I am using is bellow:

import math

import matplotlib.pyplot as plt

import PySpice.Logging.Logging as Logging
logger = Logging.setup_logging()

from PySpice.Probe.Plot import plot
from PySpice.Spice.Netlist import Circuit
from PySpice.Spice.NgSpice.Shared import NgSpiceShared
from PySpice.Unit import *

class MyNgSpiceShared(NgSpiceShared):

    def __init__(self, amplitude, frequency, **kwargs):


        self._amplitude = amplitude
        self._pulsation = float(frequency.pulsation)

    # def get_vsrc_data(self, voltage, time, node, ngspice_id):
    #     self._logger.debug('ngspice_id-{} get_isrc_data @{} node {}'.format(ngspice_id, time, node))
    #     voltage[0] = self._amplitude
    #     return 0

    def get_isrc_data(self, current, time, node, ngspice_id):
        self._logger.debug('ngspice_id-{} get_isrc_data @{} node {}'.format(ngspice_id, time, node))
        # current[0] = self._amplitude * math.sin(self._pulsation * time)

        current[0] = self._amplitude * math.sin(self._pulsation * time)
        return 0

circuit = Circuit('Voltage Divider')

circuit.I('test', 'input', circuit.gnd, 'dc 0 external')
circuit.R(1, 'input', 'output', 10@u_kΩ)
circuit.R(2, 'output', circuit.gnd, 1@u_kΩ)

amplitude = u_A(10)
frequency = 50@u_Hz
ngspice_shared = MyNgSpiceShared(amplitude=amplitude, frequency=frequency, send_data=False)
simulator = circuit.simulator(temperature=25, nominal_temperature=25,
                              simulator='ngspice-shared', ngspice_shared=ngspice_shared)
period = float(frequency.period)
analysis = simulator.transient(step_time=period/200, end_time=period*2)

figure1, ax = plt.subplots(figsize=(20, 10))
ax.set_title('Voltage Divider')
ax.set_xlabel('Time [s]')
ax.set_ylabel('Voltage [V]')
ax.plot(analysis.input.abscissa, analysis.input)
ax.plot(analysis.output.abscissa, analysis.output)
ax.legend(('input', 'output'), loc=(.05,.1))
ax.set_ylim(float(-amplitude*1.1), float(amplitude*1.1))


Thank you for your time.