Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong number of arguments in `load_file` call #5

Open
timmyomahony opened this issue Jun 20, 2014 · 13 comments

Comments

Projects
None yet
5 participants
@timmyomahony
Copy link

commented Jun 20, 2014

I was getting an error when trying to build my jekyll site:

jekyll 2.0.3 | Error: wrong number of arguments (2 for 1)

When I added a traceback with jekyll build -t I was seeing the more detailed error:

/usr/lib/ruby/1.9.1/psych.rb:296:in `load_file': wrong number of arguments (2 for 1) (ArgumentError)

The problem seemed to be stemming from the following line in jekyll-pageless-redirects:

if File.exists?(file_path)
    YAML.load_file(file_path, :safe => true).each do | new_url, old_url |
      generate_aliases( old_url, new_url )
end

where YAML.load_file is passing two arguments instead of one. I'm not sure if it's down to my version of psych (2.0.5) but changing the line to:

if File.exists?(file_path)
    YAML.load_file(file_path).each do | new_url, old_url |
      generate_aliases( old_url, new_url )
end

has fixed the issue for me

@atdnd

This comment has been minimized.

Copy link

commented Jul 31, 2014

I've got the same issue but removing the 2nd argument doesn't solve it.
I get this:

.rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks:15: stack level too deep (SystemStackError)

@nquinlan

This comment has been minimized.

Copy link
Owner

commented Aug 5, 2014

Thanks for reporting. I've been on vacation and am trying to catch up with all my obligations. I'll start looking into this shortly.

If you find a solution, a PR would be greatly appreciated and welcomed. 😃 I'll even send you a rockin' loon sticker.

@atdnd

This comment has been minimized.

Copy link

commented Aug 5, 2014

I will try to help but I'm not good with ruby at all :(

@nquinlan

This comment has been minimized.

Copy link
Owner

commented Aug 6, 2014

No worries. If not, I'll get to it eventually. I just need to dig myself out of the land of 1,000,000,000 emails first.

@dcac

This comment has been minimized.

Copy link
Contributor

commented Aug 26, 2014

Changing this line in jekyll-pageless-redirects:

@site.static_files << Jekyll::PagelessRedirectFile.new(@site, @site.dest, alias_index_path.split('/')[0, sections].join('/'), '')

to this:

@site.static_files << Jekyll::PagelessRedirectFile.new(@site, @site.dest, alias_index_path.split('/')[1, sections + 1].join('/'), '')

fixed the stack level too deep error for me.

@Richard-West

This comment has been minimized.

Copy link

commented Oct 27, 2014

Any update on this issue? I have the same "wrong number of arguments (2 for 1) (ArgumentError)" as @timmyomahony

@dcac

This comment has been minimized.

Copy link
Contributor

commented Oct 27, 2014

I can't remember how I fixed the number of arguments, but the changes I made in my pull request fixed all the issues for me.

#7

@Richard-West

This comment has been minimized.

Copy link

commented Oct 27, 2014

Thanks @dcac -- I'm using the code in your PR and the error is gone. However none of the redirect stubs are being created in the _site folder. I might have a different issue that's causing this behavior. I've tried both ._redirects.yml and _redirects.json

@dcac

This comment has been minimized.

Copy link
Contributor

commented Oct 27, 2014

Odd, I'm using _redirects.yml, and it's working well for me.

Is it even creating any of the directories that match your old structure/locations?

@Richard-West

This comment has been minimized.

Copy link

commented Oct 27, 2014

No -- none of the folders are being created in the _site folder. Do you have a public repo that I can take a look at to see if there is something else I have misconfigured?

@dcac

This comment has been minimized.

Copy link
Contributor

commented Oct 27, 2014

@Richard-West

This comment has been minimized.

Copy link

commented Oct 27, 2014

Thanks for your help @dcac -- I was not formating my yml file correctly.

I was trying:
initial-page : /destination-page

Your file, and what is working for me as well, looks like:
/initial-page/index.html : /destination-page/index.html

@dcac

This comment has been minimized.

Copy link
Contributor

commented Oct 27, 2014

Ah, yes. Glad to help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.