1 Reply Latest reply: Jan 14, 2019 1:36 PM by Mark Holm - 3xCCIE #34763/CCDE #20160020 RSS

    Locating Finding imported libraries

    SHAUN

      NPDEV Section 18.7 Python uniq Library with Cisco APIC-EM

      Step 3 we are examining

      ~/git/uniq/sample_scripts/get_network_devices.py

      The first few lines are as follows

      import csv

      import login

       

       

      The login library (is that what you call it?) is in the same locating as the calling script so easy to find (login.py is also in ~/git/uniq/sample_scripts)

      The csv library (csv.py I think we are looking for) is not.

      So how do I find it?

      I found and ran a script whch seemed to show me the sys.path (below)

      Do I have to go looking through all of that?

      Am I on the right track?

      Many thanks for any replies

       

      cisco@cisco:~$ python

      Python 2.7.11+ (default, Apr 17 2016, 14:00:29)

      [GCC 5.3.1 20160413] on linux2

      Type "help", "copyright", "credits" or "license" for more information.

      >>> import sys

      >>>

      >>> for p in sys.path:

      ...    print(p)

      ...

       

      /usr/local/lib/python2.7/dist-packages/arya-1.1.5-py2.7.egg

      /usr/local/lib/python2.7/dist-packages/acitoolkit-0.3.1-py2.7.egg

      /usr/local/lib/python2.7/dist-packages/ipaddr-2.1.11-py2.7.egg

      /usr/local/lib/python2.7/dist-packages/jsonschema-2.5.1-py2.7.egg

      /usr/local/lib/python2.7/dist-packages/py_radix-0.9.6-py2.7-linux-x86_64.egg

      /usr/local/lib/python2.7/dist-packages/tabulate-0.7.5-py2.7.egg

      /usr/local/lib/python2.7/dist-packages/PyMySQL-0.7.6-py2.7.egg

      /usr/local/lib/python2.7/dist-packages/Flask-0.11.1-py2.7.egg

      /usr/local/lib/python2.7/dist-packages/Flask_Cors-3.0.0-py2.7.egg

      /usr/local/lib/python2.7/dist-packages/Flask_WTF-0.12-py2.7.egg

      /usr/local/lib/python2.7/dist-packages/Flask_Bootstrap-3.3.6.0-py2.7.egg

      /usr/local/lib/python2.7/dist-packages/Flask_Admin-1.4.2-py2.7.egg

      /usr/local/lib/python2.7/dist-packages/Flask_SQLAlchemy-2.1-py2.7.egg

      /usr/local/lib/python2.7/dist-packages/Flask_HTTPAuth-3.2.0-py2.7.egg

      /usr/local/lib/python2.7/dist-packages/websocket_client-0.37.0-py2.7.egg

      /usr/local/lib/python2.7/dist-packages/functools32-3.2.3.post2-py2.7.egg

      /usr/local/lib/python2.7/dist-packages/click-6.6-py2.7.egg

      /usr/local/lib/python2.7/dist-packages/itsdangerous-0.24-py2.7.egg

      /usr/local/lib/python2.7/dist-packages/Werkzeug-0.11.10-py2.7.egg

      /usr/local/lib/python2.7/dist-packages/WTForms-2.1-py2.7.egg

      /usr/local/lib/python2.7/dist-packages/visitor-0.1.3-py2.7.egg

      /usr/local/lib/python2.7/dist-packages/dominate-2.2.1-py2.7.egg

      /usr/local/lib/python2.7/dist-packages/SQLAlchemy-1.1.0b3-py2.7-linux-x86_64.egg

      /usr/local/lib/python2.7/dist-packages/gitdb-0.6.4-py2.7-linux-x86_64.egg

      /usr/local/lib/python2.7/dist-packages/smmap-0.9.0-py2.7.egg

      /usr/local/lib/python2.7/dist-packages/acicobra-1.3_2i-py2.7.egg

      /usr/local/lib/python2.7/dist-packages/acimodel-1.3_2i-py2.7.egg

      /usr/local/lib/python2.7/dist-packages/ncclient-0.5.2-py2.7.egg

      /usr/local/lib/python2.7/dist-packages/cosc_learning_labs-1.0-py2.7.egg

      /usr/local/lib/python2.7/dist-packages/pexpect-4.2.1-py2.7.egg

      /usr/local/lib/python2.7/dist-packages/logilab_common-1.2.2-py2.7.egg

      /usr/local/lib/python2.7/dist-packages/ptyprocess-0.5.1-py2.7.egg

      /usr/lib/python2.7

      /usr/lib/python2.7/plat-x86_64-linux-gnu

      /usr/lib/python2.7/lib-tk

      /usr/lib/python2.7/lib-old

      /usr/lib/python2.7/lib-dynload

      /home/cisco/.local/lib/python2.7/site-packages

      /usr/local/lib/python2.7/dist-packages

      /usr/local/lib/python2.7/dist-packages

      /usr/lib/python2.7/dist-packages

      /usr/lib/python2.7/dist-packages/gtk-2.0

      >>>

      >>>