cryptopunksnotdead / cryptopunks

(crypto) pixel punks - libraries, tools & scripts, and more
Creative Commons Zero v1.0 Universal
40 stars 7 forks source link

`map': undefined method `name' #1

Open jefsev opened 2 years ago

jefsev commented 2 years ago

He,

I tried to fix it myself but i'm not very proficient in Ruby

When i run ruby app/cryptopunks_gui.rb i get he following error: /Users/jefsev/Local Sites/NFT-generator/CryptoPunkGUI/cryptopunks/app/model/image.rb:4:inmap': undefined method name' for :BLUE_STOPS:Symbol (NoMethodError) Let me know if i am doing something wrong and how i could fix this.

Thx!

AndyObtiva commented 2 years ago

Thank you for reporting this. I will look into it right away. Would you mind sharing your platform too? (e.g. Mac Catalina or Windows 10).

Also, do you know what version of Ruby are you running? (you can run ruby -v on the command line terminal to find out)

One last question is are you running the project by installing the gem or by cloning? If by cloning, did you perhaps forget to run bundle first?

AndyObtiva commented 2 years ago

OK, I tested on the Mac (Catalina) by installing the gem and by starting with a cloned project from scratch, and both modes worked.

I will look into testing on Linux next (in case you are running on Linux).

AndyObtiva commented 2 years ago

I just tested on Ubuntu Linux 21 and had no issues either (both gem and repository modes).

I will need more info from you regarding my questions above to help you further.

AndyObtiva commented 2 years ago

OK, I found the issue by running an older version of Ruby (2.7.2).

2.7.2 :001 > :hello.name
Traceback (most recent call last):
        4: from /Users/andymaleh/.rvm/rubies/ruby-2.7.2/bin/irb:23:in `<main>'
        3: from /Users/andymaleh/.rvm/rubies/ruby-2.7.2/bin/irb:23:in `load'
        2: from /Users/andymaleh/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/irb-1.2.6/exe/irb:11:in `<top (required)>'
        1: from (irb):1
NoMethodError (undefined method `name' for :hello:Symbol)

The project clearly states it requires Ruby 3.0.2 to run. Please upgrade your Ruby installation to Ruby 3.0.2

The easiest way to do so is through RVM: https://rvm.io/

AndyObtiva commented 2 years ago

Good news! I just fixed compatibility with older Ruby versions down to 2.7.2 (and perhaps lower too).

I released the fix in version 0.0.13

Please give it a try and let me know if it works (you shouldn't have to upgrade Ruby anymore).

Cheers.

jefsev commented 2 years ago

@AndyObtiva Thx for the quick reply! I was running 2.6.x which i updated to 3.0.2 which solved this issue.

But now when i run i get the following error: `jefsev@Jeffrey cryptopunks-gui % sudo ruby app/cryptopunks_gui.rb pixelart/1.2.1 on Ruby 3.0.2 (2021-07-07) [x86_64-darwin19] in (/Users/jefsev/.rvm/rubies/ruby-3.0.2/lib/ruby/gems/3.0.0/gems/pixelart-1.2.1) cryptopunks/2.0.1 on Ruby 3.0.2 (2021-07-07) [x86_64-darwin19] in (/Users/jefsev/.rvm/rubies/ruby-3.0.2/lib/ruby/gems/3.0.0/gems/cryptopunks-2.0.1)

ac39af4793119ee46bbff351d8cb6b5f23da60222126add4268e261199a2921b< SHA256 hash matching ✓ True Official Genuine CryptoPunks™ verified 2400x2400 (height x width) /Users/jefsev/.rvm/rubies/ruby-3.0.2/lib/ruby/gems/3.0.0/gems/tk-0.4.0/lib/tk.rb:1981:in _invoke': couldn't recognize data in image file "/Users/jefsev/Local Sites/NFT-generator/CryptoPunkGUI/cryptopunkGui/cryptopunks-gui/icons/cryptopunks-gui.png" (RuntimeError) from /Users/jefsev/.rvm/rubies/ruby-3.0.2/lib/ruby/gems/3.0.0/gems/tk-0.4.0/lib/tk.rb:1981:in_ip_invoke_core' from /Users/jefsev/.rvm/rubies/ruby-3.0.2/lib/ruby/gems/3.0.0/gems/tk-0.4.0/lib/tk.rb:2016:in _tk_call_core' from /Users/jefsev/.rvm/rubies/ruby-3.0.2/lib/ruby/gems/3.0.0/gems/tk-0.4.0/lib/tk.rb:2043:intk_call_without_enc' from /Users/jefsev/.rvm/rubies/ruby-3.0.2/lib/ruby/gems/3.0.0/gems/tk-0.4.0/lib/tk/image.rb:81:in initialize' from /Users/jefsev/.rvm/rubies/ruby-3.0.2/lib/ruby/gems/3.0.0/gems/tk-0.4.0/lib/tk/image.rb:192:ininitialize' from /Users/jefsev/.rvm/rubies/ruby-3.0.2/lib/ruby/gems/3.0.0/gems/tk-0.4.0/lib/tk/image.rb:59:in block (2 levels) in new' from /Users/jefsev/.rvm/rubies/ruby-3.0.2/lib/ruby/gems/3.0.0/gems/tk-0.4.0/lib/tk/image.rb:58:insynchronize' from /Users/jefsev/.rvm/rubies/ruby-3.0.2/lib/ruby/gems/3.0.0/gems/tk-0.4.0/lib/tk/image.rb:58:in block in new' from /Users/jefsev/.rvm/rubies/ruby-3.0.2/lib/ruby/gems/3.0.0/gems/tk-0.4.0/lib/tk/image.rb:57:ininstance_eval' from /Users/jefsev/.rvm/rubies/ruby-3.0.2/lib/ruby/gems/3.0.0/gems/tk-0.4.0/lib/tk/image.rb:57:in new' from /Users/jefsev/.rvm/rubies/ruby-3.0.2/lib/ruby/gems/3.0.0/gems/glimmer-dsl-tk-0.0.47/lib/glimmer/tk/widget_proxy.rb:449:inimage_argument' from /Users/jefsev/.rvm/rubies/ruby-3.0.2/lib/ruby/gems/3.0.0/gems/glimmer-dsl-tk-0.0.47/lib/glimmer/tk/toplevel_proxy.rb:56:in set_attribute' from /Users/jefsev/.rvm/rubies/ruby-3.0.2/lib/ruby/gems/3.0.0/gems/glimmer-dsl-tk-0.0.47/lib/glimmer/dsl/tk/attribute_expression.rb:37:ininterpret' from /Users/jefsev/.rvm/rubies/ruby-3.0.2/lib/ruby/gems/3.0.0/gems/glimmer-2.5.1/lib/glimmer/dsl/engine.rb:181:in block in interpret_expression' from /Users/jefsev/.rvm/rubies/ruby-3.0.2/lib/ruby/gems/3.0.0/gems/glimmer-2.5.1/lib/glimmer/dsl/expression.rb:64:inaround' from /Users/jefsev/.rvm/rubies/ruby-3.0.2/lib/ruby/gems/3.0.0/gems/glimmer-2.5.1/lib/glimmer/dsl/engine.rb:180:in interpret_expression' from /Users/jefsev/.rvm/rubies/ruby-3.0.2/lib/ruby/gems/3.0.0/gems/glimmer-2.5.1/lib/glimmer/dsl/engine.rb:175:ininterpret' from /Users/jefsev/.rvm/rubies/ruby-3.0.2/lib/ruby/gems/3.0.0/gems/glimmer-2.5.1/lib/glimmer.rb:78:in method_missing' from app/cryptopunks_gui.rb:35:inblock in create_gui' from /Users/jefsev/.rvm/rubies/ruby-3.0.2/lib/ruby/gems/3.0.0/gems/glimmer-2.5.1/lib/glimmer/dsl/parent_expression.rb:32:in add_content' from /Users/jefsev/.rvm/rubies/ruby-3.0.2/lib/ruby/gems/3.0.0/gems/glimmer-dsl-tk-0.0.47/lib/glimmer/dsl/tk/root_expression.rb:45:inadd_content' from /Users/jefsev/.rvm/rubies/ruby-3.0.2/lib/ruby/gems/3.0.0/gems/glimmer-2.5.1/lib/glimmer/dsl/engine.rb:199:in add_content' from /Users/jefsev/.rvm/rubies/ruby-3.0.2/lib/ruby/gems/3.0.0/gems/glimmer-2.5.1/lib/glimmer/dsl/engine.rb:182:inblock (2 levels) in interpret_expression' from /Users/jefsev/.rvm/rubies/ruby-3.0.2/lib/ruby/gems/3.0.0/gems/facets-3.1.0/lib/core/facets/kernel/tap.rb:19:in tap' from /Users/jefsev/.rvm/rubies/ruby-3.0.2/lib/ruby/gems/3.0.0/gems/glimmer-2.5.1/lib/glimmer/dsl/engine.rb:181:inblock in interpret_expression' from /Users/jefsev/.rvm/rubies/ruby-3.0.2/lib/ruby/gems/3.0.0/gems/glimmer-2.5.1/lib/glimmer/dsl/expression.rb:64:in around' from /Users/jefsev/.rvm/rubies/ruby-3.0.2/lib/ruby/gems/3.0.0/gems/glimmer-2.5.1/lib/glimmer/dsl/engine.rb:180:ininterpret_expression' from /Users/jefsev/.rvm/rubies/ruby-3.0.2/lib/ruby/gems/3.0.0/gems/glimmer-2.5.1/lib/glimmer/dsl/engine.rb:65:in block (2 levels) in <class:Engine>' from app/cryptopunks_gui.rb:33:increate_gui' from app/cryptopunks_gui.rb:24:in initialize' from app/cryptopunks_gui.rb:44:innew' from app/cryptopunks_gui.rb:44:in <main>'

Looking forward to using the GUI.

If i can buy you a coffe im happy to donate some.

jefsev commented 2 years ago

Looks like something with the tk library: /Users/jefsev/.rvm/rubies/ruby-3.0.2/lib/ruby/gems/3.0.0/gems/tk-0.4.0/lib/tk.rb:1981:in _invoke': couldn't recognize data in image file "/Users/jefsev/Local Sites/NFT-generator/CryptoPunkGUI/cryptopunkGui/cryptopunks-gui/icons/cryptopunks-gui.png" (RuntimeError)

AndyObtiva commented 2 years ago

The error is surprising. I don't get it.

You didn't tell me what platform you are running on yet. I assume you are on a Mac. If so, which Mac version? Catalina, Big Sur, Monterey, or another?

Could you also please confirm for me that you have a recent version of ActiveTcl like 8.6.9 ?

It looks like the Tk library is unable to load the image: /Users/jefsev/Local Sites/NFT-generator/CryptoPunkGUI/cryptopunkGui/cryptopunks-gui/icons/cryptopunks-gui.png

See if you can open the file yourself successfully just to make sure it is there. It has the logo of CryptoPunks GUI:

logo

If the image works fine, then perhaps there is an issue in the code that is interacting with Tk.

In that case, open this file: /Users/jefsev/.rvm/rubies/ruby-3.0.2/lib/ruby/gems/3.0.0/gems/glimmer-dsl-tk-0.0.47/lib/glimmer/tk/widget_proxy.rb

Go to line 449, specifically:

the_image = ::TkPhotoImage.new(image_args)

Add require 'pd'; pd image_args; pd in front of it to have it print out image information:

require 'pd'; pd image_args; pd the_image = ::TkPhotoImage.new(image_args)

Save the file, and re-run cryptopunks-gui

You should see output like this:

[PD] /Ruby30-x64/lib/ruby/gems/3.0.0/gems/glimmer-dsl-tk-0.0.47/lib/glimmer/tk/widget_proxy.rb:449
   > require 'pd'; pd image_args; pd the_image = ::TkPhotoImage.new(image_args)
  => {
    :file => "C:/Users/a_mal/code/cryptopunks-gui/icons/cryptopunks-gui.png"
}
[PD] /Ruby30-x64/lib/ruby/gems/3.0.0/gems/glimmer-dsl-tk-0.0.47/lib/glimmer/tk/widget_proxy.rb:449
   > require 'pd'; pd image_args; pd the_image = ::TkPhotoImage.new(image_args)
  => #<TkPhotoImage:0x000002a85fc82e90 @type="photo", @path="i00000">

Please share output with me. It might have a clue to what is going wrong.

jefsev commented 2 years ago

He, thx! im going to try this today. Ill let you know what happens. Running mac Cataline 10.15.7

Focinfi commented 2 years ago

Similar Issue

Mac Cataline 10.15.7 ActiveTcl-8.5

pixelart/1.2.1 on Ruby 3.0.2 (2021-07-07) [x86_64-darwin19] in (/Users/wangtao/.rvm/gems/ruby-3.0.2/gems/pixelart-1.2.1)
cryptopunks/2.0.1 on Ruby 3.0.2 (2021-07-07) [x86_64-darwin19] in (/Users/wangtao/.rvm/gems/ruby-3.0.2/gems/cryptopunks-2.0.1)
     >ac39af4793119ee46bbff351d8cb6b5f23da60222126add4268e261199a2921b< SHA256 hash matching
         ✓ True Official Genuine CryptoPunks™ verified
     2400x2400 (height x width)
/Users/wangtao/.rvm/gems/ruby-3.0.2/gems/tk-0.4.0/lib/tk.rb:1981:in `_invoke': couldn't recognize data in image file "/Users/wangtao/.rvm/gems/ruby-3.0.2/gems/cryptopunks-gui-0.0.15/icons/cryptopunks-gui.png" (RuntimeError)
    from /Users/wangtao/.rvm/gems/ruby-3.0.2/gems/tk-0.4.0/lib/tk.rb:1981:in `_ip_invoke_core'
    from /Users/wangtao/.rvm/gems/ruby-3.0.2/gems/tk-0.4.0/lib/tk.rb:2016:in `_tk_call_core'
    from /Users/wangtao/.rvm/gems/ruby-3.0.2/gems/tk-0.4.0/lib/tk.rb:2043:in `tk_call_without_enc'
    from /Users/wangtao/.rvm/gems/ruby-3.0.2/gems/tk-0.4.0/lib/tk/image.rb:81:in `initialize'
    from /Users/wangtao/.rvm/gems/ruby-3.0.2/gems/tk-0.4.0/lib/tk/image.rb:192:in `initialize'
    from /Users/wangtao/.rvm/gems/ruby-3.0.2/gems/tk-0.4.0/lib/tk/image.rb:59:in `block (2 levels) in new'
    from /Users/wangtao/.rvm/gems/ruby-3.0.2/gems/tk-0.4.0/lib/tk/image.rb:58:in `synchronize'
    from /Users/wangtao/.rvm/gems/ruby-3.0.2/gems/tk-0.4.0/lib/tk/image.rb:58:in `block in new'
    from /Users/wangtao/.rvm/gems/ruby-3.0.2/gems/tk-0.4.0/lib/tk/image.rb:57:in `instance_eval'
    from /Users/wangtao/.rvm/gems/ruby-3.0.2/gems/tk-0.4.0/lib/tk/image.rb:57:in `new'
    from /Users/wangtao/.rvm/gems/ruby-3.0.2/gems/glimmer-dsl-tk-0.0.49/lib/glimmer/tk/widget_proxy.rb:449:in `image_argument'
    from /Users/wangtao/.rvm/gems/ruby-3.0.2/gems/glimmer-dsl-tk-0.0.49/lib/glimmer/tk/toplevel_proxy.rb:56:in `set_attribute'
    from /Users/wangtao/.rvm/gems/ruby-3.0.2/gems/glimmer-dsl-tk-0.0.49/lib/glimmer/dsl/tk/attribute_expression.rb:37:in `interpret'
    from /Users/wangtao/.rvm/gems/ruby-3.0.2/gems/glimmer-2.5.4/lib/glimmer/dsl/engine.rb:181:in `block in interpret_expression'
    from /Users/wangtao/.rvm/gems/ruby-3.0.2/gems/glimmer-2.5.4/lib/glimmer/dsl/expression.rb:64:in `around'
    from /Users/wangtao/.rvm/gems/ruby-3.0.2/gems/glimmer-2.5.4/lib/glimmer/dsl/engine.rb:180:in `interpret_expression'
    from /Users/wangtao/.rvm/gems/ruby-3.0.2/gems/glimmer-2.5.4/lib/glimmer/dsl/engine.rb:175:in `interpret'
    from /Users/wangtao/.rvm/gems/ruby-3.0.2/gems/glimmer-2.5.4/lib/glimmer.rb:78:in `method_missing'
    from /Users/wangtao/.rvm/gems/ruby-3.0.2/gems/cryptopunks-gui-0.0.15/app/cryptopunks_gui.rb:35:in `block in create_gui'
    from /Users/wangtao/.rvm/gems/ruby-3.0.2/gems/glimmer-2.5.4/lib/glimmer/dsl/parent_expression.rb:32:in `add_content'
    from /Users/wangtao/.rvm/gems/ruby-3.0.2/gems/glimmer-dsl-tk-0.0.49/lib/glimmer/dsl/tk/root_expression.rb:45:in `add_content'
    from /Users/wangtao/.rvm/gems/ruby-3.0.2/gems/glimmer-2.5.4/lib/glimmer/dsl/engine.rb:199:in `add_content'
    from /Users/wangtao/.rvm/gems/ruby-3.0.2/gems/glimmer-2.5.4/lib/glimmer/dsl/engine.rb:182:in `block (2 levels) in interpret_expression'
    from /Users/wangtao/.rvm/gems/ruby-3.0.2/gems/facets-3.1.0/lib/core/facets/kernel/tap.rb:19:in `tap'
    from /Users/wangtao/.rvm/gems/ruby-3.0.2/gems/glimmer-2.5.4/lib/glimmer/dsl/engine.rb:181:in `block in interpret_expression'
    from /Users/wangtao/.rvm/gems/ruby-3.0.2/gems/glimmer-2.5.4/lib/glimmer/dsl/expression.rb:64:in `around'
    from /Users/wangtao/.rvm/gems/ruby-3.0.2/gems/glimmer-2.5.4/lib/glimmer/dsl/engine.rb:180:in `interpret_expression'
    from /Users/wangtao/.rvm/gems/ruby-3.0.2/gems/glimmer-2.5.4/lib/glimmer/dsl/engine.rb:65:in `block (2 levels) in <class:Engine>'
    from /Users/wangtao/.rvm/gems/ruby-3.0.2/gems/cryptopunks-gui-0.0.15/app/cryptopunks_gui.rb:33:in `create_gui'
    from /Users/wangtao/.rvm/gems/ruby-3.0.2/gems/cryptopunks-gui-0.0.15/app/cryptopunks_gui.rb:24:in `initialize'
    from /Users/wangtao/.rvm/gems/ruby-3.0.2/gems/cryptopunks-gui-0.0.15/app/cryptopunks_gui.rb:44:in `new'
    from /Users/wangtao/.rvm/gems/ruby-3.0.2/gems/cryptopunks-gui-0.0.15/app/cryptopunks_gui.rb:44:in `<top (required)>'
    from /Users/wangtao/.rvm/gems/ruby-3.0.2/gems/cryptopunks-gui-0.0.15/bin/cryptopunks-gui:3:in `require_relative'
    from /Users/wangtao/.rvm/gems/ruby-3.0.2/gems/cryptopunks-gui-0.0.15/bin/cryptopunks-gui:3:in `<top (required)>'
    from /Users/wangtao/.rvm/gems/ruby-3.0.2/bin/cryptopunks-gui:23:in `load'
    from /Users/wangtao/.rvm/gems/ruby-3.0.2/bin/cryptopunks-gui:23:in `<main>'
AndyObtiva commented 2 years ago

ActiveTcl 8.5 is old! I just updated the README with a specific version for ActiveTcl: 8.6. For example, I am running ActiveTcl version 8.6.9 successfully.

I also added more detailed prerequisite install instructions:

Mac:

Windows:

Linux:

centralcybersecurity commented 2 weeks ago

Hi, is this resolved?

cryptopunks.tech