AttributeError: 'NoneType' object has no attribute 'group'

Does someone has the same problem with the lesson 1-pets notebook?

1 Like

I encountered the same error on Windows, this replacement regex worked for me on Windows:

# pat = re.compile(r'/([^/]+)_\d+.jpg$') # for linux
pat = re.compile(r'\\([^\\]+)_\d+.jpg$') #for windows

Regex sourced from this Github Issue:


Hi, I keep getting the same error and the above doesn’t solve the issue. Did you manage to get it to work?

The regex seems to be correct, as I’m able to get the file name from a str() of an individual file path. It seems as if the ImageDataBunch method can’t process the fnames and I can’t figure out why.

The suggestion by @CamHynes worked for me

pat = re.compile(r'\\([^\\]+)_\d+.jpg$') #for windows


Thanks! I solved my issue, one of the files wasn’t a jpg…

Hi all,

I get the same error. Mine appears to come after running the ImageDataBunch portion of the code.
i have even copied and pasted the syntax from a Colab notebook instance and I still get the same error.

I know next to nothing about coding so please bear with me if the issue is an obvious one.

here is the error that shows up at the bottom of my coding cell

Resolved! the pat = line was missing the re.compile bit.:slightly_smiling_face: