Created
June 29, 2023 10:34
-
-
Save joaomcarlos/8bbdf42ad0eb1dcfd0cf7291393dfeb6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import subprocess | |
from pathlib import Path | |
# Get the python venv | |
out = subprocess.run( | |
["pip show pip | grep Location"], | |
shell=True, | |
capture_output=True, | |
text=True, | |
).stdout | |
base = Path(out.split(" ")[1].strip()) | |
file_to_fix = base / "wrapt/decorators.py" | |
text = file_to_fix.read_text() | |
if "formatargspec" in text: | |
logging.warning( | |
"Temporarily fixing import error in wrapt.decorators used by nameko ..." | |
) | |
logging.warning(f"Fixing {file_to_fix} ...\n") | |
# Replace the old function name with the new one | |
fixed_text = text.replace("formatargspec", "getfullargspec") | |
file_to_fix.write_text(fixed_text) | |
logging.warning(f"Fixed {file_to_fix}!\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment