From: Hugh Sasse Staff Elec Eng Date: 2002-07-25T00:47:40+09:00 Subject: Ruby Tk diagnostics I'm trying to write a simple program to allow us to get data off a machine which for some reason won't do ftp, but can do telnet. It hasn't got kermit either, and I can't find any free kermit implementations even for DOS I'm currently getting: [...] LE_ID C:/RUBY/lib/ruby/1.6/Tk.rb:980:in `_invoke': stack level too deep (SystemStackEr ror) from C:/RUBY/lib/ruby/1.6/Tk.rb:980:in `_invoke' from C:/RUBY/lib/ruby/1.6/Tk.rb:980:in `_invoke' from C:/RUBY/lib/ruby/1.6/Tk.rb:980:in `_invoke' from C:/RUBY/lib/ruby/1.6/Tk.rb:980:in `_invoke' from C:/RUBY/lib/ruby/1.6/Tk.rb:980:in `_invoke' from C:/RUBY/lib/ruby/1.6/Tk.rb:980:in `_invoke' from C:/RUBY/lib/ruby/1.6/Tk.rb:980:in `_invoke' from C:/RUBY/lib/ruby/1.6/Tk.rb:980:in `_invoke' ... 756 levels... from C:/RUBY/lib/ruby/1.6/tkentry.rb:6 from upload.rb:35:in `initialize' from upload.rb:55:in `new' from upload.rb:55 hgs@BUZZ ~ Which is what I can see in cygwin. cygwin, well my version, doesn't have script so I can't capture the whole output, the rest has scrolled away. The script is #!/usr/local/bin/ruby # A program to allow the transmission of a file inband. require 'net/telnet' require "Tk" class Upload def do_connection() tn = Net::Telnet.new("Host" => @host) tn.login(@user, @password) fp = open(file, "r") { tn.print(%Q{cat | ruby -pe '$_.unpack("m")' > #{outfile}}) fp.readlines.each { |line| tn.print "#{[line].pack('m')}\n" } tn.print "\004\n" sleep 1 tn.print "exit\n" } end def initialize() # initilize varaibles @host = TkVariable.new() @user = TkVariable.new() @passwd = TkVariable.new() @file = TkVariable.new() p = proc { } root = TkRoot.new { title "Upload" } top = TkFrame.new(root) TkLabel.new(top) {text 'Remote Host:' } @host_entry = TkEntry.new(top, 'textvariable' => @host) @host_entry.pack TkLabel.new(top) {text 'Username:' } @user_entry = TkEntry.new(top, 'textvariable' => @user) @user_entry.pack TkLabel.new(top) {text 'password:' } @pass_entry = TkEntry.new(top, 'textvariable' => @passwd, 'show' => '*') @pass_entry.pack TkLabel.new(top) {text 'File to send:' } @file_entry = TkEntry.new(top, 'textvariable' => @file) @file_entry.pack TkButton.new(top) {text 'Pig It'; command p } TkButton.new(top) {text 'Exit'; command {proc exit}} top.pack end end Upload.new() Tk.mainloop So there is nothing in proc p at the moment, but still. I can't see anything wrong with 35. Anyone any idea why this is failing? I've done work in tk before, but not with ruby and tk. Hugh