VMware {code}

 View Only
  • 1.  SyntaxWarning: invalid escape sequence in Python SDK

    Posted Feb 27, 2025 05:30 AM

    Hi

    Whenever I import the SDK python modules into the script I get this error:

    Python 3.12.3 (main, Feb  4 2025, 14:48:35) [GCC 13.3.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from com.vmware import nsx_client
    <unknown>:1: SyntaxWarning: invalid escape sequence '\['
    <unknown>:1: SyntaxWarning: invalid escape sequence '\['
    >>>

    It's "only" the first time an import is done, that the error pops up, all subsequent import don't produce this error. 

    First import of all these produces the same error:

    from com.vmware import nsx_client
    from com.vmware import nsx_policy_client
    from vmware.vapi.bindings.stub import ApiClient
    from vmware.vapi.bindings.stub import StubFactory
    from vmware.vapi.stdlib.client.factories import StubConfigurationFactory

    This import never does it:
    from vmware.vapi.security.user_password import create_user_password_security_context

    I have downloaded and installed the following modules:

    VMware Python SDK for NSX
    VMware Python SDK for NSX Policy
    VMware Python SDK runtime
    VMware Python SDK runtime support
    VMware Python SDK runtime support - client utilities

    from https://developer.broadcom.com/sdks/vmware-nsx-for-python/latest/ so it is newest version 4.0.1.1. Python version is 3.13.2.

    I believe it is an error in the SDK, much like this issue fixed in the vsphere module: from vmware.vapi.vsphere.client import create_vsphere_client · Issue #400 · vmware/vsphere-automation-sdk-python


    Can we get someone to take a look at the SDK, please?



    ------------------------------
    Life Goal: Rule the world with Python
    ------------------------------


  • 2.  RE: SyntaxWarning: invalid escape sequence in Python SDK

    Broadcom Employee
    Posted Mar 03, 2025 05:38 PM

    Thank you for pointing this out. I'll forward to the proper contacts and provide an update. 



    ------------------------------
    Franky Barragan
    {code} Community Manager
    Broadcom

    ------------------------------



  • 3.  RE: SyntaxWarning: invalid escape sequence in Python SDK

    Posted 23 days ago

    Hi. 

    Any news on this yet?



    ------------------------------
    Life Goal: Rule the world with Python
    ------------------------------



  • 4.  RE: SyntaxWarning: invalid escape sequence in Python SDK

    Broadcom Employee
    Posted 22 days ago

    Our developers are working on updating the dropdown on the developer portal page. They noticed that the first version of the NSX python SDK to not have this problem is 4.2.0, which uses vapi-runtime 2.52.0.

    You can get to the page directly here:
    https://developer.broadcom.com/sdks/vmware-nsx-for-python/4.2.0



    ------------------------------
    Franky Barragan
    {code} Community Manager
    Broadcom

    ------------------------------