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

undefined method エラーが出る #106

Open
hakuoku opened this issue May 22, 2023 · 3 comments
Open

undefined method エラーが出る #106

hakuoku opened this issue May 22, 2023 · 3 comments

Comments

@hakuoku
Copy link

hakuoku commented May 22, 2023

PowerShell 7.2.2、ruby 3.1.3p185、aozora2html 3.0.0、rubyzip 2.3.2(双方最新版です)にて、Web上のzipフォルダを変換しようとすると以下のエラーが出ます。

> aozora2html https://www.aozora.gr.jp/cards/000051/files/1441_ruby.zip web_1441.html

C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/aozora2html-3.0.0/lib/aozora2html/zip.rb:11:in `block in unzip': undefined method `extract' for nil:NilClass (NoMethodError)

        entry.extract(textfilename)
             ^^^^^^^^
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rubyzip-2.3.2/lib/zip/file.rb:125:in `open'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/aozora2html-3.0.0/lib/aozora2html/zip.rb:9:in `unzip'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/aozora2html-3.0.0/bin/aozora2html:66:in `block in <top (required)>'
        from C:/Ruby31-x64/lib/ruby/3.1.0/tmpdir.rb:96:in `mktmpdir'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/aozora2html-3.0.0/bin/aozora2html:42:in `<top (required)>'
        from C:/Ruby31-x64/bin/aozora2html:32:in `load'
        from C:/Ruby31-x64/bin/aozora2html:32:in `<main>'
@gemmaro
Copy link
Contributor

gemmaro commented May 22, 2023

Dockerのruby:3.1.3でaozora2html (272f46d), rubyzipのバージョンを揃えて試しましたが再現しませんでした。
WSLではどうなりますか。

@hakuoku
Copy link
Author

hakuoku commented May 22, 2023

WSLのUbuntu 22.04.2、rbenvによる環境構築で各バージョンを揃えて試したところ成功しました。
ちなみに私の環境では最初にWSLにLinuxディストリビューションが一切入っていなかったのでそれが原因かと思い、wslを抜けてからPowerShellで再度試しましたがやはり同じエラーが出ました。

@takahashim
Copy link
Contributor

反応遅くなりました。
Macで確認したところでは、Ruby 3.1.3でも3.2.2でも特に問題なく動作しますね…。

エラーメッセージから判断する限りでは、entry = zip_file.glob('*.txt').firstのところでentryがnilになっているようですが、そうなる要因が思いつきませんでした。

Windowsでの確認はすぐにはできなさそうなので、もう少々お待ちいただけるとありがたいです。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants