Skip to content
This repository has been archived by the owner on Dec 27, 2018. It is now read-only.

Syntax Error #13

Open
pajuscz opened this issue Jan 6, 2016 · 2 comments
Open

Syntax Error #13

pajuscz opened this issue Jan 6, 2016 · 2 comments

Comments

@pajuscz
Copy link

pajuscz commented Jan 6, 2016

I am using python 2.6.6 and I am getting syntax error using ConfluenceAPI in file api.py:

NEW_CONTENT_REQUIRED_KEYS = {"type", "title", "space", "body"}
^
SyntaxError: invalid syntax

Python 2.6.6 doesn't know the syntax for Set as ={1,2,3}
I needed to rewrite all Set constructions with {} syntax into:
NEW_CONTENT_REQUIRED_KEYS = Set(["type", "title", "space", "body"])

@rpcope1
Copy link
Owner

rpcope1 commented Jan 6, 2016

I'll see if I can't take a look at this later. This may be a Python 2.6
backwards compatbility issue.

On Wed, Jan 6, 2016 at 2:44 AM, Pavel Šimurda notifications@github.com
wrote:

I am using python 266 and I am getting syntax error using ConfluenceAPI:

NEW_CONTENT_REQUIRED_KEYS = {"type", "title", "space", "body"}
^
SyntaxError: invalid syntax

Python 266 doesn't know the syntax for Set as ={1,2,3}
I needed to rewrite it into:
NEW_CONTENT_REQUIRED_KEYS = Set(["type", "title", "space", "body"])


Reply to this email directly or view it on GitHub
#13.

@pajuscz
Copy link
Author

pajuscz commented Jan 7, 2016

For backwards compatibility with python 2.2.6
It seems it is necessary to change all
{item1,item2} into set([item1,item2]) (without capital s that was my typo before)

and then insert Class definition in api.py because python 2.6.6 doesn't have NullHandler in logging module, so you need to create a workaround

class NullHandler(logging.Handler):
    def emit(self, record):
       pass

After that changing line:
nh = logging.NullHandler()
into
nh = NullHandler()
using defined NullHandler object

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants