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

Unable to import submodules NUVSDSession of vspk #36

Closed ranjeetjangra closed 5 years ago

ranjeetjangra commented 5 years ago

Hi ,

https://nuagenetworks.github.io/2016/02/26/Scripting-with-Nuage-VSPK-Part-1-Introduction-basic-examples.html I was reading and following above link .

I installed vspk in pip - OK able to import vspk but unable to import submodules NUVSDSession to continue further .


rajangra@N-20HEPF0Z6D82 MINGW64 ~/AppData/Local/Programs/Python/Python37-32 $ pip freeze | grep vspk vspk==6.0.1

rajangra@N-20HEPF0Z6D82 MINGW64 ~/AppData/Local/Programs/Python/Python37-32 $ pip --version pip 19.2.1 from c:\users\rajangra\appdata\local\programs\python\python37-32\lib\site-packages\pip (python 3.7)


import vspk from vspk import v5_0 as vsdk

Configuring a connection to the VSD API

nc = vsdk.NUVSDSession( username='admin', password='REDACTED', enterprise='csp', api_url="https://REDACTED:8443/")

Actively connecting ot the VSD API

nc.start()


C:\Users\rajangra\PycharmProjects\Nuage_VSD_Control\venv\Scripts\python.exe C:/Users/rajangra/PycharmProjects/Nuage_VSD_Control/fetch_config_vsd.py Traceback (most recent call last): File "C:/Users/rajangra/PycharmProjects/Nuage_VSD_Control/fetch_config_vsd.py", line 6, in nc = vsdk.NUVSDSession( AttributeError: module 'vspk.v5_0' has no attribute 'NUVSDSession'

Process finished with exit code 1

Regards Ranjeet

pdellaert commented 5 years ago

Hi @ranjeetjangra ,

The output seems to be a little confusing:

rajangra@N-20HEPF0Z6D82 MINGW64 ~/AppData/Local/Programs/Python/Python37-32 $ pip freeze | grep vspk vspk==6.0.1

This shows a path of ~/AppData/Local/Programs/Python/Python37-32

However:

C:\Users\rajangra\PycharmProjects\Nuage_VSD_Control\venv\Scripts\python.exe C:/Users/rajangra/PycharmProjects/Nuage_VSD_Control/fetch_config_vsd.py

Shows a path of C:\Users\rajangra\PycharmProjects\Nuage_VSD_Control\venv\Scripts\python.exe. That's a different Python environment.

I'm no expert in Python on Windows, but as these are different Python environments, your packages in one environment are not necessarily available in other environments.

(Also, i removed your server and password information from the ticket, because it was sharing IP and password details, which is very insecure on the internet....)

ranjeetjangra commented 5 years ago

Hi @pdellaert

Thanks for you reply .

PyCharm interperator changed automatically for this project , Now this issue is resolved .

Now i am getting below error , if you can help me out to set up a connection with my Nuage Networks eXperience LAB . requests.exceptions.ConnectionError: HTTPSConnectionPool(host='124.252.253.8', port=8443): Max retries exceeded with url: //nuage/api/v5_0/me

Pls see attached file for full error .

connection time out.txt

pdellaert commented 5 years ago

That looks like you might be behind a proxy or firewall?

ranjeetjangra commented 5 years ago

I checked the IE setting , yes there is a proxy address , how to deal with it so that i can connect to VSD

pdellaert commented 5 years ago

Sorry @ranjeetjangra, you will have to investigate how you can tell python in Windows to use a proxy. In linux it is as easy setting an environment variable called https_proxy in your shell environment with the proxy server details...