0

When I try to load the construct library v 2.5.4, in python 2.5.4 it is causing this error. Any idea how to resolve? Is there something I can adapt/edit in the library to fix this

SyntaxError: ('no viable alternative at input \'""\'', ('/Users/blahblah/Documents/lib/java-classes/lib/Lib/construct/lib/binary.py', 66, 16, '        return 
b"".join(_char_to_bin[int(ch)] for ch in data)\n'))
Ke.
  • 2,484
  • 8
  • 40
  • 78

1 Answers1

0

You are running in some environment that suppresses a proper traceback printing and instead gives you the raw representation of the exception object. It says that the error is in line 66, column 16 and then gives the line.

        return b"".join(_char_to_bin[int(ch)] for ch in data)

The error, when running in 2.5, is b". The b string prefix is not valid until 2.7 (or perhaps 2.6), and even then, it has no effect. It is only recognized to aid compatibility with 3.x. The use of the prefix indicates that the library is not intended to run with 2.5. It might or might not be intended to work with 2.7. You need to either find a version (likely older) that works with 2.5 or use a newer version of python.

You could fix this error by removing the b, but you will likely run into others.

Terry Jan Reedy
  • 18,414
  • 3
  • 40
  • 52