classification
Title: Dictionary Creation Fails with integer key
Type: compile error Stage:
Components: macOS Versions: Python 3.2
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: ronaldoussoren Nosy List: amaury.forgeotdarc, pata@jegcpa.com, r.david.murray, ronaldoussoren
Priority: normal Keywords:

Created on 2012-06-14 16:41 by pata@jegcpa.com, last changed 2012-06-14 17:39 by r.david.murray. This issue is now closed.

Files
File name Uploaded Description Edit
serialposix.py pata@jegcpa.com, 2012-06-14 16:41 pyserial
Messages (3)
msg162805 - (view) Author: Pat (pata@jegcpa.com) Date: 2012-06-14 16:41
Attempting to import pyserial. In module serialposix.py a dict declaration starting on line 64;

    baudrate_constants = {
        0:       0000000,
        50:      0000001,
        75:      0000002,
       110:      0000003, ...etc
 



Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "serialposix.py", line 64
    50:      0000001,
                   ^
SyntaxError: invalid token


MacOSX 10.6.8 32bit x86 python 3.2.3 (v3.2.3:3d0686d90f55, Apr 10 2012, 11:09:56)
msg162806 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2012-06-14 16:47
You are importing with Python3 a module written for Python2.

pyserial-2.6 comes with a "setup.py" script that will do the conversion, you should run it and not try to import the source code directly.
msg162810 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-06-14 17:39
And yes, a number with leading zeros is an invalid token in Python3, because in Python2 it was an octal number, and now we spell octal as, eg, 0o0001.
History
Date User Action Args
2012-06-14 17:39:39r.david.murraysetnosy: + r.david.murray
messages: + msg162810
2012-06-14 16:47:48amaury.forgeotdarcsetstatus: open -> closed

nosy: + amaury.forgeotdarc
messages: + msg162806

resolution: not a bug
2012-06-14 16:41:06pata@jegcpa.comcreate