yorikvanhavre / BIM_Workbench

A BIM Workbench for FreeCAD
363 stars 77 forks source link

Issues with BimTutorial on windows #45

Closed SimonPasquet closed 2 years ago

SimonPasquet commented 4 years ago

Hi ! I get two issues with the bim tutorial on windows 10, freecad 0.18 and the bim workbench updated today (26/04/2020)

1) I get this error when downloading the tutorial Traceback (most recent call last): File "C:\Users\Name\AppData\Roaming\FreeCAD\Mod\BIM\BimTutorial.py", line 122, in load f.write(html) File "C:\Users\Name\AppData\Local\FreeCAD 0.18\bin\lib\encodings\cp1252.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode character '\u200e' in position 4491: character maps to

opening offlineloc with "bw" and using "f.write(bytes(html, "utf-8"))" instead of "f.write(html)" resolved the issue.

2) the images don't load. They are downloaded but it seams that freecad can't find the wright path to them.

luzpaz commented 4 years ago

Try using FreeCAD 0.19.x and report back

yorikvanhavre commented 4 years ago

Thanks for the notifications... I wonder if there isn't a way to write in non-binary mode directly using utf8... Would be better than converting back and forth to bytes. Will try here. About problem 2), several people reported that as well.. I have no windows install anymore at the moment, so it's hard to find our what's wrong unless somebody helps me to debug... There is probably a problem with how the file path is made... Could you try adding this line in BimTutorial.py, at Line165, just above descr=...: print ("loading image:",descr.replace(path,"file://"+storename.replace("\\","/"))) Then when opening the tutorial, you should see a series of image paths printed in the report view.. Could you try copy/pasting one of them into your web browser, see if that works?

yorikvanhavre commented 4 years ago

Also please check if the above fix works for you?

SimonPasquet commented 4 years ago

The fix works. I'll try to find what doesn't work for the images next Friday.

SimonPasquet commented 4 years ago

Line 165 replacing : descr = descr.replace(path,"file://"+storename.replace("\","/")) by : descr = descr.replace(path,"file:///"+storename.replace("\","/")) solve the issue. (Firefox auto-correct "file://C:" to "file:///C:" in the adress bar)

For the record, below is what you ask (after the change) :

path : /images/5/5e/BIM_Tutorial_42.jpg storename : C:\Users\Simon\AppData\Roaming\FreeCAD\BIM\Tutorial\BIM_Tutorial_42.jpg "file:///"+storename.replace("\","/") : file:///C:/Users/Simon/AppData/Roaming/FreeCAD/BIM/Tutorial/BIM_Tutorial_42.jpg

[Edit] I can't post the résult of : print ("loading image:",descr.replace(path,"file://"+storename.replace("\","/"))) It is Interpreted as spam.

yorikvanhavre commented 2 years ago

This has actually been fixed in da8f2d6fcb0029