@DaveL17 (Dave) posted a new topic, subject "Potential Bug in `patheffects.py`". It read:

   Greetings. First time poster, long-time user.
    
    I'm in the process of converting a legacy matplotlib script (v1.3.1 - legacy MacOS version) to v3.5.1. When I send the line plot to `savefig`, I get the following traceback:
    [code] 
          File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/matplotlib/patheffects.py", line 101, in draw_path
            path_effect.draw_path(self._renderer, gc, tpath, affine,
        AttributeError: 'str' object has no attribute 'draw_path'
        
    [/code]
    
    The method in question (from `patheffects.py`):
    [code] 
            def draw_path(self, gc, tpath, affine, rgbFace=None):
                for path_effect in self._path_effects:
                    path_effect.draw_path(self._renderer, gc, tpath, affine,
                                          rgbFace)
        
    [/code]
    
    I modified the `draw_path` method to inspect the `self._path_effects` object; it comes through as `['[]']`. Not sure why the ‘path_effect' object is coming through as a string. I don't get the error when running the script under v1.3.1.

So @tacaswell replied

    My guess is that is bug is actually in parsing rcparams, do you have a custom rcparams file, can you check the value of `mpl.rcParams['path.effects']`?
    
    Failing that, do you call `art.set_path_effects` anywhere?
    
    Can you extract a (minimal) bit of code to reproduce this?
    
    Also, that is a ~9 year jump! Hopefully we have not broken too much under you.

Then @DaveL17 (Dave) said

    I do have a custom style involved.
    [code] 
        path.effects: []
        
    [/code]
    
    (which I believe is the default). I don't reset `path.effects` anywhere nor call `art.set_path_effects` at any point within the project.
    
    Yes, 9 years! The reason for the refactor is that it looks like Apple is going to eliminate Python with MacOS 12.3.
    
    Thanks for the help. Cheers!

To which @tacaswell replied

    Change that to
    [code] 
        path.effects:
        
    [/code]
    
    We expects lists in `matplotlibrc` to be without `[` or `]` and to be `,` seperated so we are reading this as "a single element list with the string value `'[]'`".
    
    Why this changed is a different question…

So @DaveL17 (Dave) replied

    That makes perfect sense and also points to the fact that this error is pretty much on me. I'm dumping my rcParams to a style sheet in order to migrate to a more static set of styles and doing that by writing them out to a file. This results in lists being written to file in typical Python style. This is obviously easy to handle and–beyond that–rather than write out all the parms, I'm only going to only write out the _**changes**_.
    
    Sorry if that was an unnecessary sidetrack. Cheers!


{'source': 'discourse', 'url': 'https://discourse.matplotlib.org/t/potential-bug-in-patheffects-py/22621', 'title': 'Potential Bug in `patheffects.py`', 'views': 103, 'has_accepted_answer': False, 'word_count': 400, 'like_count': 0, 'reply_count': 2, 'participant_count': 2, 'posts': 5, 'tags': '', 'author': '@DaveL17 (Dave)', 'participants': '@DaveL17 (Dave), @tacaswell', 'image_url': [None], 'created_at': '2022-02-24T19:38:53.131Z', 'last_posted_at': '2022-02-24T23:10:58.050Z'}