Jon-Becker / nft-generator-py

This tool allows users to generate sets of unique images and metadata using weighted layer collections.
MIT License
304 stars 127 forks source link

Invalid syntax in index.py file #20

Closed nickgag626 closed 2 years ago

nickgag626 commented 2 years ago

Syntax errors detected :

Line 67: layers[index] = Image.open(f'{config["layers"][index]["trait_path"]}/{trait_files[attr][item[attr]]}.png').convert('RGBA') ^ SyntaxError: invalid syntax

Any idea how to resolve? Thanks

Jon-Becker commented 2 years ago

Did you edit the main index.py file? What version of python are you running?

Please send me your code via email at jonathan@jbecker.dev so I can debug it for you.

nickgag626 commented 2 years ago

Thanks! Sending over now.

Jon-Becker commented 2 years ago

Code fixed, you were missing a closing bracket on line 118.

generate_unique_images(159, {
  "layers": [
    {
      "name": "Background",
      "values": ["Gen 3"],
      "trait_path": "./trait-layers/Background",
      "filename": ["Gen 3"],
      "weights": [100]
    },
    {
      "name": "Skin",
      "values": ["Black and White", "Black", "Brown", "Cosmic", "Glitter", "Gold", "Gray", "Leopard", "Monster", "White", "Zebra"],
      "trait_path": "./trait-layers/Skin",
      "filename": ["Black and White.png", "Black.png", "Brown.png", "Cosmic.png", "Glitter.png", "Gold.png", "Gray.png", "Leopard.png", "Monster.png", "White.png", "Zebra.png"],
      "weights": [15.7, 14.4, 12.5, 18.2, 7.5, 5.6, 17, 2.5, 3.7, 1.9, 1]
    },
  ],

  "baseURI": ".",
  "name": "NFT #",
  "description": "This is a description for this NFT series."
})

Feel free to close this if you don't need more help. Thank you!

Jon-Becker commented 2 years ago

What python version? I noticed a file name with spaces in it. Does removing the spaces fix it?

stoplion commented 2 years ago

Getting the same error. Is there a specific Python version needed?