A
A
anijack2021-04-10 14:27:06
PyCharm
anijack, 2021-04-10 14:27:06

Why do different code editors treat paths differently?

I open the project in pycharm, everything works fine: I open the same project in visualcode, it gives an error:
Image.open('test_images/pfdVxnWc1ww.jpg')

File "C:\Users\user\anaconda3\lib\site-packages\PIL\Image.py", line 2809, in open
    fp = builtins.open(filename, "rb")
FileNotFoundError: [Errno 2] No such file or directory: 'test_images/pfdVxnWc1ww.jpg'


The project structure is as follows:
main_dir:
  • script.py
  • test_images
    • pfdVxnWc1ww.jpg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dmshar, 2021-04-10
@anijackich

First, neither pycharm nor visualcode are editors. It's an IDE. And when working IN EACH of them, you need to configure the environment and the working directory. Start with the last one - setting up the working directory. Or explicitly specify the full path to your object.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question