Repository: ManimCommunity/manim
File: manim/mobject/svg/svg_mobject.py (Python)

Code before:
            Color(color) if color else None,
            Color(fill_color) if fill_color else None,
            Color(stroke_color) if stroke_color else None,
            fill_opacity,
            stroke_opacity,
        )
        super().__init__(
            color=color,
            fill_opacity=fill_opacity,
            stroke_width=stroke_width,
            fill_color=fill_color,
            stroke_opacity=stroke_opacity,
            stroke_color=stroke_color,
            **kwargs,
        )
        self._move_into_position(width, height)

    def _ensure_valid_file(self):
        """Reads self.file_name and determines whether the given input file_name
        is valid.
        """
        if self.file_name is None:
            raise Exception("Must specify file for SVGMobject")

        if Path(self.file_name).exists():
            self.file_path = self.file_name
            return

        relative = Path.cwd().joinpath(self.file_name)
        if Path(relative).exists():
            self.file_path = relative
            return

        possible_paths = [
            Path(config.get_dir("assets_dir")).joinpath(self.file_name),
            Path(config.get_dir("assets_dir")).joinpath(self.file_name + ".svg"),
            Path(config.get_dir("assets_dir")).joinpath(self.file_name + ".xdv"),
            Path(self.file_name),
            Path(self.file_name).joinpath(".svg"),
            Path(self.file_name).joinpath(".xdv"),
        ]
        for path in possible_paths:
            if path.exists():
                self.file_path = path
                return
        error = f"From: {Path.cwd()}, could not find {self.file_name} at either of these locations: {possible_paths}"
        raise OSError(error)

    def generate_points(self):
        """Called by the Mobject abstract base class. Responsible for generating
        the SVGMobject's points from XML tags, populating self.mobjects, and

Review comment (suggestion):
Hi @jbalpert , thanks for this pr! I'll have a look on this in detail soon.
One idea quick idea already: Can you have a look if there is a good solution that the SVGMobject can also accept pathlib objects, e.g. like this?
```py
class Example(Scene):
    def construct(self):
        path = Path.cwd() / "wind.svg"
        em = SVGMobject(path, color=BLACK) # <- not yet working
        #em = SVGMobject(str(path), color=BLACK) # <- current solution
        self.add(em)
  ```

Code after:
            Color(fill_color) if fill_color else None,
            Color(stroke_color) if stroke_color else None,
            fill_opacity,
            stroke_opacity,
        )
        super().__init__(
            color=color,
            fill_opacity=fill_opacity,
            stroke_width=stroke_width,
            fill_color=fill_color,
            stroke_opacity=stroke_opacity,
            stroke_color=stroke_color,
            **kwargs,
        )
        self._move_into_position(width, height)

    def _ensure_valid_file(self):
        """Reads self.file_name and determines whether the given input file_name
        is valid.
        """
        if self.file_name is None:
            raise Exception("Must specify file for SVGMobject")

        if os.path.exists(self.file_name):
            self.file_path = self.file_name
            return

        relative = os.path.join(os.getcwd(), self.file_name)
        if os.path.exists(relative):
            self.file_path = relative
            return

        possible_paths = [
            os.path.join(config.get_dir("assets_dir"), self.file_name),
            os.path.join(config.get_dir("assets_dir"), self.file_name + ".svg"),
            os.path.join(config.get_dir("assets_dir"), self.file_name + ".xdv"),
            self.file_name,
            self.file_name + ".svg",
            self.file_name + ".xdv",
        ]
        for path in possible_paths:
            if os.path.exists(path):
                self.file_path = path
                return
        error = f"From: {os.getcwd()}, could not find {self.file_name} at either of these locations: {possible_paths}"
        raise OSError(error)

    def generate_points(self):
        """Called by the Mobject abstract base class. Responsible for generating
        the SVGMobject's points from XML tags, populating self.mobjects, and
        any submobjects within self.mobjects.