Skip to content

Commit c89f4b6

Browse files
committed
Fix bug when using the Behave GUI on Windows
1 parent 66cc593 commit c89f4b6

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

seleniumbase/behave/behave_sb.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,11 @@ def dashboard_pre_processing():
813813
filename = None
814814
feature_name = None
815815
scenario_name = None
816-
for row in output.decode("utf-8").split("\n"):
816+
if is_windows:
817+
output = output.decode("latin1")
818+
else:
819+
output = output.decode("utf-8")
820+
for row in output.replace("\r", "").split("\n"):
817821
if row.startswith("Feature: "):
818822
filename_count += 1
819823
feature_count += 1

seleniumbase/console_scripts/sb_behave_gui.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
import tkinter as tk # noqa: E402
2929
from tkinter.scrolledtext import ScrolledText # noqa: E402
3030

31+
is_windows = False
32+
if sys.platform in ["win32", "win64", "x64"]:
33+
is_windows = True
34+
3135

3236
def set_colors(use_colors):
3337
c0 = ""
@@ -371,7 +375,11 @@ def main():
371375
file_scenario_count = {}
372376
f_count = 0
373377
s_count = 0
374-
for row in output.decode("utf-8").split("\n"):
378+
if is_windows:
379+
output = output.decode("latin1")
380+
else:
381+
output = output.decode("utf-8")
382+
for row in output.replace("\r", "").split("\n"):
375383
if row.startswith("Feature: "):
376384
if f_count > 0:
377385
file_scenario_count[str(f_count)] = s_count
@@ -386,7 +394,7 @@ def main():
386394
file_scenario_count[str(f_count)] = s_count
387395
f_count = 0
388396
s_count = 0
389-
for row in output.decode("utf-8").split("\n"):
397+
for row in output.replace("\r", "").split("\n"):
390398
if row.startswith("Feature: "):
391399
f_count += 1
392400
feature_name = row.split("Feature: ")[1]

0 commit comments

Comments
 (0)