Forum: Ruby Help with tkHTML (specifically, require 'tkextlib/tkHTML' fa

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F5b3c1ebfb2e9fc5f67bb48b119f6054?d=identicon&s=25 Randy Kramer (Guest)
on 2006-03-25 22:01
(Received via mailing list)
(Ruby 1.8.4 on Mandriva2006)

I need some help with tkHTML.  The current problem is that, if I try to
follow
this example (from
http://groups.google.com/group/comp.lang.ruby/msg/... ):

 require 'tk'
 require 'tkextlib/tkHTML'

.. read a HTML-doc, and set it to the variable 'doc' ...

hv = Tk::HTML_Widget.new.pack
 hv.parse(doc)

It fails at the step =require 'tkextlib/tkHTML'= with a message:

RuntimeError: TkPackage can't find package Tkhtml
        from /usr/local/lib/ruby/1.8/tk/package.rb:86:in `require'
        from /usr/local/lib/ruby/1.8/tkextlib/tkHTML/htmlwidget.rb:15
        from /usr/local/lib/ruby/1.8/tkextlib/tkHTML.rb:13
        from (irb):2

What I've done (generally):

I may have confused the issue, because I've downloaded and installed
both
ActiveTCL and the standalone ktHTML packages.  I installed the ktHTML
package
first, and tried the example before installing ActiveTCL, but got the
same
result.

At one point, from somewhere I got the hint that I should run the
setup.rb
files, so I found one in /usr/local/lib/ruby/1.8/tkextlib and another
in  /usr/local/lib/ruby/1.8/tkextlib/tkHTML.   They are not executable,
so I
ran them as ruby scripts, i.e. =ruby setup.rb= from the directory
containing
the files.  No improvement.

Some observations:

Directory /usr/local/lib/ruby/1.8/tkextlib contains, among other things:

tkHTML/    tkHTML.rb

Directory /usr/local/lib/ruby/1.8/tkextlib/tkHTML contains:

htmlwidget.rb  setup.rb

Line 13 in /usr/local/lib/ruby/1.8/tkextlib/tkHTML.rb is:

require 'tkextlib/tkHTML/htmlwidget'

Any hints?

Randy Kramer
E34b5cae57e0dd170114dba444e37852?d=identicon&s=25 Logan Capaldo (Guest)
on 2006-03-25 22:14
(Received via mailing list)
On Mar 25, 2006, at 4:01 PM, Randy Kramer wrote:

> At one point, from somewhere I got the hint that I should run the
> setup.rb
> files, so I found one in /usr/local/lib/ruby/1.8/tkextlib and another
> in  /usr/local/lib/ruby/1.8/tkextlib/tkHTML.   They are not
> executable, so I
> ran them as ruby scripts, i.e. =ruby setup.rb= from the directory
> containing
> the files.  No improvement.

Did you try:

sudo ruby setup.rb install

?
F5b3c1ebfb2e9fc5f67bb48b119f6054?d=identicon&s=25 Randy Kramer (Guest)
on 2006-03-25 23:02
(Received via mailing list)
On Saturday 25 March 2006 04:14 pm, Logan Capaldo wrote:
> Did you try:
>
> sudo ruby setup.rb install

Thanks for the response!

No, at least I hadn't.  I've now tried it, didn't solve the problem.  (I
ran
the setup in both tkextlib and tkHTML, and it now seems that the require
'tk'
statement returns true much sooner, but still the same problem with the
require 'tkextlib/tkHTML':

RuntimeError: TkPackage can't find package Tkhtml
        from /usr/local/lib/ruby/1.8/tk/package.rb:86:in `require'
        from /usr/local/lib/ruby/1.8/tkextlib/tkHTML/htmlwidget.rb:15
        from /usr/local/lib/ruby/1.8/tkextlib/tkHTML.rb:13
        from (irb):2

Do you have tkHTML setup?  Do you recall how you did it?

Randy Kramer
E34b5cae57e0dd170114dba444e37852?d=identicon&s=25 Logan Capaldo (Guest)
on 2006-03-26 04:50
(Received via mailing list)
On Mar 25, 2006, at 5:01 PM, Randy Kramer wrote:

> require 'tk'
> Do you have tkHTML setup?  Do you recall how you did it?
>
> Randy Kramer
>
>
>

Can't say that I do, I just  have slightly more experience with
setting things up with setup.rb apparently ;)

It looks like the ruby files are there, but the Tcl/Tk files are
missing (or  unable to be found).
F5b3c1ebfb2e9fc5f67bb48b119f6054?d=identicon&s=25 Randy Kramer (Guest)
on 2006-03-26 21:35
(Received via mailing list)
On Saturday 25 March 2006 09:50 pm, Logan Capaldo wrote:
> On Mar 25, 2006, at 5:01 PM, Randy Kramer wrote:
> > still the same problem with the require 'tkextlib/tkHTML':
> >
> > RuntimeError: TkPackage can't find package Tkhtml
> >         from /usr/local/lib/ruby/1.8/tk/package.rb:86:in `require'
> >         from /usr/local/lib/ruby/1.8/tkextlib/tkHTML/htmlwidget.rb:15
> >         from /usr/local/lib/ruby/1.8/tkextlib/tkHTML.rb:13
> >         from (irb):2
> >
> > Do you have tkHTML setup?  Do you recall how you did it?

> Can't say that I do, I just  have slightly more experience with
> setting things up with setup.rb apparently ;)
>
> It looks like the ruby files are there, but the Tcl/Tk files are
> missing (or  unable to be found).

Thanks!  I'll have to think about the idea/possibility that the Tcl/Tk
files
are missing--I'm pretty sure tcl is installed:

[root@s14 python]# rpm -q  tcl
tcl-8.4.11-1mdk
[root@s14 doc]# rpm -V tcl-8.4.11-1mdk
[root@s14 doc]#

One reason for writing at the moment is that I noticed that a tkhtml.so
file
comes with (or can come with) the tkhtml package(s), and I haven't
installed
that anywhere.  Should I?  Where?  (Maybe those are the Tcl/Tk files
that are
missing??)

Randy Kramer
F5b3c1ebfb2e9fc5f67bb48b119f6054?d=identicon&s=25 Randy Kramer (Guest)
on 2006-03-26 22:05
(Received via mailing list)
On Sunday 26 March 2006 02:35 pm, Randy Kramer wrote:
> > > Do you have tkHTML setup?  Do you recall how you did it?
> [root@s14 python]# rpm -q  tcl
> tcl-8.4.11-1mdk
> [root@s14 doc]# rpm -V tcl-8.4.11-1mdk
> [root@s14 doc]#

PS: Another thing reinforcing my belief that the tk files are there is
that a
few days ago I ran a sample program that used tk--the program created a
stopwatch with a display in a tk "window".
E34b5cae57e0dd170114dba444e37852?d=identicon&s=25 Logan Capaldo (Guest)
on 2006-03-26 22:17
(Received via mailing list)
On Mar 26, 2006, at 3:05 PM, Randy Kramer wrote:

>>>>         from (irb):2
>> Tcl/Tk
> created a
>> Randy Kramer
>

I was thinking more along the lines of TkHTML specifically, not any
and all Tcl/Tk files. I would suggest that installing the tkhtml.so
file in its proper place should do the trick. Try and find a README
or INSTALL file in the source distribution.
E4f967492dbd03c526cc9b397e68021d?d=identicon&s=25 Hidetoshi NAGAI (Guest)
on 2006-03-27 04:58
(Received via mailing list)
From: Randy Kramer <rhkramer@gmail.com>
Subject: Help with tkHTML (specifically, require 'tkextlib/tkHTML' fails
to find package)
Date: Sun, 26 Mar 2006 06:01:44 +0900
Message-ID: <200603251600.10939.rhkramer@gmail.com>
> I may have confused the issue, because I've downloaded and installed both
> ActiveTCL and the standalone ktHTML packages.  I installed the ktHTML package
> first, and tried the example before installing ActiveTCL, but got the same
> result.

I think that your tcltklib.so doesn't load ActiveTcl library.
Please run "/usr/local/bin/ruby -r tk -e 'p Tk::TCL_LIBRARY'".
Probably, it shows the path your original (not ActiveTcl) Tcl/Tk
directory.

You may control the path with LD_LIBRARY_PATH or TCL_LIBRARY environment
variable. For example, "TCL_LIBRARY=/usr/local/ActiveTcl/lib/tcl8.4
/usr/local/bin/ruby -r tk -e 'p Tk::TCL_LIBRARY'".

You can get the support status of Tk extensions on your environment
by "/usr/local/lib/ruby/1.8/tkextlib/pkg_checker.rb".
Possibly, you get different result between
"/usr/local/bin/ruby /usr/local/lib/ruby/1.8/tkextlib/pkg_checker.rb"
and
"TCL_LIBRARY=/usr/local/ActiveTcl/lib/tcl8.4 /usr/local/bin/ruby
/usr/local/lib/ruby/1.8/tkextlib/pkg_checker.rb".
F5b3c1ebfb2e9fc5f67bb48b119f6054?d=identicon&s=25 Randy Kramer (Guest)
on 2006-03-27 17:38
(Received via mailing list)
Everyone: I'm still not there, any suggestions appreciated.

Hidetoshi NAGAI,

Thanks very much for your help so far!  As you can see (from the
comments
interspersed with yours, below) I'm probably out of my depth here, and I
don't want to waste a lot of your time.  Maybe I should delete
(uninstall)
Ruby, ActiveTCL, and the ktHTML packages and reinstall?

If I do that, I'd prefer not to reinstall ActiveTCL (just because of the
size
of it) and install only Ruby and the ktHTML package.  I can't
immediately
recall/find from where I downloaded the ktHTML package, there is no
version
number on the package, and the dates on the files are now (of course)
the
dates I downloaded the files, not the original dates.

The size of the tkhtml.tar.gz is 387987 bytes, and the first lines of
the
spec.html file are:

"This is a draft interface specification for the Tk HTML widget
currently
under development. Since it is still a draft, it is subject to change.
Eventually, the interface will stabilize and this interface
specification
will morph into a manual page."

My question is, is that the latest version, or is the version in
ActiveTCL
more up-to-date?

Below (interspersed with your suggestions) are the things I've tried and
the
results--perhaps you or somebody else can see what I've done wrong.
(Or, at
some time in the fairly near future, I'll uninstall Ruby, etc., and
start
again--it may be a week or two as I have some other things to deal with
in
the next week or so.)

On Sunday 26 March 2006 09:58 pm, Hidetoshi NAGAI wrote:
> I think that your tcltklib.so doesn't load ActiveTcl library.
> Please run "/usr/local/bin/ruby -r tk -e 'p Tk::TCL_LIBRARY'".
> Probably, it shows the path your original (not ActiveTcl) Tcl/Tk directory.

Yes, it shows "/usr/lib/tcl8.4"

> You may control the path with LD_LIBRARY_PATH or TCL_LIBRARY environment
> variable. For example, "TCL_LIBRARY=/usr/local/ActiveTcl/lib/tcl8.4
> /usr/local/bin/ruby -r tk -e 'p Tk::TCL_LIBRARY'".

That didn't seem to do anything the first time I tried it, now going
back to
try again and check various things:

   * I now see the following in my environment--is that what I should
see?

[rhk@s14 tkHTML]$ set | grep LIBRARY
_='p Tk::TCL_LIBRARY'

   * I installed ActiveTcl 8.5, so I believe the path I should use
is /usr/local/ActiveTcl/lib/tcl8.5.  It exists, and contains some .tcl
files
(e.g., auto.tcl) and subdirectories (e.g., opt0.4).

   * Now I run
[rhk@s14 tkHTML]$
TCL_LIBRARY=/usr/local/ActiveTcl/lib/tcl8.5 /usr/local/bin/ruby -r tk -e
'p
Tk::TCL_LIBRARY'

and get: "/usr/lib/tcl8.4" which looks the same as before.  Is that what
I
should get?

Earlier (on the first try) I tried running irb and got no better results
for
the require 'tclextlib/tkHTML' statement, but I now realize I should run
irb
something like this:

TCL_LIBRARY=/usr/local/ActiveTcl/lib/tcl8.5 /usr/local/bin/irb

Let's see how that works--nope, still the same problem:

[rhk@s14 rhk]$ TCL_LIBRARY=/usr/local/ActiveTcl/lib/tcl8.5
/usr/local/bin/irb
irb(main):001:0> require 'tk'
=> true
irb(main):002:0> require 'tkextlib/tkHTML'
RuntimeError: TkPackage can't find package Tkhtml
        from /usr/local/lib/ruby/1.8/tk/package.rb:86:in `require'
        from /usr/local/lib/ruby/1.8/tkextlib/tkHTML/htmlwidget.rb:15
        from /usr/local/lib/ruby/1.8/tkextlib/tkHTML.rb:13
        from (irb):2

> You can get the support status of Tk extensions on your environment
> by "/usr/local/lib/ruby/1.8/tkextlib/pkg_checker.rb".

That seems useful (now and in the future).  Among other things, I see:

*LACK : tkHTML.rb : require->{}
FAIL->[["tkextlib/tkHTML/htmlwidget", :require_ruby_lib]]
*LACK : tkHTML/htmlwidget.rb : require->{}  FAIL->[["Tkhtml", :package]]
Ready : tkHTML/setup.rb : require->{}

(And maybe half of the packages that scroll by are marked Ready and the
other
half marked LACK (just a guess).  I'm guessing that Ready means I'm good
to
go, and LACK means there is a problem.)

> Possibly, you get different result between
> "/usr/local/bin/ruby /usr/local/lib/ruby/1.8/tkextlib/pkg_checker.rb"
> and
> "TCL_LIBRARY=/usr/local/ActiveTcl/lib/tcl8.4 /usr/local/bin/ruby
> /usr/local/lib/ruby/1.8/tkextlib/pkg_checker.rb". --

Nope, they seem the same.

<My "notes", showing more detail--I think you can ignore these>
The results for tkHTML seem the same:

[rhk@s14 tkHTML]$
TCL_LIBRARY=/usr/local/ActiveTcl/lib/tcl8.5 /usr/local/bin/ruby
/usr/local/lib/ruby/1.8/tkextlib/pkg_checker.rb
| grep tkHTML
*LACK : tkHTML.rb : require->{}
FAIL->[["tkextlib/tkHTML/htmlwidget", :require_ruby_lib]]
*LACK : tkHTML/htmlwidget.rb : require->{}  FAIL->[["Tkhtml", :package]]
Ready : tkHTML/setup.rb : require->{}

[rhk@s14 tkHTML]$
TCL_LIBRARY=/usr/local/ActiveTcl/lib/tcl8.5 /usr/local/bin/ruby
/usr/local/lib/ruby/1.8/tkextlib/pkg_checker.rb
| wc
    253    1313   12046

[rhk@s14 tkHTML]$ /usr/local/lib/ruby/1.8/tkextlib/pkg_checker.rb | wc
    253    1313   12046
</My "notes", showing more detail--I think you can ignore these>

Ok, maybe because tkHTML/setup.rb is ready, I should try running that,
with
the TCL_LIBRARY path prefix:

[rhk@s14 tkHTML]$
TCL_LIBRARY=/usr/local/ActiveTcl/lib/tcl8.5 /usr/local/bin/ruby
/usr/local/lib/ruby/1.8/tkextlib/tkHTML/setup.rb

And then retry pkg_checker--no, no change in the output listed
previously
(with or without the TCL_LIBRARY prefix):

*LACK : tkHTML.rb : require->{}
FAIL->[["tkextlib/tkHTML/htmlwidget", :require_ruby_lib]]
*LACK : tkHTML/htmlwidget.rb : require->{}  FAIL->[["Tkhtml", :package]]
Ready : tkHTML/setup.rb : require->{}

Randy Kramer
F5b3c1ebfb2e9fc5f67bb48b119f6054?d=identicon&s=25 Randy Kramer (Guest)
on 2006-03-27 17:48
(Received via mailing list)
On Monday 27 March 2006 10:37 am, Randy Kramer wrote:
> If I do that, I'd prefer not to reinstall ActiveTCL (just because of the
> size of it) and install only Ruby and the ktHTML package.  I can't
> immediately recall/find from where I downloaded the ktHTML package, there
> is no version number on the package, and the dates on the files are now (of
> course) the dates I downloaded the files, not the original dates.

Ok, I just found the page where I downloaded the ktHTML packages from:

http://www.hwaci.com/sw/tkhtml/download.html:

"TkHtml Download Page
Last update: Mon Jul 31 06:34:47 EDT 2000"

"tkhtml.tar.gz
 Description: A tarball containing all the latest source code
 Size: 387987 bytes
 Last modified: Tue Jun 20 20:47:11 EDT 2000"

It looks rather old--I should probably look for something more
up-to-date--are
the only options the ActiveTCL package or CVS?

Randy Kramer
E4f967492dbd03c526cc9b397e68021d?d=identicon&s=25 Hidetoshi NAGAI (Guest)
on 2006-03-27 18:46
(Received via mailing list)
From: Randy Kramer <rhkramer@gmail.com>
Subject: Re: Help with tkHTML (specifically, require 'tkextlib/tkHTML'
fails to find package)
Date: Tue, 28 Mar 2006 00:38:39 +0900
Message-ID: <200603271037.56960.rhkramer@gmail.com>
> Thanks very much for your help so far!  As you can see (from the comments
> interspersed with yours, below) I'm probably out of my depth here, and I
> don't want to waste a lot of your time.  Maybe I should delete (uninstall)
> Ruby, ActiveTCL, and the ktHTML packages and reinstall?

Maybe you need recompile and install tcltklib.so to use ActiveTcl
libraries by default.
If you want to recompile it, prease read README.* files in
"<ruby source>/ext/tk" directory.

Or, compile and install Tkhtml extension for your starndard
(not ActiveTcl) Tcl/Tk.

> My question is, is that the latest version, or is the version in ActiveTCL
> more up-to-date?

I think the latest version of Tkhtml is 2.0.

> should get?
You may need to give the library path. For example,
LD_LIBRARY_PATH=/usr/local/ActiveTcl/lib:$LD_LIBRARY_PATH
TCL_LIBRARY=/usr/local/ActiveTcl/lib/tcl8.5 /usr/local/bin/ruby -r tk -e
'p Tk::TCL_LIBRARY'

Or, your tcltklib.so may be disabled stubs and be compiled for
Tcl/Tk8.4.
Then, tcltklib.so cannot link the libraries of Tcl/Tk8.5.
F5b3c1ebfb2e9fc5f67bb48b119f6054?d=identicon&s=25 Randy Kramer (Guest)
on 2006-03-27 20:22
(Received via mailing list)
On Monday 27 March 2006 11:45 am, Hidetoshi NAGAI wrote:

---<good stuff, to look at again later, snipped>---

> You may need to give the library path. For example,
> LD_LIBRARY_PATH=/usr/local/ActiveTcl/lib:$LD_LIBRARY_PATH
> TCL_LIBRARY=/usr/local/ActiveTcl/lib/tcl8.5 /usr/local/bin/ruby -r tk -e 'p
> Tk::TCL_LIBRARY'
>
> Or, your tcltklib.so may be disabled stubs and be compiled for Tcl/Tk8.4.
> Then, tcltklib.so cannot link the libraries of Tcl/Tk8.5.

Ok, thanks!  I think I'll download and install ActiveTcl 8.4(.12) and
see what
that does for me.

Randy Kramer
This topic is locked and can not be replied to.