Search code examples
pythondirectorypython-imaging-library

Where does PIL.Image.open() search for image when only the filename is given?


I need to make a variation of chess game where people can download it on python but i need images now. (Also something very surprising is that the directory shown in File Explorer is sometimes different than the directory in pycharm)

I tried putting them beside venv but it didn't work. I also tried in Scripts but i didn't work either.


Solution

  • It looks in the current directory. You can see where that is by running this:

    import os
    print(f'Current directory: {os.getcwd()}')