plugins/pygments_code.rb:14:in `highlight': undefined method `[]' for nil:NilClass (NoMethodError) #1427

Open
Gonzih opened this Issue Nov 28, 2013 · 12 comments

Projects

None yet
@Gonzih
Gonzih commented Nov 28, 2013

Hi guys, I found weird issue with Octopress. This commit Gonzih/gonzih.github.com@084fc62 causes following error on rake generate:

Building site: source -> public
/gonzih.github.com/plugins/pygments_code.rb:14:in `highlight': undefined method `[]' for nil:NilClass (NoMethodError)
        from /gonzih.github.com/plugins/backtick_code_block.rb:37:in `block in render_code_block'
        from /gonzih.github.com/plugins/backtick_code_block.rb:13:in `gsub'
        from /gonzih.github.com/plugins/backtick_code_block.rb:13:in `render_code_block'
        from /gonzih.github.com/plugins/octopress_filters.rb:12:in `pre_filter'
        from /gonzih.github.com/plugins/octopress_filters.rb:28:in `pre_render'
        from /gonzih.github.com/plugins/post_filters.rb:112:in `block in pre_render'
        from /gonzih.github.com/plugins/post_filters.rb:111:in `each'
        from /gonzih.github.com/plugins/post_filters.rb:111:in `pre_render'
        from /gonzih.github.com/plugins/post_filters.rb:166:in `do_layout'
        from /gonzih.github.com/vendor/bundle/ruby/2.0.0/gems/jekyll-0.12.1/lib/jekyll/post.rb:195:in `render'
        from /gonzih.github.com/vendor/bundle/ruby/2.0.0/gems/jekyll-0.12.1/lib/jekyll/site.rb:200:in `block in render'
        from /gonzih.github.com/vendor/bundle/ruby/2.0.0/gems/jekyll-0.12.1/lib/jekyll/site.rb:199:in `each'
        from /gonzih.github.com/vendor/bundle/ruby/2.0.0/gems/jekyll-0.12.1/lib/jekyll/site.rb:199:in `render'
        from /gonzih.github.com/vendor/bundle/ruby/2.0.0/gems/jekyll-0.12.1/lib/jekyll/site.rb:41:in `process'
        from /gonzih.github.com/vendor/bundle/ruby/2.0.0/gems/jekyll-0.12.1/bin/jekyll:264:in `<top (required)>'
        from /gonzih.github.com/vendor/bundle/ruby/2.0.0/bin/jekyll:23:in `load'
        from /gonzih.github.com/vendor/bundle/ruby/2.0.0/bin/jekyll:23:in `<main>'

Is it a bug?

Issue can be solved if I replace line

gsettings set org.mate.session.required-components filemanager 'caja-no-desktop'

to:

gsettings set org.mate.session.required-components filemanager "caja-no-desktop"
@lynnard
lynnard commented Dec 13, 2013

getting the same problem...

@JakubOboza

i found the issue by debugging plugins/pygments.rb

i had in my source code something like this

import Control.Concurrent
import Control.Monad (forever)
import Control.Concurrent.Chan

worker chan foo = do
  forkIO $ forever $ foo chan

worker' action = do
  forkIO $ forever action

gossipGirl chan = do
    gossip <- readChan chan
    putStrLn gossip

main :: IO ()
main = do
  putStrLn "Lets do some gossips"
  gossipChan <- newChan -- lets make new chan
  gossipChan2 <- newChan -- lets make new chan
  worker gossipChan gossipGirl -- spawn gossipGirl

  writeChan gossipChan "Garbage is garbage!"
  writeChan gossipChan "Garbage is garbage for reals!"

  worker' (gossipGirl gossipChan2) -- worker' 2 girl!
  writeChan gossipChan2 "Umkay"
  writeChan gossipChan2 "Yez!"

  getLine
  putStrLn "Thank You Sir for Info"

look at worker' this ' was making pygments cry.

@allran
allran commented Dec 23, 2013

getting the same problem...How to fix it,please?

@JakubOboza

first check if you dont have any single ' in code

@kingiol
kingiol commented Jan 10, 2014

hello, I also get this error.
then I find out code format is not right. in ``` tag.

before:

view.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;

after:

view.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;

then the error info disappear, I also don't know why

@prosseek

Got the same problem.

unittest.main(verbosity=2) <- Error
unittest.main (verbosity=2) <- OK
@lucasmartins

+1, I'm running generate on Linux (same code) and have no issues.

@CYBAI
CYBAI commented Apr 11, 2014

I got the same problem and I delete .pygments-cache, then the problem resolved.

@xautjzd
xautjzd commented Apr 15, 2014

yes, I have the same problem, and rm .pygments-cache, then it's OK. @CYBAI thank you very much

@kiyote23

I just had this problem with some Python code. I replaced the single quotes(') on my print statements with double quotes(") and it rendered fine.

@RickyLin

@CYBAI, Thank you, deleting .pygments-cache did the trick.

@jslim89
jslim89 commented Oct 10, 2014

@CYBAI Thanks for the trick

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment