`'PosixPath' object has no attribute 'read'`

Lesson 4, Image Segmentation in Google Colab.
I use the provided file 04_Segmentation.ipynb from GitHub.

Which version of fastai and fastcore am I supposed to pip install in order to get this line working?
I already tried

  • !pip install fastai==2.0.19 fastcore==1.3.2
  • !pip install fastai -q --upgrade

Thanks for your suggestions!

Hi, I think you should try read_text() instead. See here.

or

(path/'valid.txt').open().read().split('\n')

1 Like

Both works perfectly fine! Thanks a lot mate! :partying_face:
How did you know about the (path/'valid.txt').open().read()?

I found it in the documentation page for pathlib :slight_smile:

1 Like