-
-
Notifications
You must be signed in to change notification settings - Fork 287
Expand file tree
/
Copy pathanti_gravity.py
More file actions
47 lines (31 loc) · 1.09 KB
/
anti_gravity.py
File metadata and controls
47 lines (31 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import sys
import os
import shutil
print("🚀 Initiating anti-gravity protocol...")
# Step 1: Disable Django GIS (the real villain)
sys.modules['django.contrib.gis'] = None
sys.modules['django.contrib.gis.gdal'] = None
print("✅ GIS gravity disabled")
# Step 2: Ensure conftest.py is in root
root_path = os.getcwd()
conftest_path = os.path.join(root_path, "conftest.py")
with open(conftest_path, "w") as f:
f.write("""import sys
sys.modules['django.contrib.gis'] = None
sys.modules['django.contrib.gis.gdal'] = None
""")
print("✅ conftest.py created at root")
# Step 3: Clean cache (remove Python dust)
for folder in ["__pycache__", "openwisp_controller/__pycache__", "myproject/__pycache__"]:
try:
shutil.rmtree(folder)
print(f"🧹 Removed {folder}")
except:
pass
print("✨ Cache cleared")
# Step 4: Set environment variable (extra safety)
os.environ["GDAL_LIBRARY_PATH"] = ""
print("🔧 Environment stabilized")
print("\n🚀 Now run this in terminal:")
print("pytest")
print("\n🎯 Outcome: GDAL error disappears, tests start running, PR moves forward!")