PermissionError with nnvg for cpp

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

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:

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

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

1 Like

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.

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:

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

1 Like