# PermissionError with nnvg for cpp

**URL:** <https://forum.opencyphal.org/t/permissionerror-with-nnvg-for-cpp/1003>\
**Category:** Nunavut\
**Created:** [November 19, 2020, 1:51am UTC](https://forum.opencyphal.org/t/permissionerror-with-nnvg-for-cpp/1003 "2020-11-19T01:51:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sdo91](https://forum.opencyphal.org/letter_avatar_proxy/v4/letter/s/c5a1d2/32.png) [@sdo91](https://forum.opencyphal.org/u/sdo91)\
**Post date:** [November 19, 2020, 1:51am UTC](https://forum.opencyphal.org/t/permissionerror-with-nnvg-for-cpp/1003/1 "2020-11-19T01:51:15Z")

</div>

When I generate C headers using nunavut the command runs without errors

```auto
sdo91@p51 ~/example
  $ nnvg --templates nunavut/src/nunavut/lang/c --outdir output/c --target-language c public_regulated_data_types/uavcan/

```

But when I try a similar command for C++, I get this error:

```auto
sdo91@p51 ~/example
  $ nnvg --templates nunavut/src/nunavut/lang/cpp --outdir output/cpp --target-language cpp public_regulated_data_types/uavcan/
Traceback (most recent call last):
  File "/home/sdo91/.local/bin/nnvg", line 7, in <module>
    from nunavut. __main__ import main
  File "/home/sdo91/.local/lib/python3.7/site-packages/nunavut/ __main__.py", line 14, in <module>
    sys.exit(main())
  File "/home/sdo91/.local/lib/python3.7/site-packages/nunavut/cli.py", line 486, in main
    return _run(args, extra_includes)
  File "/home/sdo91/.local/lib/python3.7/site-packages/nunavut/cli.py", line 173, in _run
    allow_overwrite=not args.no_overwrite)
  File "/home/sdo91/.local/lib/python3.7/site-packages/nunavut/jinja/ __init__.py", line 900, in generate_all
    self._copy_header(resource, target, is_dryrun, allow_overwrite)
  File "/home/sdo91/.local/lib/python3.7/site-packages/nunavut/jinja/ __init__.py", line 946, in _copy_header
    shutil.copy(str(resource), str(target))
  File "/usr/lib/python3.7/shutil.py", line 248, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/usr/lib/python3.7/shutil.py", line 121, in copyfile
    with open(dst, 'wb') as fdst:
PermissionError: [Errno 13] Permission denied: 'output/cpp/nunavut/support/serialization.hpp'

```

Anything I can do to resolve this? Thanks.

I on branch `master` for `public_regulated_data_types`  
I tried both `master` and `c-serialization-corrections` for `nunavut` and get the same error  
`nnvg --version` shows `0.5.1`

---

<div class="post-metadata">

**Author:** ![aentinger](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/aentinger/32/1428_2.png) [@aentinger](https://forum.opencyphal.org/u/aentinger)\
**Post date:** [November 19, 2020, 5:37am UTC](https://forum.opencyphal.org/t/permissionerror-with-nnvg-for-cpp/1003/2 "2020-11-19T05:37:10Z")

</div>

I’m pretty sure there is currently no serialisation for C++ 😉 although the error looks a bit like a problem with directory access permissions.

---

<div class="post-metadata">

**Author:** ![sdo91](https://forum.opencyphal.org/letter_avatar_proxy/v4/letter/s/c5a1d2/32.png) [@sdo91](https://forum.opencyphal.org/u/sdo91)\
**Post date:** [November 23, 2020, 4:58pm UTC](https://forum.opencyphal.org/t/permissionerror-with-nnvg-for-cpp/1003/3 "2020-11-23T16:58:18Z")

</div>

Found the issue.  
Looks like when I updated nunavut I ended up with both `serialization.hpp` and `serialization.j2` in `~/.local/lib/python3.7/site-packages/nunavut/lang/cpp/support`. These were conflicting. I think `serialization.hpp` was from an older version of nunavut, so I removed it, and that resolved the conflict.

---

<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:** [November 23, 2020, 5:10pm UTC](https://forum.opencyphal.org/t/permissionerror-with-nnvg-for-cpp/1003/4 "2020-11-23T17:10:10Z")

</div>

It’s not going to work either way because there is no C++ support yet. We will update the docs shortly to make it clear:

> <https://github.com/OpenCyphal/nunavut/issues/164>
>
> \- \[x\] Make it clear which languages are supported (currently it's only C) to avo…id https://forum.uavcan.org/t/permissionerror-with-nnvg-for-cpp/1003
> 
> \- \[x\] Provide practical usage examples for common use cases (C header generation)
> 
> \- \[x\] Consider updating the high-level description of the project.
> 
> Regarding the last one: currently, it is said to be a "template engine" which may be accurate enough. I would suggest calling it "code generator" or "transpiler" or something similar.
> 
> @thirtytwobits

---

<div class="post-metadata">

**Author:** ![sdo91](https://forum.opencyphal.org/letter_avatar_proxy/v4/letter/s/c5a1d2/32.png) [@sdo91](https://forum.opencyphal.org/u/sdo91)\
**Post date:** [November 23, 2020, 5:48pm UTC](https://forum.opencyphal.org/t/permissionerror-with-nnvg-for-cpp/1003/5 "2020-11-23T17:48:15Z")

</div>

I have written my own C++ templates for basic serialization/deserialization of primitives/arrays
