지식의 유일한 원천은 경험이다

0%

tf upgrade v2 cp949 window10

Automatically upgrade code to TensorFlow 2 in window 10

tf_upgrade_v2 Script cp949 error

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$ tf_upgrade_v2 --intree . --outtree ../tf2-upgraded --copyotherfiles False
2020-06-18 11:35:06.250559: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cud
art64_101.dll
Traceback (most recent call last):
File "C:\Anaconda3\envs\tf2\Scripts\tf_upgrade_v2-script.py", line 10, in <module>
sys.exit(main())
File "C:\Anaconda3\envs\tf2\lib\site-packages\tensorflow_core\tools\compatibility\tf_upgrade_v2_main.py", line 160, in main
args.input_tree, output_tree, args.copy_other_files)
File "C:\Anaconda3\envs\tf2\lib\site-packages\tensorflow_core\tools\compatibility\ast_edits.py", line 1069, in process_tree
_, l_report, l_errors = self.process_file(input_path, output_path)
File "C:\Anaconda3\envs\tf2\lib\site-packages\tensorflow_core\tools\compatibility\ast_edits.py", line 917, in process_file
temp_file)
File "C:\Anaconda3\envs\tf2\lib\site-packages\tensorflow_core\tools\compatibility\ast_edits.py", line 975, in process_opened_file

lines = in_file.readlines()

UnicodeDecodeError: 'cp949' codec can't decode byte 0xec in position 202: illegal multibyte sequence

tensorflow_core\tools\compatibility\ast_edits.py\ast_edits.py

Line 914

1
with open(in_filename, "r") as in_file,

edit

1
with open(in_filename, "r", encoding='utf8') as in_file,

full code

1
2
3
4
5
6
# pylint: disable=g-backslash-continuation
with open(in_filename, "r", encoding='utf8') as in_file, \
tempfile.NamedTemporaryFile("w", delete=False) as temp_file:
ret = self.process_opened_file(in_filename, in_file, out_filename,
temp_file)
# pylint: enable=g-backslash-continuation

Delete folder exist, before Try tf_upgrade_v2 Script (Recommend PowerShell)