'PyCharm how to get os.mkdir to work properly

When I run the code in terminal outside PyCharm's IDE:

    directory = "./exports./images"

    if not os.path.isdir(directory):
        os.mkdir(directory)

    with open(os.path.join(directory, "test"), "wb") as f:
        f.write(b"\xff")

It works perfectly fine; however, when running it in PyCharm, it gives FileNotFoundError. When running this in PyCharm:

    directory = "./exports"

    if not os.path.isdir(directory):
        os.mkdir(directory)

    with open(os.path.join(directory, "test"), "wb") as f:
        f.write(b"\xff")

It works perfectly fine. Why does the first one not work in PyCharm, and the second one does? And why does the first one work outside of PyCharm?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source