Tai
Tai

Reputation: 1256

Boto Syntax Error?

I am importing boto.dynamodb.table and getting a syntax error. I don't see how it is related to what I'm doing. I haven't implemented / used it and yet upon launching it finds a syntax error.

The error from my console looks like this:

  File "api.py", line 10, in <module>
    import dynamoAccess
  File "/Users/tai/Documents/workspace/testSelenium/testS/dynamoAccess.py", line 6, in <module>
    from boto.dynamodb2.table import Table
  File "/Library/Python/2.7/site-packages/boto/dynamodb2/table.py", line 3, in <module>
    from boto.dynamodb2.fields import (HashKey, RangeKey,
  File "/Library/Python/2.7/site-packages/boto/dynamodb2/fields.py", line 1, in <module>
    from boto.dynamodb2.types import STRING
  File "/Library/Python/2.7/site-packages/boto/dynamodb2/types.py", line 4, in <module>
    from boto.dynamodb.types import Dynamizer
  File "/Library/Python/2.7/site-packages/boto/dynamodb/types.py", line 112
    ]
    ^
SyntaxError: invalid syntax

The code that I believe this is related to is the first few lines (aka the dynamo table import) of dynamoAccess:

This is what I have:

import cleaner
import datetime
import awsAccess
import boto
from boto import dynamodb2
from boto.dynamodb2.table import Table

#create a connection to amazon s3 
#aws_access_key_id=getenv('AWS_ACCESS_KEY');
#aws_secret_access_key=getenv('AWS_SECRET_KEY');
#aws_dynamo_region=getenv('DYANAMO_REGION')

#for running in pydev
aws_access_key_id=awsAccess.aws_access_key_id
aws_secret_access_key=awsAccess.aws_secret_access_key
aws_dynamo_region=awsAccess.aws_dynamo_region

decompiled_dynamo_table="decompiled_swfs"
text_dynamo_table="decompiled_swf_text"
image_dynamo_table="images_decompiled"
_dynamo_table="decompiled_swf_text"

Has anyone encountered this? I haven't modified the boto file.

Edit: resinstalled boto but still getting the error: Name: boto Version: 2.31.1

Edit 2: Solved see answer below. Boto had a bug

Upvotes: 1

Views: 794

Answers (1)

Tai
Tai

Reputation: 1256

Fixed - I replaced the boto dynamodb/types.py file with the one in github: https://github.com/boto/boto

There was a ] out of place that needed to be fixed. This was already fixed in the github version but apparently not yet pushed to pip

I believe that this may occur for other people due to the above error. If you encounter this simply update your file from github (or edit it yourself)

Upvotes: 2

Related Questions