nuagenetworks / vspk-python

A Python library for managing Nuage through its API
http://www.nuagenetworks.net
BSD 3-Clause "New" or "Revised" License
17 stars 19 forks source link

python 3.7 invalid syntax #32

Closed nergalex closed 5 years ago

nergalex commented 6 years ago

Hi,

I got the error bellow with python 3.7. The package is well loaded with python 3.6.

Traceback (most recent call last):
  File "/root/nuage-pgsync/state_engine.py", line 29, in <module>
    import storage_engine_nuage
  File "/root/nuage-pgsync/storage_engine_nuage.py", line 27, in <module>
    from vspk import v5_0 as vsdk
  File "/usr/local/lib/python3.7/site-packages/vspk/v5_0/__init__.py", line 31, in <module>
    from .nuaddressmap import NUAddressMap
  File "/usr/local/lib/python3.7/site-packages/vspk/v5_0/nuaddressmap.py", line 31, in <module>
    from .fetchers import NUMetadatasFetcher
  File "/usr/local/lib/python3.7/site-packages/vspk/v5_0/fetchers/__init__.py", line 31, in <module>
    from .nuaddressmaps_fetcher import NUAddressMapsFetcher
  File "/usr/local/lib/python3.7/site-packages/vspk/v5_0/fetchers/nuaddressmaps_fetcher.py", line 29, in <module>
    from bambou import NURESTFetcher
  File "/usr/local/lib/python3.7/site-packages/bambou/__init__.py", line 298, in <module>
    from bambou.nurest_session import NURESTSession
  File "/usr/local/lib/python3.7/site-packages/bambou/nurest_session.py", line 8, in <module>
    from .nurest_login_controller import NURESTLoginController
  File "/usr/local/lib/python3.7/site-packages/bambou/nurest_login_controller.py", line 203
    def async(self):
            ^
SyntaxError: invalid syntax
pdellaert commented 6 years ago

@nergalex , can you make sure you have the latest bambou package, and can you tell me which python version you are using.

It is working for me:

$ ipython
Python 3.6.5 (default, Apr 25 2018, 14:26:36)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.4.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from vspk import v5_0 as vsdk

In [2]: addressmap = vsdk.NUAddressMap()

In [3]: addressmap.to_dict()
Out[3]:
{'ID': None,
 'parentID': None,
 'parentType': None,
 'creationDate': None,
 'lastUpdatedDate': None,
 'owner': None,
 'lastUpdatedBy': None,
 'entityScope': None,
 'privateIP': None,
 'privatePort': None,
 'associatedPATNATPoolID': None,
 'publicIP': None,
 'publicPort': None,
 'externalID': None,
 'type': None}

My environment

$ python --version; pip freeze | grep -e vspk -e bambou
Python 3.6.5
bambou==3.0.1
vspk==5.3.3
nergalex commented 6 years ago

Hi pdellaert,

vspk package is working fine with Python 3.6.3 but not with Python 3.7.1.

$ python3.6 --version; pip freeze | grep -e vspk -e bambou
Python 3.6.3
bambou==3.0.1
vspk==5.3.1

$ python3.7 --version; pip freeze | grep -e vspk -e bambou 
Python 3.7.1
bambou==3.0.1
vspk==5.3.1
hellt commented 6 years ago

Hi all,

It's because async is now a reserved keyword in 3.7 -- https://docs.python.org/3/whatsnew/3.7.html

Good catch, I think we should act proactive and create a ticket to see how it's better to handle it

вс, 2 дек. 2018 г., 0:02 nergalex notifications@github.com:

Hi pdellaert,

vspk package is working fine with Python 3.6.3 but not with Python 3.7.1.

`$ python3.6 --version; pip freeze | grep -e vspk -e bambou Python 3.6.3 bambou==3.0.1 vspk==5.3.1

$ python3.7 --version; pip freeze | grep -e vspk -e bambou Python 3.7.1 bambou==3.0.1 vspk==5.3.1`

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/nuagenetworks/vspk-python/issues/32#issuecomment-443458335, or mute the thread https://github.com/notifications/unsubscribe-auth/AFaq9dF3EAi7u5V5ldJ1Ggu5sSoT1iDkks5u0u53gaJpZM4Y8hdX .

pdellaert commented 5 years ago

A fix will come in the 6.0.1 VSPK to support Python 3.7