Batool
(Batool Almarzouq)
1
I’m going through chapter 9 using Google Colab but I run with this error. I spent a couple of hours trying to figure it out but couldn’t.
!pip install fastcore
!pip install fastai
!pip install fastai --upgrade
!pip install kaggle
from fastai.tabular.all import *
creds = '{"username":"xxx","key":"xxx"}'
cred_path = Path('~/.kaggle/kaggle.json').expanduser()
if not cred_path.exists():
cred_path.parent.mkdir(exist_ok=True)
cred_path.write(creds)
cred_path.chmod(0o600)
it’s showing the following:
'PosixPath' object has no attribute 'write'
It seems that fastai patches the Pathlib
module with a new attribute write
but why it’s not working?
1 Like
rsomani95
(Rahul Somani)
2
Are you sure it patches that function? If yes, can you point out where in the library?
Pathlib has .write_text
and .write_bytes
natively, maybe the former could do what you’re trying to do.
Batool
(Batool Almarzouq)
3
I tried to import pathlib
from pathlib import *
but it still gives the same error message.
This is my notebook if you can manage to make it work
Regardless if it patches the function or not, it doesn’t work.
sirishkumar
(Sirish Kumar Bethala)
4
Looks like write is removed from fastcore utils and got replaced with mk_write
Version where it got removed
4 Likes