gentzkow / template_archive

19 stars 33 forks source link

PR for #89: Address AttributeError in `importlib.util` #90

Closed ShiqiYang2022 closed 11 months ago

ShiqiYang2022 commented 11 months ago

Closes #89 .

This PR aim to address the AttributeError in importlib.util flagged in https://github.com/gentzkow/template/issues/89#issue-1952943988 during new RA onboard process.

In Python versions 3.10.11+ through 3.12.0a7+, importlib.util is not referenced in importlib/__init__.py, so by directly import importlib as we previously did in template, it will throw an AttributeError. If you intend to use importlib.util in a regular Python environment, you should directly import importlib.util instead of trying to import .util from importlib. Details could be referred per threads here.

Per conversation, @snairdesai has bandwidth to conduct the review. @snairdesai the logs in the diff at the moment of this post reflect the change by importing importlib.util additionally. You can then check that the logs are correct and updated and we can proceed with the merge.

cc: @gentzkow @jc-cisneros

ShiqiYang2022 commented 11 months ago

@snairdesai Thanks for your very careful check!

I think the file ~/paper_slides/paper.pdf does exist, see the file here. I guess you might misunderstand the diff, the difference means that the paper.pdf is -100 bytes size after the change, and 100% in read means that the file is 100% large compared to the previous file, instead of 100% size smaller.

If this sounds good to you, I will wrap up this pull request, thanks!

snairdesai commented 11 months ago

Looks good, thanks!