# Call and pub commands in basic usage demo

**URL:** <https://forum.opencyphal.org/t/call-and-pub-commands-in-basic-usage-demo/893>\
**Category:** PyCyphal\
**Created:** [July 28, 2020, 11:10am UTC](https://forum.opencyphal.org/t/call-and-pub-commands-in-basic-usage-demo/893 "2020-07-28T11:10:54Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![lellisjr](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/lellisjr/32/642_2.png) [@lellisjr](https://forum.opencyphal.org/u/lellisjr)\
**Post date:** [July 28, 2020, 11:10am UTC](https://forum.opencyphal.org/t/call-and-pub-commands-in-basic-usage-demo/893/1 "2020-07-28T11:10:55Z")

</div>

_Ref: Pyuavcan 1.1.0.dev1, Windows 10, Python 3.8.2, UDP/Loopback._

Hi Everyone!  
I’m a beginner trying evaluating the demo. Heartbeats are being subscribed and diagnostic session is waiting for demo publications. However, I’m facing some trouble with the call and pub commands (please take a look at console messages below - sorry, i’m not allowed to upload files yet).  
Could you please help me?  
Thanks in advance.  
Best regards,  
Lellis

Console messages:

```nohighlight
uvc call --tr="UDP('127.0.0.111/8')" 42 123.sirius_cyber_corp.PerformLinearLeastSquaresFit.1.0 '{points: [{x: 10, y: 1}, {x: 20, y: 2}]}'
Error: ScannerError: while scanning a quoted scalar
  in "<unicode string>", line 1, column 1:
    '{points:
    ^ (line: 1)
found unexpected end of stream
  in "<unicode string>", line 1, column 10:
    '{points:
             ^ (line: 1)
             
uvc pub 283.uavcan.si.temperature.Scalar.1.0 '{kelvin: 123.456}' --count=2 --tr="UDP('127.0.0.111/8')"
Error: TypeError: __init__ () missing 1 required positional argument: 'message'

```

---

<div class="post-metadata">

**Author:** ![pavel.kirienko](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/pavel.kirienko/32/9_2.png) [@pavel.kirienko](https://forum.opencyphal.org/u/pavel.kirienko)\
**Post date:** [July 28, 2020, 11:18am UTC](https://forum.opencyphal.org/t/call-and-pub-commands-in-basic-usage-demo/893/2 "2020-07-28T11:18:52Z")

</div>

I can’t reproduce your issues locally. Are you sure you are executing exact same commands that you’ve copy-pasted here? The first one in particular looks like a minor syntax error. I am trying this on GNU/Linux though, so there may be some subtle differences here also.

---

<div class="post-metadata">

**Author:** ![lellisjr](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/lellisjr/32/642_2.png) [@lellisjr](https://forum.opencyphal.org/u/lellisjr)\
**Post date:** [July 28, 2020, 11:24am UTC](https://forum.opencyphal.org/t/call-and-pub-commands-in-basic-usage-demo/893/3 "2020-07-28T11:24:33Z")

</div>

Hi Pavel,  
Yes, messages were directly copied from the console. In fact, I copied commands from the Pyuavcan basic demo usage and just added the transport argument.  
BR.

---

<div class="post-metadata">

**Author:** ![pavel.kirienko](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/pavel.kirienko/32/9_2.png) [@pavel.kirienko](https://forum.opencyphal.org/u/pavel.kirienko)\
**Post date:** [July 28, 2020, 11:44am UTC](https://forum.opencyphal.org/t/call-and-pub-commands-in-basic-usage-demo/893/4 "2020-07-28T11:44:15Z")

</div>

Ok I just reproduced your error. The problem is that you’ve copy-pasted the commands incorrectly. See:

```nohighlight
$ uvc call --tr="UDP('127.0.0.111/8')" 42 123.sirius_cyber_corp.PerformLinearLeastSquaresFit.1.0 '{points:[{x: 10, y: 1}, {x: 20, y: 2}]}'
Error: ParserError: while parsing a flow mapping
  in "<unicode string>", line 1, column 1:
    {points:[{x: 10, y: 1}, {x: 20, ... 
    ^ (line: 1)
expected ',' or '}', but got '['
  in "<unicode string>", line 1, column 9:
    {points:[{x: 10, y: 1}, {x: 20, y: 2}]}
            ^ (line: 1)

```

```nohighlight
$ uvc pub 12345.uavcan.si.sample.temperature.Scalar.1.0'{kelvin: 123.456}' --count=2 --tr="UDP('127.0.0.111/8')"
Error: TypeError: __init__ () missing 1 required positional argument: 'message'

```

If you put the missing spaces back, the commands work properly.

(I just noticed one unrelated error in the docs which I fixed just now: [https://github.com/UAVCAN/pyuavcan/commit/1d5dbf07b6acc64576ca4f1deaae3b35bd7df377](https://github.com/UAVCAN/pyuavcan/commit/1d5dbf07b6acc64576ca4f1deaae3b35bd7df377))

---

<div class="post-metadata">

**Author:** ![lellisjr](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/lellisjr/32/642_2.png) [@lellisjr](https://forum.opencyphal.org/u/lellisjr)\
**Post date:** [July 28, 2020, 1:51pm UTC](https://forum.opencyphal.org/t/call-and-pub-commands-in-basic-usage-demo/893/5 "2020-07-28T13:51:07Z")

</div>

I’m deeply sorry. My pub command was using subject id 283 instead of 12345 as you pointed out. It was fixed. Spaces were ok. Commands only worked properly when I replaced the ‘’’ (ASCII code 39) characters by ‘"’ (ASCII code 34) ones in YAML\_FIELDS. See below:

1. Call command  
FROM: ‘{points: [{x: 10, y: 1}, {x: 20, y: 2}]}’  
TO: “{points: [{x: 10, y: 1}, {x: 20, y: 2}]}”
2. Pub command  
FROM: ‘{kelvin: 123.456}’  
TO: “{kelvin: 123.456}”  
Thank you very much.

---

<div class="post-metadata">

**Author:** ![pavel.kirienko](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/pavel.kirienko/32/9_2.png) [@pavel.kirienko](https://forum.opencyphal.org/u/pavel.kirienko)\
**Post date:** [July 28, 2020, 2:33pm UTC](https://forum.opencyphal.org/t/call-and-pub-commands-in-basic-usage-demo/893/6 "2020-07-28T14:33:25Z")

</div>

> [@lellisjr](#):
>
> My pub command was using subject id 283 instead of 12345 as you pointed out. It was fixed. Spaces were ok.

The subject-ID has nothing to do with it. 283 works just as well as 12345 does.

---

<div class="post-metadata">

**Author:** ![lellisjr](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/lellisjr/32/642_2.png) [@lellisjr](https://forum.opencyphal.org/u/lellisjr)\
**Post date:** [July 28, 2020, 4:14pm UTC](https://forum.opencyphal.org/t/call-and-pub-commands-in-basic-usage-demo/893/7 "2020-07-28T16:14:19Z")

</div>

OK, clear.  
Thanks.

---

<div class="post-metadata">

**Author:** ![polaris](https://forum.opencyphal.org/letter_avatar_proxy/v4/letter/p/7ab992/32.png) [@polaris](https://forum.opencyphal.org/u/polaris)\
**Post date:** [August 6, 2020, 8:43am UTC](https://forum.opencyphal.org/t/call-and-pub-commands-in-basic-usage-demo/893/8 "2020-08-06T08:43:47Z")

</div>

_Ref: Pyuavcan 1.1.0.dev1, Windows 10, Python 3.7.7, CAN/python-can._

I have exactly the same error now:

```auto
uvc pub 283.uavcan.si.temperature.Scalar.1.0 '{kelvin: 123.456}' --count=2 --tr="CAN(can.media.pythoncan.PythonCANMedia('pcan','PCAN_USBBUS1',8),10)"
Error: TypeError: __init__ () missing 1 required positional argument: 'message'

```

I have copied the command from the fixing commit already.

The same is true for UDP connection **–tr=“UDP(‘127.0.0.111/8’)”** too.

---

<div class="post-metadata">

**Author:** ![pavel.kirienko](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/pavel.kirienko/32/9_2.png) [@pavel.kirienko](https://forum.opencyphal.org/u/pavel.kirienko)\
**Post date:** [August 6, 2020, 9:35am UTC](https://forum.opencyphal.org/t/call-and-pub-commands-in-basic-usage-demo/893/9 "2020-08-06T09:35:48Z")

</div>

Can’t reproduce. Can you please share a screenshot (not a copy-pasted string) of your command line showing the problem? Thanks.
