acecalisto3 commited on
Commit
2122090
Β·
1 Parent(s): 5ab5d61
Files changed (2) hide show
  1. app2.py +1 -1
  2. fix.sh +19 -15
app2.py CHANGED
@@ -1481,7 +1481,7 @@ def create_modern_interface():
1481
  # When QR codes are generated, update the state with the list of paths
1482
  # and initialize the enabled_qr_codes state with all indices enabled
1483
  if qr_paths_list is None:
1484
- num_qrs=0
1485
  else:
1486
  else:
1487
  num_qrs=len(qr_paths_list)
 
1481
  # When QR codes are generated, update the state with the list of paths
1482
  # and initialize the enabled_qr_codes state with all indices enabled
1483
  if qr_paths_list is None:
1484
+ num_qrs=0
1485
  else:
1486
  else:
1487
  num_qrs=len(qr_paths_list)
fix.sh CHANGED
@@ -1,25 +1,29 @@
1
  #!/bin/bash
2
- # Bash script to patch pyth reader.py and app2.py correctly
3
 
4
- echo "πŸ”§ Fixing invalid 'ur' string syntax in pyth reader.py..."
5
 
6
- # Patch 1: Fix "ur" prefix to "r" on line 653 of pyth reader.py
7
- sed -i '653s/ur"/r"/; 653s/ur'\''/r'\''/' /usr/local/lib/python3.10/site-packages/pyth/plugins/rtf15/reader.py
 
8
 
9
- echo "βœ… Patched 'ur' regex string to 'r' string at line 653."
10
 
11
- echo "πŸ”§ Fixing missing indentation in app2.py..."
12
 
13
- # Patch 2: Properly indent the 'num_qrs=0' and the 'else' block after 'if qr_paths_list is None:'
14
- # First, indent the next line after the 'if'
15
- sed -i '/if qr_paths_list is None:$/{
16
- n
17
- s/^[^ ].*/ &/
18
  }' /home/user/app/app2.py
19
 
20
- # Then, ensure the 'else' appears properly with indentation
21
- sed -i '/if qr_paths_list is None:/!b;n;/^ *else:$/!s/^else:/ else:/;n;s/^[^ ].*/ &/' /home/user/app/app2.py
 
 
 
 
22
 
23
- echo "βœ… Fixed indentation after 'if qr_paths_list is None:'."
24
 
25
- echo "🎯 All patches successfully applied. Restart your app now."
 
1
  #!/bin/bash
2
+ set -e
3
 
4
+ echo "πŸ”§ Fixing reader.py ur'' syntax error..."
5
 
6
+ # Force-correct the ur'...' to r'...' (handles single and double quotes)
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
+ echo "βœ… reader.py fixed."
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
+ s/^/ /
25
+ }' /home/user/app/app2.py
26
 
27
+ echo "βœ… app2.py indentation fixed."
28
 
29
+ echo "🎯 All runtime blockers patched. Restart app now."