Skip to content

[ixnetwork_restpy 1.11.0] import ixnetwork_restpy throws syntaxWarning in Python 3.14.7 #89

Open

Description

@Y-keysight

env: python 3.14.7
ixnetwork_restpy version : 1.11.0

uv pip list | grep ixnetwork
Using Python 3.14.7 environment at: /opt/ixia/venv/venv26.5
ixnetwork-restpy          1.11.0

Issue: when import ixnetwork_restpy, it throwns the syntax warning at the first trial

python
Python 3.14.7 (main, Aug 19 2026, 09:08:24) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ixnetwork_restpy
/opt/ixia/venv/venv26.5/lib/python3.14/site-packages/ixnetwork_restpy/testplatform/sessions/ixnetwork/ixnetwork.py:1276: SyntaxWarning: "\~" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\\~"? A raw string is also an option.
  - Returns str(default\~highRoute\~ionvsFdb\~unknown): current mode of chassis(default/highRoute/ionvsFdb/unknown).
/opt/ixia/venv/venv26.5/lib/python3.14/site-packages/ixnetwork_restpy/testplatform/sessions/ixnetwork/ixnetwork.py:2068: SyntaxWarning: "\~" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\\~"? A raw string is also an option.
  - Returns list(dict(arg1:str[None | /api/v1/sessions/1/ixnetwork/topology],arg2:list[dict(arg1:str,arg2:number)],arg3:str[notstarted\~starting\~started\~stopping\~error\~mixed])):
>>> import ixnetwork_restpy
>>> exit

Why:
In Python, the SyntaxWarning: invalid escape sequence '~' occurs because a backslash () followed by a tilde (~) is not a recognized Python escape sequence. Python uses backslashes to create special characters (like \n for a newline), but because ~ has no special meaning, modern Python versions flag it as an error-prone syntax.

How to Fix It:

You can resolve this warning in three ways depending on what you want the string to achieve:

  • Turn it into a raw string: Add an r before the opening quote to tell Python to treat every backslash as a literal character.
  • Double the backslash: Use \ so the first backslash explicitly escapes the second one, outputting a single literal backslash.
  • Remove the backslash: Drop the \ entirely if you only wanted to display a plain tilde (~) and did not actually need a backslash.

Activity

  1. changed the title [-]import ixnetwork_restpy throws syntaxWarning in Python 3.14.7[/-] [+][ixnetwork_restpy 1.11.0] import ixnetwork_restpy throws syntaxWarning in Python 3.14.7[/+] on Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions