Skip to content

Commit fafa5b0

Browse files
Lukas Geigerclaude
andcommitted
fix: bulk bugfix session 2026-03-13 -- sys.executable, temp cleanup, QSettings-Key
- DebugOutputPanel: hardcodiertes "python" durch sys.executable ersetzt - LinterRunner: Temp-Datei wird im finally-Block geloescht (kein Datei-Leak) - SettingsDialog: QSettings-Key von "v6" auf "v8" korrigiert - bare except durch except Exception ersetzt Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5c083b2 commit fafa5b0

1 file changed

Lines changed: 27 additions & 22 deletions

File tree

PythonBox_v8.py

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -981,19 +981,24 @@ def run_linter(self, code: str, file_path: Optional[str] = None) -> List[Dict]:
981981
tmp_path = Path.home() / ".python_baukasten" / "temp_lint.py"
982982
tmp_path.parent.mkdir(parents=True, exist_ok=True)
983983
tmp_path.write_text(code, encoding='utf-8')
984-
984+
985985
results = []
986-
987-
# Versuche Flake8 (schneller)
988-
if self.has_flake8:
989-
results.extend(self._run_flake8(str(tmp_path)))
990-
# Fallback auf Pylint
991-
elif self.has_pylint:
992-
results.extend(self._run_pylint(str(tmp_path)))
993-
# Kein Linter verfügbar - nutze AST für Syntax-Fehler
994-
else:
995-
results.extend(self._run_ast_check(code))
996-
986+
try:
987+
# Versuche Flake8 (schneller)
988+
if self.has_flake8:
989+
results.extend(self._run_flake8(str(tmp_path)))
990+
# Fallback auf Pylint
991+
elif self.has_pylint:
992+
results.extend(self._run_pylint(str(tmp_path)))
993+
# Kein Linter verfügbar - nutze AST für Syntax-Fehler
994+
else:
995+
results.extend(self._run_ast_check(code))
996+
finally:
997+
try:
998+
tmp_path.unlink()
999+
except OSError:
1000+
pass
1001+
9971002
return results
9981003

9991004
def _run_flake8(self, file_path: str) -> List[Dict]:
@@ -1004,7 +1009,7 @@ def _run_flake8(self, file_path: str) -> List[Dict]:
10041009
["flake8", "--format=%(row)d:%(col)d:%(code)s:%(text)s", file_path],
10051010
capture_output=True, text=True, timeout=10
10061011
)
1007-
1012+
10081013
for line in proc.stdout.strip().split('\n'):
10091014
if ':' in line:
10101015
parts = line.split(':', 3)
@@ -1016,21 +1021,21 @@ def _run_flake8(self, file_path: str) -> List[Dict]:
10161021
'message': parts[3],
10171022
'severity': 'error' if parts[2].startswith('E') else 'warning'
10181023
})
1019-
except Exception:
1024+
except Exception as e:
10201025
pass
1021-
1026+
10221027
return results
10231028

10241029
def _run_pylint(self, file_path: str) -> List[Dict]:
10251030
"""Führt Pylint aus"""
10261031
results = []
10271032
try:
10281033
proc = subprocess.run(
1029-
["pylint", "--output-format=text", "--msg-template={line}:{column}:{msg_id}:{msg}",
1034+
["pylint", "--output-format=text", "--msg-template={line}:{column}:{msg_id}:{msg}",
10301035
file_path],
10311036
capture_output=True, text=True, timeout=30
10321037
)
1033-
1038+
10341039
for line in proc.stdout.strip().split('\n'):
10351040
if ':' in line and not line.startswith('*'):
10361041
parts = line.split(':', 3)
@@ -1042,9 +1047,9 @@ def _run_pylint(self, file_path: str) -> List[Dict]:
10421047
'message': parts[3],
10431048
'severity': 'error' if parts[2].startswith('E') else 'warning'
10441049
})
1045-
except Exception:
1050+
except Exception as e:
10461051
pass
1047-
1052+
10481053
return results
10491054

10501055
def _run_ast_check(self, code: str) -> List[Dict]:
@@ -1491,7 +1496,7 @@ def run_with_pdb(self, file_path: str, breakpoints: List[str] = None):
14911496
self.output.appendPlainText("Befehle: n(ext), s(tep), c(ontinue), r(eturn), p <var>, l(ist), q(uit)")
14921497
self.output.appendPlainText("─" * 50 + "\n")
14931498

1494-
self.process.start("python", ["-m", "pdb", file_path])
1499+
self.process.start(sys.executable, ["-m", "pdb", file_path])
14951500

14961501
# Breakpoints setzen nach Start
14971502
if breakpoints:
@@ -1523,7 +1528,7 @@ def run_normal(self, file_path: str):
15231528
self.output.appendPlainText(f"▶️ Ausführen: {file_path}\n")
15241529
self.output.appendPlainText("─" * 50 + "\n")
15251530

1526-
self.process.start("python", ["-u", file_path])
1531+
self.process.start(sys.executable, ["-u", file_path])
15271532
self.btn_stop.setEnabled(True)
15281533

15291534
def send_command(self, cmd: str):
@@ -1672,7 +1677,7 @@ class SettingsDialog(QDialog):
16721677

16731678
def __init__(self, parent=None, settings: QSettings = None):
16741679
super().__init__(parent)
1675-
self.settings = settings or QSettings("PythonArchitect", "v6")
1680+
self.settings = settings or QSettings("PythonArchitect", "v8")
16761681
self.setWindowTitle("Einstellungen")
16771682
self.setMinimumSize(400, 350)
16781683

0 commit comments

Comments
 (0)