4

The following code fails

In [1]: import arrow

In [2]: arrow.get(2015, 06, 08, 23, 59)
  File "<ipython-input-2-44d7fca57336>", line 1
    arrow.get(2015, 06, 08, 23, 59)
                         ^
SyntaxError: invalid token

Why does this initialization per the arrow docs returns an error?

WoJ
  • 27,165
  • 48
  • 180
  • 345
  • 4
    Putting a zero in front of a number makes it octal. `08` is not a valid octal number. – Peter Wood Jun 09 '15 at 12:08
  • 2
    Ahhhhh, you are right! If you do not mind making this an answer I would accept it (and leave the question, as it is not that dumb after all) – WoJ Jun 09 '15 at 12:09
  • Simplify your question down to where the error is. Try to reproduce it with as little code as possible. At the moment it's not a quality question. – Peter Wood Jun 09 '15 at 12:11
  • 2
    @PeterWood: OK, done. – WoJ Jun 09 '15 at 12:17

1 Answers1

3

Putting a zero in front of a literal number makes it octal. See What do numbers starting with 0 mean in python?.

Octal numbers can only contain the digits 0 to 7.

08 is not a valid octal number.

This has nothing to do with arrow. The example you link doesn't use octal numbers.

Community
  • 1
  • 1
Peter Wood
  • 23,859
  • 5
  • 60
  • 99