undefined method `highlight' for nil:NilClass #672

Closed
ianmurrays opened this Issue Apr 13, 2012 · 4 comments

3 participants

@ianmurrays

Apparently bash_lexer is not defined in this view. I'm on 52f6df7255ed40186bd1a0e92abaaf2b926f3817.

Started GET "/testproject" for 127.0.0.1 at 2012-04-13 08:05:05 +0400
Processing by ProjectsController#show as HTML
  Parameters: {"id"=>"testproject"}
  Rendered projects/empty.html.haml within layouts/project (2.2ms)
Completed 500 Internal Server Error in 11ms

ActionView::Template::Error (undefined method `highlight' for nil:NilClass):
    29:     "git remote add origin #{@project.url_to_repo}",
    30:     "git push -u origin master"].join("\n")
    31:
    32:   = raw bash_lexer.highlight(repo_setup_str)
    33:
    34:   %br
    35:   %br
  app/views/projects/empty.html.haml:32:in `_app_views_projects_empty_html_haml__1933588343029202734_97263360'
  app/controllers/projects_controller.rb:79:in `block (2 levels) in show'
@Jyzee

I'm having this issue on 2.3 stable.
After searching a little, I found - bash_lexer = Pygments::Lexer[:bash] in app/views/projects/empty.html.haml and app/views/help/workflow.html.haml.
The first one gives 500 errors while the second works randomly.

@ianmurrays
@Jyzee

I'm using Gentoo and I checked the contents of python-dev on Ubuntu to see if I had thoose files. Seems I do.
May I ask which Python and Pygments version you have ?

EDIT

After searching a while, I found this patch for rubypython which make it work on my Gentoo.

In file gitlab/vendor/bundle/ruby/1.9.1/gems/rubypython-0.5.3/lib/rubypython/pythonexec.rb, in method find_python_lib, comment the line libname = "#{libbase}.#{libext}" and add libname = 'libpython2.7.so' below like this :

def find_python_lib
    # By default, the library name will be something like
    # libpython2.6.so, but that won't always work.
    libbase = "#{FFI::Platform::LIBPREFIX}#{@basename}"
    libext = FFI::Platform::LIBSUFFIX
    #libname = "#{libbase}.#{libext}"
    libname = 'libpython2.7.so'

Source (Japanese)

@ianmurrays
@randx randx closed this Aug 28, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment