You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[ixnetwork_restpy 1.11.0] import ixnetwork_restpy throws syntaxWarning in Python 3.14.7 #89
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.
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
Activity
[-]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[/+]