From 0d7b9defaa0b83be46e336f41cfa600e9f59255e Mon Sep 17 00:00:00 2001 From: ed Date: Wed, 30 Jul 2025 18:02:11 +0000 Subject: [PATCH] disable libmagic on windows; probably closes #276 --- README.md | 1 + copyparty/util.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 05661ed4..8dad60c6 100644 --- a/README.md +++ b/README.md @@ -2226,6 +2226,7 @@ force-enable features with known issues on your OS/env by setting any of the fo | env-var | what it does | | ------------------------ | ------------ | | `PRTY_FORCE_MP` | force-enable multiprocessing (real multithreading) on MacOS and other broken platforms | +| `PRTY_FORCE_MAGIC` | use [magic](https://pypi.org/project/python-magic/) on Windows (you will segfault) | # packages diff --git a/copyparty/util.py b/copyparty/util.py index 14768e6e..cf07ed5a 100644 --- a/copyparty/util.py +++ b/copyparty/util.py @@ -155,7 +155,9 @@ except: HAVE_PSUTIL = False try: - if os.environ.get("PRTY_NO_MAGIC"): + if os.environ.get("PRTY_NO_MAGIC") or ( + ANYWIN and not os.environ.get("PRTY_FORCE_MAGIC") + ): raise Exception() import magic