It is stated in a stanza widely attributed to Al Imam Ash Shafi‘i رحمه الله

“I complained to Sayyidunā Wakī (my teacher) of bad memory. He guided me to forsake sins. He informed me that knowledge is light and that the light of Allah is not granted to the sinner.”