0

I'm trying to create some Images for characters and name them with that character. this is my char list:

letters=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z",":",",",
     ".","1","2","3","4","5","6","7","8","9","0","-","_","=","+","`","~","[","]","{","}","<",">","&","*","^",",","|",
     "/","@","#","$","%","(",")",";",":","'","."]

It's ok till it arrives to "." and it throw this error:

IsADirectoryError: [Errno 21] Is a directory: '.'

this is my code for create this pngs:

for x in letters:
    print("create " + x)
    txtImg = Image.new('RGB', (200, 100), (255,255,255))
    d = ImageDraw.Draw(txtImg)
    d.text((20, 20), x, fill=(0, 0, 0))
    s = io.BytesIO()
    txtImg.save(str(x),"png")

how can I solve that?

Alora
  • 761
  • 1
  • 5
  • 12
  • '.' and '..' is a special https://stackoverflow.com/questions/23242004/what-is-double-dot-and-single-dot-in-linux – Xianzhi Xia May 15 '22 at 08:42

1 Answers1

0

You can not use '.' or '..' as a filename on Unix-like operating systems in any directory, it is used alreay. '.' represents the directory you are in and '..' represents the parent directory, you can see more deails at What is double dot(..) and single dot(.) in Linux?

Xianzhi Xia
  • 146
  • 2
  • yes I know but is there any way to do this? like changing character to assci code or some thing like this? – Alora May 25 '22 at 08:08