You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello there. I encounter a fail of an image path resolution in a defs/use context
Here is a MWE (env: win10 pro with docker desktop)
The svg file is ok in chrome but fails with cairosvg
FROM python:3.10 AS py
RUN pip install \
ipython \
cairosvg
FROM py
WORKDIR /lab
COPY . "/lab"# CMD ["ipython"]CMD ["/bin/bash"]
docker host step
docker image build -t o314_cairosvg_python3dot10 .
docker run -it --name o314_cairosvg_python3dot10_inst1 o314_cairosvg_python3dot10
# docker start -ai o314_cairosvg_python3dot10_inst1 # if needed# docker cp o314_cairosvg_python3dot10_inst1:/lab/bug.png bug.png # if needed
docker container step
cairosvg bug.svg -o bug.png -u
that turns into a big nasty bug
Traceback (most recent call last):
File "/usr/local/lib/python3.10/urllib/request.py", line 1505, in open_local_file
stats = os.stat(localfile)
FileNotFoundError: [Errno 2] No such file or directory: '/bug_photo.jpg'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/cairosvg", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.10/site-packages/cairosvg/__main__.py", line 78, in main
SURFACES[output_format.upper()].convert(**kwargs)
File "/usr/local/lib/python3.10/site-packages/cairosvg/surface.py", line 133, in convert
instance = cls(
File "/usr/local/lib/python3.10/site-packages/cairosvg/surface.py", line 225, in __init__
self.draw(tree)
File "/usr/local/lib/python3.10/site-packages/cairosvg/surface.py", line 472, in draw
self.draw(child)
File "/usr/local/lib/python3.10/site-packages/cairosvg/surface.py", line 472, in draw
self.draw(child)
File "/usr/local/lib/python3.10/site-packages/cairosvg/surface.py", line 404, in draw
TAGS[node.tag](self, node)
File "/usr/local/lib/python3.10/site-packages/cairosvg/defs.py", line 365, in use
surface.draw(tree)
File "/usr/local/lib/python3.10/site-packages/cairosvg/surface.py", line 404, in draw
TAGS[node.tag](self, node)
File "/usr/local/lib/python3.10/site-packages/cairosvg/image.py", line 28, in image
image_bytes = node.fetch_url(url, 'image/*')
File "/usr/local/lib/python3.10/site-packages/cairosvg/parser.py", line 243, in fetch_url
return read_url(url, self.url_fetcher, resource_type)
File "/usr/local/lib/python3.10/site-packages/cairosvg/url.py", line 154, in read_url
return url_fetcher(url, resource_type)
File "/usr/local/lib/python3.10/site-packages/cairosvg/url.py", line 84, in fetch
return urlopen(Request(url, headers=HTTP_HEADERS)).read()
File "/usr/local/lib/python3.10/urllib/request.py", line 216, in urlopen
return opener.open(url, data, timeout)
File "/usr/local/lib/python3.10/urllib/request.py", line 519, in open
response = self._open(req, data)
File "/usr/local/lib/python3.10/urllib/request.py", line 536, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
File "/usr/local/lib/python3.10/urllib/request.py", line 496, in _call_chain
result = func(*args)
File "/usr/local/lib/python3.10/urllib/request.py", line 1483, in file_open
return self.open_local_file(req)
File "/usr/local/lib/python3.10/urllib/request.py", line 1522, in open_local_file
raise URLError(exp)
urllib.error.URLError: <urlopen error [Errno 2] No such file or directory: '/bug_photo.jpg'>
The jpg path is not resolved correctly
I have tried to trace / fix / debug whatever without success.
Is there any simple things i have missed ? Is it really a bug ?
Hello there. I encounter a fail of an image path resolution in a defs/use context
Here is a MWE (env: win10 pro with docker desktop)
The svg file is ok in chrome but fails with cairosvg
fs step
where bug.svg content is
Dockerfile content is
docker host step
docker container step
that turns into a big nasty bug
The jpg path is not resolved correctly
I have tried to trace / fix / debug whatever without success.
Is there any simple things i have missed ? Is it really a bug ?
PS
some point of interests
The text was updated successfully, but these errors were encountered: