Forum

UnicodeDecodeError while building/compiling simple project

28 March 2017 10:57
Hello,

I'm trying to build a new project, and compile it, and got the following error in the operation control console:

File "C:\Program Files\Blender Foundation\blend4web_ce\scripts\lib\project_cli.py", line 2105, in get_used_modules
text = ff.read()
File "C:\Program Files\Blender Foundation\Blender\2.78\python\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 1500: character maps to

I want to compile the b4w engine to include littles tweek in the app.js module, basically different keyboard letters, and I'm stuck with this error.
I tried to reinstall Blender with a fresh extract of Blend4Web, and tried to compile a new project but still got this error. While I 'm no expert in Python, I tried to modified the "project_cli.py" to include the encoding type utf-8 in the open() function but to not avail.

If anybody knows what I'm doing wrong or if someone already found some solution to this, I will really apreciate help.

I 'm on Windows 10
28 March 2017 14:57
Hello again,

I could temporarily resolve this problem by editing the "project_cli.py" and "b4w_compile.py" by adding the encoding type 'UTF8' in the "open(filename,encoding="UTF8")" functions that were flagged in the console. Not very elegant and could lead to others problems but I could finally build/compile and deploy a blank project with app.js modified.

Well, hope this will help others if this problem is not unique to my situation. I'm interrested in others solutions and clarifications.

Thanks
28 March 2017 15:30
Hi! I couldn't reproduce this bug under Win10. Does it appear even without any modifications in the source code?
Anyway, thanks for the info, we'll look at this issue.
Blend4Web Team
30 May 2017 15:17
Hi,

I still have the same error. I created a new project and just clicked on "reexport scenes". It returned the following error:

Traceback (most recent call last):
File "D:\Path\blender-2.78.0-git.a0799ce-windows64\2.78\scripts\addons\blend4web_ce\apps_dev\project.py", line 44, in
project_cli.run(sys.argv, base_dir)
File "D:\Path\blender-2.78.0-git.a0799ce-windows64\2.78\scripts\addons\blend4web_ce\scripts\lib\project_cli.py", line 290, in run
run_reexport(args[1:], proj_path)
File "D:\Path\blender-2.78.0-git.a0799ce-windows64\2.78\scripts\addons\blend4web_ce\scripts\lib\project_cli.py", line 2380, in run_reexport
proc_blend.process_files(blender_exec, assets_dir, assets_dir)
File "D:\Path\blender-2.78.0-git.a0799ce-windows64\2.78\scripts\addons\blend4web_ce\scripts\process_blend.py", line 292, in process_files
process_html(f)
File "D:\Path\blender-2.78.0-git.a0799ce-windows64\2.78\scripts\addons\blend4web_ce\scripts\process_blend.py", line 188, in process_html
html_data = html_file.read()
File "D:\Path\blender-2.78.0-git.a0799ce-windows64\2.78\python\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 2790398: character maps to

I use win 7 - the blender version is 2.78 and the newest b4w version.

I could not get rid of the error by the suggestions of Tonio..

Thanks
30 May 2017 16:11
Hi, I couldn't reproduce this under Win7, can you attach this project here? You can use "Export Project(s)" button in the Project Manager for sharing.
Blend4Web Team
30 May 2017 16:32
Hi,

thanks for taking a look at it. So I only created a new project which is attached.
reexport scenes gives the error mentioned above.

Thanks

edit: uploaded - without materials - but same error
01 June 2017 11:57
We'll fix this bug in 17.06, thanks for the report!
You can also try to fix it by yourself to check if it works for you. The bug is in the SDK's file blend4web_ce\scripts\process_blend.py. You can replace the line:
html_file = open(path)
with the following:
html_file = open(path, encoding="utf-8")

and also change
json_data = open(path)
to
json_data = open(path, encoding="utf-8")
Blend4Web Team
 
Please register or log in to leave a reply.