What steps will reproduce the problem?
Try to generate a message using a "bytes" field,
as example:
message NetCanMessage {
required fixed32 id = 1;
required bytes data = 2;
}
What is the expected output? What do you see instead?
Traceback (most recent call last):
File "C:\B500\B500Power\tools\nanopb\generator\nanopb_generator.py", line 1077, in <module>
main_cli()
File "C:\B500\B500Power\tools\nanopb\generator\nanopb_generator.py", line 1024, in main_cli
results = process_file(filename, None, options)
File "C:\B500\B500Power\tools\nanopb\generator\nanopb_generator.py", line 1001, in process_file
messages, extensions, options))
File "C:\B500\B500Power\tools\nanopb\generator\nanopb_generator.py", line 728, in generate_header
for msg in sort_dependencies(messages):
File "C:\B500\B500Power\tools\nanopb\generator\nanopb_generator.py", line 679, in sort_dependencies
dependencies[str(message.name)] = set(message.get_dependencies())
File "C:\B500\B500Power\tools\nanopb\generator\nanopb_generator.py", line 516, in get_dependencies
return [str(field.ctype) for field in self.fields]
AttributeError: Field instance has no attribute 'ctype'
What version of the product are you using? On what operating system?
I'm using NanoPb 0.25 on windows XP with python 2.7
Please provide any additional information below.
I've tracked down the problem to this line, the following patch it's enough
to solve my use case
diff -r 495811bb5642 B500Power/tools/nanopb/generator/nanopb_generator.py
--- a/nanopb/generator/nanopb_generator.py Tue Jan 21 10:43:36 2014 +0100
+++ b/nanopb/generator/nanopb_generator.py Tue Jan 21 17:13:32 2014 +0100
@@ -241,6 +241,7 @@
self.enc_size = varint_max_size(self.max_size) + self.max_size
elif desc.type == FieldD.TYPE_BYTES:
self.pbtype = 'BYTES'
+ self.ctype = 'char'
if self.allocation == 'STATIC':
self.ctype = self.struct_name + self.name + 't'
self.enc_size = varint_max_size(self.max_size) + self.max_size
Original issue reported on code.google.com by fede.gio...@gmail.com on 21 Jan 2014 at 4:20
Original issue reported on code.google.com by
fede.gio...@gmail.com
on 21 Jan 2014 at 4:20