Hi Michael,

> On 3 May 2018, at 20:24, Michael <[email protected]> wrote:
> 
> Hi,
>
> I am doing some tests with the Python API for VPP and I’ve run into some 
> problems with asynchronous operations.
>
> My current test script is loosely based on the examples from the wiki page - 
> I have included a snippet below:
>
> ####
> from vpp_papi import VPP
>
> vpp_json_dir = ‘/usr/share/vpp/api’
>
> def papi_event_handler(msgname, result):
>   # Currently just printing content of messages
>
> vpp = VPP(<list of files in above dir>
>
> vpp.connect(“test_papi”, async=True)
> vpp.status()
> vpp.api.show_version() # Verifying that api files are loaded and working
> vpp.register_event_callback(papi_event_handler)
> vpp.api.want_stats(True, 1231) # This is where the issues start occurring
>
> sleep(20)
> vpp.api.want_stats(False, 1231)
> vpp.disconnect()
> ####
>
> Running the script returns an error with want_stats():
>
> Traceback (most recent call last):
>   File "stats.py", line 48, in <module>
>   vpp.api.want_stats(True, 1231)
> TypeError: __call__() takes exactly 1 argument (3 given)
>
> Removing the arguments stops the error from showing, but also causes no stats 
> to be sent.
> The api file, stats.api.json, lists the arguments as (“enable_disable”, 
> “pid”), but it looks like the parser isn’t expecting any arguments.
>
> Am I using the API incorrectly, or is there a bug somewhere in the parser?

It uses named parameters. Try with enale_disable = True, pid = 1234. 

Sounds like an update to the example is in order. :-)

Best regards,
Ole


>
> Best Regards,
> Michael Pedersen
>
> 

Reply via email to