Skip to content

Commit 8484ede

Browse files
committed
Fix issue with printing file paths that contain spaces
1 parent 967db60 commit 8484ede

File tree

5 files changed

+30
-5
lines changed

5 files changed

+30
-5
lines changed

seleniumbase/console_scripts/sb_mkchart.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,12 @@ def main():
263263
file = codecs.open(file_path, "w+", "utf-8")
264264
file.writelines("\r\n".join(data))
265265
file.close()
266-
os.system("sbase print %s -n" % file_name)
266+
if " " not in file_name:
267+
os.system("sbase print %s -n" % file_name)
268+
elif '"' not in file_name:
269+
os.system('sbase print "%s" -n' % file_name)
270+
else:
271+
os.system("sbase print '%s' -n" % file_name)
267272
success = (
268273
"\n" + c1 + '* Chart Presentation: "' + file_name + '" was created! *'
269274
"" + cr + "\n"

seleniumbase/console_scripts/sb_mkdir.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,12 @@ def main():
700700
file = codecs.open(file_path, "w+", "utf-8")
701701
file.writelines("\r\n".join(data))
702702
file.close()
703-
os.system("sbase print %s -n" % file_path)
703+
if " " not in file_path:
704+
os.system("sbase print %s -n" % file_path)
705+
elif '"' not in file_path:
706+
os.system('sbase print "%s" -n' % file_path)
707+
else:
708+
os.system("sbase print '%s' -n" % file_path)
704709
os.remove(file_path)
705710

706711
success = (

seleniumbase/console_scripts/sb_mkfile.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,12 @@ def main():
283283
file = codecs.open(file_path, "w+", "utf-8")
284284
file.writelines("\r\n".join(data))
285285
file.close()
286-
os.system("sbase print %s -n" % file_name)
286+
if " " not in file_name:
287+
os.system("sbase print %s -n" % file_name)
288+
elif '"' not in file_name:
289+
os.system('sbase print "%s" -n' % file_name)
290+
else:
291+
os.system("sbase print '%s' -n" % file_name)
287292
success = (
288293
"\n" + c1 + '* Test file: "' + file_name + '" was created! *'
289294
"" + cr + "\n"

seleniumbase/console_scripts/sb_mkpres.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,12 @@ def main():
282282
file = codecs.open(file_path, "w+", "utf-8")
283283
file.writelines("\r\n".join(data))
284284
file.close()
285-
os.system("sbase print %s -n" % file_name)
285+
if " " not in file_name:
286+
os.system("sbase print %s -n" % file_name)
287+
elif '"' not in file_name:
288+
os.system('sbase print "%s" -n' % file_name)
289+
else:
290+
os.system("sbase print '%s' -n" % file_name)
286291
success = (
287292
"\n" + c1 + '* Presentation: "' + file_name + '" was created! *'
288293
"" + cr + "\n"

seleniumbase/console_scripts/sb_mkrec.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,12 @@ def main():
158158
recorded_filename = file_name[:-3] + "_rec.py"
159159
recordings_dir = os.path.join(dir_name, "recordings")
160160
recorded_file = os.path.join(recordings_dir, recorded_filename)
161-
os.system("sbase print %s -n" % recorded_file)
161+
if " " not in recorded_file:
162+
os.system("sbase print %s -n" % recorded_file)
163+
elif '"' not in recorded_file:
164+
os.system('sbase print "%s" -n' % recorded_file)
165+
else:
166+
os.system("sbase print '%s' -n" % recorded_file)
162167
shutil.copy(recorded_file, file_path)
163168
success = (
164169
"\n" + c2 + "***" + cr + " RECORDING COPIED to: "

0 commit comments

Comments
 (0)