Skip to content

Commit 04e93a9

Browse files
authored
Merge pull request #630 from seleniumbase/fix-unicode-decode-errors-on-windows
Fix UnicodeDecodeError issues on Windows
2 parents f6dcd5b + a043188 commit 04e93a9

File tree

6 files changed

+17
-14
lines changed

6 files changed

+17
-14
lines changed

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ wheel>=0.34.2
77
six==1.15.0
88
nose==1.3.7
99
ipdb==0.13.3
10+
jedi==0.17.2
1011
idna==2.10
1112
chardet==3.0.4
1213
urllib3==1.25.9
@@ -36,8 +37,8 @@ pyopenssl==19.1.0
3637
pygments==2.5.2;python_version<"3.5"
3738
pygments==2.6.1;python_version>="3.5"
3839
colorama==0.4.3
40+
pymysql==0.10.0
3941
brython>=3.8.9
40-
pymysql==0.9.3
4142
coverage==5.2
4243
pyotp==2.3.0
4344
boto==2.49.0

seleniumbase/console_scripts/objectify.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1495,7 +1495,7 @@ def main(shell_command):
14951495
# Create SeleniumBase test file
14961496
base_file_name = seleniumbase_file.split('.py')[0]
14971497
converted_file_name = base_file_name + ".py" # Change end to make a copy
1498-
out_file = codecs.open(converted_file_name, "w+")
1498+
out_file = codecs.open(converted_file_name, "w+", encoding="utf-8")
14991499
out_file.writelines(seleniumbase_code)
15001500
out_file.close()
15011501
print('\n>>> ["%s"] was updated!\n' % converted_file_name)

seleniumbase/core/tour_helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ def export_tour(tour_steps, name=None, filename="my_tour.js", url=None):
10021002
pass
10031003
import codecs
10041004
file_path = exported_tours_folder + "/" + filename
1005-
out_file = codecs.open(file_path, "w+")
1005+
out_file = codecs.open(file_path, "w+", encoding="utf-8")
10061006
out_file.writelines(instructions)
10071007
out_file.close()
10081008
print('\n>>> [%s] was saved!\n' % file_path)

seleniumbase/fixtures/base_case.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1831,7 +1831,7 @@ def save_cookies(self, name="cookies.txt"):
18311831
if not os.path.exists(file_path):
18321832
os.makedirs(file_path)
18331833
cookies_file_path = "%s/%s" % (file_path, name)
1834-
cookies_file = codecs.open(cookies_file_path, "w+")
1834+
cookies_file = codecs.open(cookies_file_path, "w+", encoding="utf-8")
18351835
cookies_file.writelines(json_cookies)
18361836
cookies_file.close()
18371837

@@ -3342,7 +3342,7 @@ def save_presentation(
33423342
except Exception:
33433343
pass
33443344
file_path = saved_presentations_folder + "/" + filename
3345-
out_file = codecs.open(file_path, "w+")
3345+
out_file = codecs.open(file_path, "w+", encoding="utf-8")
33463346
out_file.writelines(the_html)
33473347
out_file.close()
33483348
print('\n>>> [%s] was saved!\n' % file_path)
@@ -4682,16 +4682,16 @@ def check_window(self, name="default", level=0, baseline=False):
46824682

46834683
if set_baseline:
46844684
self.save_screenshot("screenshot.png", visual_baseline_path)
4685-
out_file = codecs.open(page_url_file, "w+")
4685+
out_file = codecs.open(page_url_file, "w+", encoding="utf-8")
46864686
out_file.writelines(page_url)
46874687
out_file.close()
4688-
out_file = codecs.open(level_1_file, "w+")
4688+
out_file = codecs.open(level_1_file, "w+", encoding="utf-8")
46894689
out_file.writelines(json.dumps(level_1))
46904690
out_file.close()
4691-
out_file = codecs.open(level_2_file, "w+")
4691+
out_file = codecs.open(level_2_file, "w+", encoding="utf-8")
46924692
out_file.writelines(json.dumps(level_2))
46934693
out_file.close()
4694-
out_file = codecs.open(level_3_file, "w+")
4694+
out_file = codecs.open(level_3_file, "w+", encoding="utf-8")
46954695
out_file.writelines(json.dumps(level_3))
46964696
out_file.close()
46974697

seleniumbase/fixtures/page_utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@ def _download_file_to(file_url, destination_folder, new_file_name=None):
217217

218218

219219
def _save_data_as(data, destination_folder, file_name):
220-
out_file = codecs.open(destination_folder + '/' + file_name, "w+")
220+
out_file = codecs.open(
221+
destination_folder + '/' + file_name, "w+", encoding="utf-8")
221222
out_file.writelines(data)
222223
out_file.close()
223224

setup.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@
4242
os.system('rm -f dist/*.egg; rm -f dist/*.tar.gz; rm -f dist/*.whl')
4343
os.system('python setup.py sdist bdist_wheel') # Create new tar/wheel
4444
print("\n*** Installing twine: *** (Required for PyPI uploads)\n")
45-
os.system("python -m pip install 'twine>=1.15.0'")
45+
os.system("python -m pip install --upgrade 'twine>=1.15.0'")
4646
print("\n*** Installing tqdm: *** (Required for PyPI uploads)\n")
47-
os.system("python -m pip install 'tqdm>=4.47.0'")
47+
os.system("python -m pip install --upgrade 'tqdm>=4.48.0'")
4848
print("\n*** Publishing The Release to PyPI: ***\n")
4949
os.system('python -m twine upload dist/*') # Requires ~/.pypirc Keys
5050
print("\n*** The Release was PUBLISHED SUCCESSFULLY to PyPI! :) ***\n")
@@ -54,7 +54,7 @@
5454

5555
setup(
5656
name='seleniumbase',
57-
version='1.42.13',
57+
version='1.42.14',
5858
description='Fast, Easy, and Reliable Browser Automation & Testing.',
5959
long_description=long_description,
6060
long_description_content_type='text/markdown',
@@ -99,6 +99,7 @@
9999
'six',
100100
'nose',
101101
'ipdb',
102+
'jedi==0.17.2', # The last version for Python 2 and 3.5
102103
'idna==2.10', # Must stay in sync with "requests"
103104
'chardet==3.0.4', # Must stay in sync with "requests"
104105
'urllib3==1.25.9', # Must stay in sync with "requests"
@@ -128,8 +129,8 @@
128129
'pygments==2.5.2;python_version<"3.5"',
129130
'pygments==2.6.1;python_version>="3.5"',
130131
'colorama==0.4.3',
132+
'pymysql==0.10.0',
131133
'brython>=3.8.9',
132-
'pymysql==0.9.3',
133134
'coverage==5.2',
134135
'pyotp==2.3.0',
135136
'boto==2.49.0',

0 commit comments

Comments
 (0)