PythonConfluenceAPI icon indicating copy to clipboard operation
PythonConfluenceAPI copied to clipboard

Syntax Error

Open pajuscz opened this issue 10 years ago • 2 comments

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"])

pajuscz avatar Jan 06 '16 09:01 pajuscz

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 [email protected] 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 https://github.com/pushrodtechnology/PythonConfluenceAPI/issues/13.

rpcope1 avatar Jan 06 '16 21:01 rpcope1

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

pajuscz avatar Jan 07 '16 10:01 pajuscz