Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: invalid literal for int() with base 16: 'ig' #439

Closed
tfwuSUDA opened this issue Mar 12, 2025 · 0 comments
Closed

ValueError: invalid literal for int() with base 16: 'ig' #439

tfwuSUDA opened this issue Mar 12, 2025 · 0 comments

Comments

@tfwuSUDA
Copy link

An error acurred when I am trying to convert an svg file into an eps file ...
Someone help me...


ValueError Traceback (most recent call last)
/tmp/ipykernel_3266435/1623672368.py in
----> 1 cairosvg.svg2ps(bytestring=open("model.svg").read().encode('utf-8'))

~/disks/chichi/mambaforge/envs/zenotorch/lib/python3.7/site-packages/cairosvg/init.py in svg2ps(bytestring, file_obj, url, dpi, parent_width, parent_height, scale, unsafe, background_color, negate_colors, invert_images, write_to, output_width, output_height)
82 background_color=background_color, negate_colors=negate_colors,
83 invert_images=invert_images, unsafe=unsafe, write_to=write_to,
---> 84 output_width=output_width, output_height=output_height)
85
86

~/disks/chichi/mambaforge/envs/zenotorch/lib/python3.7/site-packages/cairosvg/surface.py in convert(cls, bytestring, file_obj, url, dpi, parent_width, parent_height, scale, unsafe, background_color, negate_colors, invert_images, write_to, output_width, output_height, **kwargs)
135 output_width, output_height, background_color,
136 map_rgba=negate_color if negate_colors else None,
--> 137 map_image=invert_image if invert_images else None)
138 instance.finish()
139 if write_to is None:

~/disks/chichi/mambaforge/envs/zenotorch/lib/python3.7/site-packages/cairosvg/surface.py in init(self, tree, output, dpi, parent_surface, parent_width, parent_height, scale, output_width, output_height, background_color, map_rgba, map_image)
223 self.map_rgba = map_rgba
224 self.map_image = map_image
--> 225 self.draw(tree)
226
227 @Property

~/disks/chichi/mambaforge/envs/zenotorch/lib/python3.7/site-packages/cairosvg/surface.py in draw(self, node)
470 if display and node.tag not in INVISIBLE_TAGS:
471 for child in node.children:
--> 472 self.draw(child)
473
474 # Apply filter, mask and opacity

~/disks/chichi/mambaforge/envs/zenotorch/lib/python3.7/site-packages/cairosvg/surface.py in draw(self, node)
470 if display and node.tag not in INVISIBLE_TAGS:
471 for child in node.children:
--> 472 self.draw(child)
473
474 # Apply filter, mask and opacity

~/disks/chichi/mambaforge/envs/zenotorch/lib/python3.7/site-packages/cairosvg/surface.py in draw(self, node)
470 if display and node.tag not in INVISIBLE_TAGS:
471 for child in node.children:
--> 472 self.draw(child)
473
474 # Apply filter, mask and opacity

~/disks/chichi/mambaforge/envs/zenotorch/lib/python3.7/site-packages/cairosvg/surface.py in draw(self, node)
470 if display and node.tag not in INVISIBLE_TAGS:
471 for child in node.children:
--> 472 self.draw(child)
473
474 # Apply filter, mask and opacity

~/disks/chichi/mambaforge/envs/zenotorch/lib/python3.7/site-packages/cairosvg/surface.py in draw(self, node)
470 if display and node.tag not in INVISIBLE_TAGS:
471 for child in node.children:
--> 472 self.draw(child)
473
474 # Apply filter, mask and opacity

~/disks/chichi/mambaforge/envs/zenotorch/lib/python3.7/site-packages/cairosvg/surface.py in draw(self, node)
470 if display and node.tag not in INVISIBLE_TAGS:
471 for child in node.children:
--> 472 self.draw(child)
473
474 # Apply filter, mask and opacity

~/disks/chichi/mambaforge/envs/zenotorch/lib/python3.7/site-packages/cairosvg/surface.py in draw(self, node)
440 if not gradient_or_pattern(self, node, paint_source, fill_opacity):
441 self.context.set_source_rgba(
--> 442 *self.map_color(paint_color, fill_opacity))
443 if TAGS[node.tag] == text:
444 self.cursor_position = save_cursor[0]

~/disks/chichi/mambaforge/envs/zenotorch/lib/python3.7/site-packages/cairosvg/surface.py in map_color(self, string, opacity)
276 def map_color(self, string, opacity=1):
277 """Parse a color string and apply map_rgba function to it."""
--> 278 rgba = color(string, opacity)
279 return self.map_rgba(rgba) if self.map_rgba else rgba
280

~/disks/chichi/mambaforge/envs/zenotorch/lib/python3.7/site-packages/cairosvg/colors.py in color(string, opacity)
227 plain_color = tuple(
228 int(value, 16) / 255 for value in (
--> 229 string[1:3], string[3:5], string[5:7]))
230 return plain_color + (opacity,)
231

~/disks/chichi/mambaforge/envs/zenotorch/lib/python3.7/site-packages/cairosvg/colors.py in (.0)
226 if match:
227 plain_color = tuple(
--> 228 int(value, 16) / 255 for value in (
229 string[1:3], string[3:5], string[5:7]))
230 return plain_color + (opacity,)

ValueError: invalid literal for int() with base 16: 'ig'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant