Skip to content

windows only plot(g) from mtg file not working encode pb #47

@baugetfa

Description

@baugetfa

when doing

from openalea.mtg import MTG
from oawidgets.mtg import plot 
import pathlib
g = MTG(''data/boutdenoylum2.mtg')
plot(g)

we got the following error in windows only:

UnicodeEncodeError                        Traceback (most recent call last)
Cell In[3], line 1
----> 1 plot(g)

File E:\oawidgets\src\oawidgets\mtg.py:130, in plot(g, properties, selection, hlayout, scale, labels, height, width, cdn_resources, **kwds)
    125 # Name of the graph
    126 #uid = uuid.uuid4().hex
    127 #name = f"mtg_{uid}.html"
    128 name = 'mtg.html'
--> 130 return G.show(name)

File E:\miniforge3\envs\oawidgets_dev\Lib\site-packages\pyvis\network.py:546, in Network.show(self, name, local, notebook)
    544 print(name)
    545 if notebook:
--> 546     self.write_html(name, open_browser=False,notebook=True)
    547 else:
    548     self.write_html(name, open_browser=True)

File E:\miniforge3\envs\oawidgets_dev\Lib\site-packages\pyvis\network.py:530, in Network.write_html(self, name, local, notebook, open_browser)
    528 elif self.cdn_resources == "in_line" or self.cdn_resources == "remote":
    529     with open(getcwd_name, "w+") as out:
--> 530         out.write(self.html)
    531 else:
    532     assert "cdn_resources is not in ['in_line','remote','local']."

File E:\miniforge3\envs\oawidgets_dev\Lib\encodings\cp1252.py:19, in IncrementalEncoder.encode(self, input, final)
     18 def encode(self, input, final=False):
---> 19     return codecs.charmap_encode(input,self.errors,encoding_table)[0]

UnicodeEncodeError: 'charmap' codec can't encode characters in position 263607-263621: character maps to <undefined>

Tried to force encode to 'utf-8' without success

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions