Forum: Ruby on Rails RMagick gem problem using Rails and possibly WEBRick...

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.
50d026903563e045ca29cab1ad0b1d66?d=identicon&s=25 Shane Mr. (codejoy)
on 2006-05-22 06:36
  Hello, I am new to rails but have been having fun so far.  Until now.
I
  am sure this is just my inexperience but I have the RMagick gem (ruby
gem
  for using imagemagick manipulation) installed on my machine that I
would
  like to then use in my rails app.  I first installed it and tried it
out,
  and it didnt do anything for me, took me a while to realize I needed
the
  windows RUBYOPT rubygems environment variable set.  After that, I
could
  finally call stuff like:

   ruby myLittleTestProg.rb

  which used a
  require 'RMagick'
  and it would run fine.

  So I think, I tested my little script out, I want to do it on rails
and
  call it from my web app.  I build a skeleton web app, and goto the
  config/environment.rb file and say:
  require 'RMagick'

  adding this line, kills the skeleton app, what ran fine with webrick
now
  gives me a strange error that I wll post here.  (and yes after
changing the
  environment.rb file I did relaunch the server).  I installed the
flickr
  gem as well, and this runs fine, I can easily say in the
environment.rbfile:
  require 'flickr'
  and it works, it is just when I require 'RMagick' from that
environment.rbfile in my rails app it crashes with this error in the
  index.rhtml:

  I am looking for any suggestions, cause I am totally lost.  Not sure
why
  the RMagick include runs fine when I just use it from a ruby .rb file,
but
  when I try to require it from my rails app, it doesnt work...this is
locally
  using WEBrick (i tried my rails host online, and it seems that the
require
  RMagick works there, I just need to get it working locally for
development
  and testing purposes..)

  Thanks for anyone with any help or suggestions...

  -Shane
  error is as follows when require 'RMagick' is added to environment.rb
of a
  skeleton rails app:

  SyntaxError in imagemod#index

  Showing *app/views/imagemod/index.rhtml* where line *#2* raised:

  compile error
  ./script/../config/../app/views/imagemod/index.rhtml:2: parse error,
unexpected $, expecting kEND

  Extracted source (around line *#2*):

  1: <%= form_remote_tag :url =  {:action =  'search'}, :update =
'photos' %
  2:    <fieldset
  3:            <label for="tags" Tags:</label
  4:            <%= text_field_tag 'tags' %

  5:            <%= submit_tag 'Find' %

  Trace of template inclusion: /app/views/imagemod/index.rhtml

  RAILS_ROOT: ./script/../config/..
   Application Trace <http://localhost:3000/imagemod#  | Framework
Trace<http://localhost:3000/imagemod# | Full
  Trace <http://localhost:3000/imagemod#

  #{RAILS_ROOT}/app/views/imagemod/index.rhtml:2:in `compile_template'

   C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/base.rb:305:in
`compile_and_render_template'
  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/base.rb:290:in
`render_template'
  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/base.rb:249:in
`render_file'
  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:699:in
`render_file'
  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:621:in
`render_with_no_layout'
  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/layout.rb:243:in
`render_without_benchmark'
  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:53:in
`render'
  C:/InstantRails-1.0/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'
  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:53:in
`render'
  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:913:in
`perform_action_without_filters'
  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:368:in
`perform_action_without_benchmark'
  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:in
`perform_action_without_rescue'
  C:/InstantRails-1.0/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'
  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:in
`perform_action_without_rescue'
  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/rescue.rb:82:in
`perform_action'
  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:381:in
`process_without_filters'
  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:377:in
`process_without_session_management_support'
  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/session_management.rb:117:in
`process'
  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:38:in
`dispatch'
  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:115:in
`handle_dispatch'
  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:81:in
`service'
  C:/InstantRails-1.0/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in
`service'
  C:/InstantRails-1.0/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in
`run'
  C:/InstantRails-1.0/ruby/lib/ruby/1.8/webrick/server.rb:173:in
`start_thread'
  C:/InstantRails-1.0/ruby/lib/ruby/1.8/webrick/server.rb:162:in
`start_thread'
  C:/InstantRails-1.0/ruby/lib/ruby/1.8/webrick/server.rb:95:in `start'
  C:/InstantRails-1.0/ruby/lib/ruby/1.8/webrick/server.rb:92:in `start'
  C:/InstantRails-1.0/ruby/lib/ruby/1.8/webrick/server.rb:23:in `start'
  C:/InstantRails-1.0/ruby/lib/ruby/1.8/webrick/server.rb:82:in `start'
  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:67:in
`dispatch'
  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/servers/webrick.rb:59
  C:/InstantRails-1.0/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
`require'
  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in
`require'
  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/server.rb:30
  C:/InstantRails-1.0/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
`require'
  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in
`require'
  script/server:3

   #{RAILS_ROOT}/app/views/imagemod/index.rhtml:2:in `compile_template'
  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/base.rb:305:in
`compile_and_render_template'
  C:/InstantRails-
  1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/base.rb:290:in
`render_template'
  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/base.rb:249:in
`render_file'
  C:/InstantRails-
  1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:699:in
`render_file'
  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:621:in
`render_with_no_layout'

  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/layout.rb:243:in
`render_without_benchmark'
  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:53:in
`render'

  C:/InstantRails-1.0/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'
  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:53:in
`render'
  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-
  1.12.1/lib/action_controller/base.rb:913:in
`perform_action_without_filters'
  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:368:in
`perform_action_without_benchmark'

  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:in
`perform_action_without_rescue'
  C:/InstantRails-1.0/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'
  C:/InstantRails-
  1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:in
`perform_action_without_rescue'
  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/rescue.rb:82:in
`perform_action'

  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:381:in
`process_without_filters'
  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:377:in
`process_without_session_management_support'

  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/session_management.rb:117:in
`process'
  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:38:in
`dispatch'

  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:115:in
`handle_dispatch'
  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:81:in
`service'
  C:/InstantRails-
  1.0/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
  C:/InstantRails-1.0/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in
`run'
  C:/InstantRails-1.0/ruby/lib/ruby/1.8/webrick/server.rb:173:in
`start_thread'
  C:/InstantRails-
  1.0/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
  C:/InstantRails-1.0/ruby/lib/ruby/1.8/webrick/server.rb:95:in `start'
  C:/InstantRails-1.0/ruby/lib/ruby/1.8/webrick/server.rb:92:in `start'
  C:/InstantRails-
  1.0/ruby/lib/ruby/1.8/webrick/server.rb:23:in `start'
  C:/InstantRails-1.0/ruby/lib/ruby/1.8/webrick/server.rb:82:in `start'
  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:67:in
`dispatch'

  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/servers/webrick.rb:59
  C:/InstantRails-1.0/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
`require'
  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/activesupport-
  1.3.1/lib/active_support/dependencies.rb:147:in `require'
  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/server.rb:30
  C:/InstantRails-1.0/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
`require'

  C:/InstantRails-1.0/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in
`require'
  script/server:3

   Request

  *Parameters*: None

  Show session dump <http://localhost:3000/imagemod#

  ---
  flash: !map:ActionController::Flash::FlashHash {}

  Response *Headers*: {"cookie"= [], "Cache-Control"= "no-cache"}


  --
  -Shane
  --------------------------
  Sites:
  Photo
  http://www.thomascustomdigital.com
  Coding
  http://www.viciousbytes.com
  fun
  http://www.flickr.com/photos/codejoy
  blog
  http://codejoy.blogspot.com
30269682335f1fb247d71969fa715b5e?d=identicon&s=25 Roberto Saccon (rsaccon)
on 2006-05-22 07:24
(Received via mailing list)
rmagick does not work with ruby 1.8.4 on windows. Replace any of these
three
with something else and it will work.
036be8d5d83a98e546b98d64e3fd6c20?d=identicon&s=25 Sam Donaldson (Guest)
on 2006-05-22 10:39
(Received via mailing list)
correct.  i had to downgrade to 1.8.2.
50d026903563e045ca29cab1ad0b1d66?d=identicon&s=25 Codejoy (Guest)
on 2006-05-23 06:39
Sam Donaldson wrote:
> correct.  i had to downgrade to 1.8.2.

thanks so much guys, is it easy to downgrade?
 still that new to this im not sure...
8b777217583ebf095420de3364236ccb?d=identicon&s=25 Heikki Ylönen (heikki)
on 2006-05-23 12:52
Windows XP
ruby 1.8.4 (2005-12-24) [i386-mswin32]
Rails 1.1.2
RMagick-win32 (1.9.2)
WEBrick 1.3.1

File_column with RMagick works fine for me.
I just tried it with skeleton app, that had require 'RMagick' in
environment.rb and that worked ok too. Strange..
This topic is locked and can not be replied to.