kfogel / OneTime

An open source encryption program that uses the "one-time pad" method.
http://red-bean.com/onetime
32 stars 14 forks source link

Syntax error with Python version < 2.6. #7

Closed kfogel closed 10 years ago

kfogel commented 10 years ago

A user wrote in to report this bug with Python 2.4.3 on RHEL 5.6:

File "./onetime.orig", line 1214
  except (IOError, Pad.InnerFormat, PadDecoder.DecodingError) as e:
SyntaxError: invalid syntax

It's the new exception-catching syntax, because changing line 1214 from

except (IOError, Pad.InnerFormat, PadDecoder.DecodingError) as e:

to

except (IOError, Pad.InnerFormat, PadDecoder.DecodingError), e:

...fixes the problem.

However, the real fix is to require Python 2.6 or higher; that's when the "as" syntax was introduced, in 2008.

kfogel commented 10 years ago

I'm not sure commit d5b5938 will solve the problem, because the problem is a syntax error; we may need to do some sort of "eval" trick to check the exception syntax. I've sent the new version to the original reporter to test with Python 2.4.3.

kfogel commented 10 years ago

Closing as per above.