Automation

 View Only

IMPORTANT MODERATION NOTICE

This community is currently under full moderation, meaning  all posts will be reviewed before appearing in the community. Please expect a brief delay—there is no need to post multiple times. If your post is rejected, you'll receive an email outlining the reason(s). We've implemented full moderation to control spam. Thank you for your patience and participation.



  • 1.  PyEZ and VSCode - Could not resolved Pylance (ReportMissingImports)

    Posted 03-17-2022 05:32
    Hi Everyone,

    First let me admit that I am new in Python Programming and network automation. I am working with Junos PyEZ Table and Views and when I try to import a predefined Table from junos PyEZ jnpr.junos.op module, the VSCode shows a warngin message as;

    Import "jnpr.junos.op.arp" could not be resolvedPylancereportMissingImports

    What this warning means? And how I can solve this issue?

    Many Regards
    Arslan


  • 2.  RE: PyEZ and VSCode - Could not resolved Pylance (ReportMissingImports)

     
    Posted 03-21-2022 16:43
    Hi,

    I'm not sure what the code is that you are executing to load the predefined table to Arp is.

    But the following will load them.

    from jnpr.junos import Device
    from jnpr.junos.op.arp import ArpTable​

    If that fails to run correctly for you, then please share some additional information. e.g.
    # pip3 list
    # python3 --version​

    Regards.

    ------------------------------
    Andy Sharp
    ------------------------------



  • 3.  RE: PyEZ and VSCode - Could not resolved Pylance (ReportMissingImports)

     
    Posted 03-22-2022 09:48
    Hello Arslan,

    VScode works great with Python, but you'll need to tell it where to look for Python if you're using anything other than default path.

    Example, if you follow best practices then you likely created a Python virtual environment and installed PyEZ within it. You will need to tell VScode to look for your Python goodies in this environment instead of the default location, or it will complain that it cannot find any of your packages.

    You can do this by holding Control + Shift and pressing the letter P within VScode, this opens up a shortcut menu where you can change the path by searching for "python path", and finally pointing to your virtual environment's Python binary.

    This will help VScode find your Python libraries and stop reporting these issues through Pylance

    ------------------------------
    Calvin Remsburg | Global Enterprise Architect | Juniper Networks
    ------------------------------