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

Gonzih opened this Issue Nov 28, 2013 · 12 comments


None yet
Gonzih commented Nov 28, 2013

Hi guys, I found weird issue with Octopress. This commit Gonzih/ causes following error on rake generate:

Building site: source -> public
/ `highlight': undefined method `[]' for nil:NilClass (NoMethodError)
        from / `block in render_code_block'
        from / `gsub'
        from / `render_code_block'
        from / `pre_filter'
        from / `pre_render'
        from / `block in pre_render'
        from / `each'
        from / `pre_render'
        from / `do_layout'
        from / `render'
        from / `block in render'
        from / `each'
        from / `render'
        from / `process'
        from / `<top (required)>'
        from / `load'
        from / `<main>'

Is it a bug?

Issue can be solved if I replace line

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


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

getting the same problem...


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!"

  putStrLn "Thank You Sir for Info"

look at worker' this ' was making pygments cry.

allran commented Dec 23, 2013

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


first check if you dont have any single ' in code

kingiol commented Jan 10, 2014

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


view.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;


view.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;

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


Got the same problem.

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

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

CYBAI commented Apr 11, 2014

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

xautjzd commented Apr 15, 2014

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


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.


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

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