Zee
Zee

Reputation: 1

Python file error while running the file, no helpful feedback from the terminal as well. Any idea what this means?

The code is absolutely correct, here is the link to the repository from where I cloned it: https://github.com/nft-fun/generate-bitbirds.

I did not use the in-built vs code one-it was having some other issues, used other but already activated using conda init beforehand

The only prerequisite was to install the dependencies and so I did. After doing that I activated the base conda env then run the py script, and this is what it shows.

C:\Users\Zee\Documents\NFT_Tests\generate-bitbirds (main -> origin)
(base) λ python bitbird_generation_script.py
Traceback (most recent call last):
  File "bitbird_generation_script.py", line 244, in <module>
   new_image.save(imgname)
File "C:\Users\Zee\anaconda3\lib\site-packages\PIL\Image.py", line 2232, in save
   fp = builtins.open(filename, "w+b")
FileNotFoundError: [Errno 2] No such file or directory: '/bird_images/0.png'

Any insights would be helpful :)

Upvotes: 0

Views: 73

Answers (1)

DavidK
DavidK

Reputation: 2564

You have to find out what is the issue.

Inside the script, check the value of dirname = os.path.dirname(__file__).

The error you encounter seems to be that dirname is the empty string and so the images are trying to get saved in /bird_images which does not exist.

It should try to save the images in the local directory ./bird_images/

You could try :

On Linux :

PYTHONPATH=. python bitbird_generation_script.py

On Windows:

set PYTHONPATH=.
python bitbird_generation_script.py

Upvotes: 1

Related Questions