Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

map': undefined method name' #1

Open
jefsev opened this issue Nov 24, 2021 · 12 comments
Open

map': undefined method name' #1

jefsev opened this issue Nov 24, 2021 · 12 comments

Comments

@jefsev
Copy link

jefsev commented Nov 24, 2021

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
Copy link
Collaborator

AndyObtiva commented Nov 24, 2021

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
Copy link
Collaborator

AndyObtiva commented Nov 24, 2021

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
Copy link
Collaborator

AndyObtiva commented Nov 24, 2021

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
Copy link
Collaborator

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
Copy link
Collaborator

AndyObtiva commented Nov 24, 2021

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
Copy link
Author

jefsev commented Nov 25, 2021

@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:in tk_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: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: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:in synchronize' 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:in instance_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:in image_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:in interpret' 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: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: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:in interpret' 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:in block 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: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: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:in block (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: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: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: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:65:in block (2 levels) in class:Engine'
from app/cryptopunks_gui.rb:33:in create_gui' from app/cryptopunks_gui.rb:24:in initialize'
from app/cryptopunks_gui.rb:44:in new' from app/cryptopunks_gui.rb:44:in

'`

Looking forward to using the GUI.

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

@jefsev
Copy link
Author

jefsev commented Nov 25, 2021

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
Copy link
Collaborator

AndyObtiva commented Nov 25, 2021

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
Copy link
Author

jefsev commented Nov 26, 2021

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

@Focinfi
Copy link

Focinfi commented Dec 28, 2021

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
Copy link
Collaborator

AndyObtiva commented Dec 28, 2021

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:

  • Install the ActiveTcl 8.6 Mac package from ActiveState.com
  • Install RVM by running \curl -sSL https://get.rvm.io | bash -s stable (and run curl -sSL https://rvm.io/pkuczynski.asc | gpg --import - if needed for mentioned security reasons)
  • Run: rvm install 3.0.2 --enable-shared --enable-pthread --with-tk --with-tcl
  • Run: gem install tk -v0.4.0

Windows:

  • Install Ruby+Devkit (including MSYS/MINGW toolchains) through Windows Installer: https://rubyinstaller.org/downloads/
  • Install the ActiveTcl 8.6 Windows package from ActiveState.com
  • Follow this instruction: "First, Ruby needs to find the tcl86t.dll and tk86t.dll shared libraries. These are located in C:\ActiveTcl\bin. Make a copy of them somewhere Ruby can find them, e.g. C:\Ruby26\bin."
  • Setup environment variables TCL_LIBRARY=C:\ActiveTcl\lib\tcl8.6 & TK_LIBRARY=C:\ActiveTcl\lib\tk8.6
  • Run: gem install tk -v0.4.0

Linux:

  • Download the ActiveTcl 8.6 Linux package from ActiveState.com
  • Extract the tar gz file using command tar zxvf ActiveTcl-version-number.tar.gz
  • Run included install shell script ./ActiveTcl-version-number/install.sh
  • Install RVM by running \curl -sSL https://get.rvm.io | bash -s stable (and run curl -sSL https://rvm.io/pkuczynski.asc | gpg --import - if needed for mentioned security reasons)
  • Run: rvm install 3.0.2 --enable-shared --enable-pthread --with-tk --with-tcl
  • Run: gem install tk -v0.4.0

@centralcybersecurity
Copy link

Hi, is this resolved?

cryptopunks.tech

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@AndyObtiva @Focinfi @centralcybersecurity @jefsev and others