Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyntaxWarning: invalid escape sequence '\-' #248

Open
variolam opened this issue Jan 19, 2025 · 0 comments
Open

SyntaxWarning: invalid escape sequence '\-' #248

variolam opened this issue Jan 19, 2025 · 0 comments
Assignees

Comments

@variolam
Copy link

When using milvus-lite I get an ugly SyntaxWarning on Python 3.12.4:

.venv/lib/python3.12/site-packages/milvus_lite/server.py:51: SyntaxWarning: invalid escape sequence '\-'

  raise RuntimeError(f"Unsupport db name {self._db_file.name}, the name must match ^[a-zA-Z0-9.\-_]+$")

Because your server implementation does not use a raw-string Python will throw this warning since Python 3.12+.

Versions < Python 3.12 resulted in a DeprecationWarning (see here), which probably were filtered by your pytest.ini

A fix would be to either use a raw-string in combination with your f-string, like

raise RuntimeError(rf"Unsupport db name {self._db_file.name}, the name must match ^[a-zA-Z0-9.\-_]+$")

or escape the backslash, like

raise RuntimeError(rf"Unsupport db name {self._db_file.name}, the name must match ^[a-zA-Z0-9.\\-_]+$")

Enviornment Details

  • Hardware/Software (OS, CPU, GPU, Memory): MacOS Sequioa 15.2, M3
  • Method of installation (Docker, or from source): Pip
  • Milvus-Lite version: 2.4.11
  • Method of usage: via pymilvus:
from pymilvus import MilvusClient

client = MilvusClient("./milvus_demo.db")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants