Closed liruihao closed 7 years ago
Hmmm, the code is definitely python3, I'm running it without this error on python 3.6.0. The problem appears to be the protobuf python file generated when you run make. The protobuf compiler is outputting a call to 'unicode' which is not python 3 compatible.
What is your version of protoc?
In my version (libprotoc 3.0.0) when I compile the proto file, line 121 of scenenet_pb2.py actually looks like this:
default_value=_b("").decode('utf-8')
Maybe upgrading you protobuf version could help?
Hi, John
Thank you very much for your reply. I checked the version of libprotoc, it is 2.5.0. The problem should be caused by the protobuf version. My python version is python3.4 and python2.7. I use python2.7 to run the code (python read_protobuf.py), and it succeed. I could also run 'python convert_instance2class.py' with python2.7. So I will use python2.7 for the right now. Thanks again for your help.
Best wishes,
Ruihao
When I run 'python3 read_protobuf.py', I got errors as shown blow. When I run 'python read_protobuf.py', it works fine. Did you change the code to Python2.7?
Traceback (most recent call last): File "read_protobuf.py", line 1, in
import scenenet_pb2 as sn
File "/home/workspace/Dataset/SceneNetRGBD/pySceneNetRGBD/scenenet_pb2.py", line 121, in
has_default_value=False, default_value=unicode("", "utf-8"),
NameError: name 'unicode' is not defined
Thank you very much for your help.
Best wishes,
Ruihao