Spaces:
Running
Running
Commit
Β·
aab8343
1
Parent(s):
ab414be
fixes
Browse files
app2.py
CHANGED
|
@@ -54,7 +54,6 @@ except ImportError:
|
|
| 54 |
logger.warning("python-docx not installed. DOCX file processing will be limited.") # logger is available
|
| 55 |
|
| 56 |
try:
|
| 57 |
-
from pyth.plugins.rtf15.reader import Rtf15Reader
|
| 58 |
from pyth.plugins.plaintext.writer import PlaintextWriter
|
| 59 |
RTF_SUPPORT = True
|
| 60 |
except ImportError:
|
|
|
|
| 54 |
logger.warning("python-docx not installed. DOCX file processing will be limited.") # logger is available
|
| 55 |
|
| 56 |
try:
|
|
|
|
| 57 |
from pyth.plugins.plaintext.writer import PlaintextWriter
|
| 58 |
RTF_SUPPORT = True
|
| 59 |
except ImportError:
|
fix.sh
CHANGED
|
@@ -1,29 +1,18 @@
|
|
| 1 |
#!/bin/bash
|
| 2 |
set -e
|
| 3 |
|
| 4 |
-
echo "π§
|
|
|
|
|
|
|
| 5 |
|
| 6 |
-
|
| 7 |
-
sed -i 's/ur"HYPERLINK/r"HYPERLINK/' /usr/local/lib/python3.10/site-packages/pyth/plugins/rtf15/reader.py
|
| 8 |
-
sed -i "s/ur'HYPERLINK/r'HYPERLINK/" /usr/local/lib/python3.10/site-packages/pyth/plugins/rtf15/reader.py
|
| 9 |
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
echo "π§ Fixing app2.py indentation error..."
|
| 13 |
-
|
| 14 |
-
# Add indentation after 'if qr_paths_list is None:'
|
| 15 |
-
sed -i '/if qr_paths_list is None:/{
|
| 16 |
-
n
|
| 17 |
-
s/^/ /
|
| 18 |
-
}' /home/user/app/app2.py
|
| 19 |
-
|
| 20 |
-
# Fix else and its block too
|
| 21 |
-
sed -i '/^else:$/{
|
| 22 |
-
s/^/ /
|
| 23 |
n
|
| 24 |
-
|
| 25 |
}' /home/user/app/app2.py
|
| 26 |
|
| 27 |
-
echo "β
|
| 28 |
|
| 29 |
-
echo "π― All
|
|
|
|
| 1 |
#!/bin/bash
|
| 2 |
set -e
|
| 3 |
|
| 4 |
+
echo "π§ Removing Rtf15Reader import from app2.py..."
|
| 5 |
+
sed -i '/from pyth.plugins.rtf15.reader import Rtf15Reader/d' /home/user/app/app2.py
|
| 6 |
+
echo "β
Import removed."
|
| 7 |
|
| 8 |
+
echo "π§ Disabling .rtf file processing..."
|
|
|
|
|
|
|
| 9 |
|
| 10 |
+
# Safely disable .rtf handling inside file processor
|
| 11 |
+
sed -i '/if file_ext == ".rtf":/{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
n
|
| 13 |
+
a\ processing_status_messages.append(f"β οΈ Skipping RTF file {file.name} because RTF processing is disabled.")\n continue
|
| 14 |
}' /home/user/app/app2.py
|
| 15 |
|
| 16 |
+
echo "β
RTF files now skipped safely."
|
| 17 |
|
| 18 |
+
echo "π― All pyth dependencies fully removed and app2.py is adjusted. Restart your app now."
|