Skip to content

No such file or directory - content.opf/toc.ncx #2

@cleippi

Description

@cleippi

Hello!

I'm trying to use this library to create sample files of epubs. I'm very new to ruby, but this is the code I'm working with so far:

require 'bundler/setup'
require 'quire'

source = ARGV[0]
sample_destination = ARGV[1]

sample = Quire.new(source)

sample.write(sample_destination)

I've tried it with multiple different source epub files, but none have worked so far. Here's a few errors that I'm seeing:

chris@DESKTOP C:\Users\chris\Source Code\epub-sampler
$ ruby lib/epub-sampler.rb test-epubs\3.epub "C:\Users\chris\Source Code\epub-sampler\test-epubs\sample.epub"
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/rubyzip-1.3.0/lib/zip/file.rb:381:in `get_entry': No such file or directory - content.opf/ncx.ncx (Errno::ENOENT)
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/rubyzip-1.3.0/lib/zip/file.rb:245:in `get_input_stream'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/rubyzip-1.3.0/lib/zip/file.rb:277:in `read'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/bundler/gems/quire-3be41cdd4d3c/lib/quire/source.rb:29:in `read_file'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/bundler/gems/quire-3be41cdd4d3c/lib/quire/source.rb:95:in `toc'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/bundler/gems/quire-3be41cdd4d3c/lib/quire/sample.rb:62:in `nav_point_content_sources'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/bundler/gems/quire-3be41cdd4d3c/lib/quire/sample.rb:125:in `sample_content'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/bundler/gems/quire-3be41cdd4d3c/lib/quire/sample.rb:294:in `epub_files'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/bundler/gems/quire-3be41cdd4d3c/lib/quire/sample.rb:301:in `block in build_sample'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/rubyzip-1.3.0/lib/zip/output_stream.rb:61:in `write_buffer'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/bundler/gems/quire-3be41cdd4d3c/lib/quire/sample.rb:298:in `build_sample'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/bundler/gems/quire-3be41cdd4d3c/lib/quire/sample.rb:16:in `to_s'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/bundler/gems/quire-3be41cdd4d3c/lib/quire/sample.rb:23:in `write'
        from lib/epub-sampler.rb:17:in `<main>'

chris@DESKTOP C:\Users\chris\Source Code\epub-sampler
$ ruby lib/epub-sampler.rb test-epubs\4.epub "C:\Users\chris\Source Code\epub-sampler\test-epubs\sample.epub"
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/rubyzip-1.3.0/lib/zip/file.rb:381:in `get_entry': No such file or directory - content.opf/toc.ncx (Errno::ENOENT)
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/rubyzip-1.3.0/lib/zip/file.rb:245:in `get_input_stream'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/rubyzip-1.3.0/lib/zip/file.rb:277:in `read'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/bundler/gems/quire-3be41cdd4d3c/lib/quire/source.rb:29:in `read_file'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/bundler/gems/quire-3be41cdd4d3c/lib/quire/source.rb:95:in `toc'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/bundler/gems/quire-3be41cdd4d3c/lib/quire/sample.rb:62:in `nav_point_content_sources'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/bundler/gems/quire-3be41cdd4d3c/lib/quire/sample.rb:125:in `sample_content'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/bundler/gems/quire-3be41cdd4d3c/lib/quire/sample.rb:294:in `epub_files'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/bundler/gems/quire-3be41cdd4d3c/lib/quire/sample.rb:301:in `block in build_sample'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/rubyzip-1.3.0/lib/zip/output_stream.rb:61:in `write_buffer'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/bundler/gems/quire-3be41cdd4d3c/lib/quire/sample.rb:298:in `build_sample'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/bundler/gems/quire-3be41cdd4d3c/lib/quire/sample.rb:16:in `to_s'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/bundler/gems/quire-3be41cdd4d3c/lib/quire/sample.rb:23:in `write'
        from lib/epub-sampler.rb:17:in `<main>'

chris@DESKTOP C:\Users\chris\Source Code\epub-sampler
$ ruby lib/epub-sampler.rb test-epubs\5.epub "C:\Users\chris\Source Code\epub-sampler\test-epubs\sample.epub"
C:/Ruby30-x64/lib/ruby/gems/3.0.0/bundler/gems/quire-3be41cdd4d3c/lib/quire/sample.rb:58:in `path_in_zip': uninitialized constant Quire::Sample::CGI (NameError)
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/bundler/gems/quire-3be41cdd4d3c/lib/quire/sample.rb:128:in `block in sample_content'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/bundler/gems/quire-3be41cdd4d3c/lib/quire/sample.rb:125:in `select'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/bundler/gems/quire-3be41cdd4d3c/lib/quire/sample.rb:125:in `sample_content'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/bundler/gems/quire-3be41cdd4d3c/lib/quire/sample.rb:294:in `epub_files'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/bundler/gems/quire-3be41cdd4d3c/lib/quire/sample.rb:301:in `block in build_sample'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/rubyzip-1.3.0/lib/zip/output_stream.rb:61:in `write_buffer'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/bundler/gems/quire-3be41cdd4d3c/lib/quire/sample.rb:298:in `build_sample'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/bundler/gems/quire-3be41cdd4d3c/lib/quire/sample.rb:16:in `to_s'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/bundler/gems/quire-3be41cdd4d3c/lib/quire/sample.rb:23:in `write'
        from lib/epub-sampler.rb:17:in `<main>'

Do you have any ideas what could be causing these? I'm comprehending the error of 'No such file or directory - content.opf/toc.ncx' to mean that the program is looking for a file that cannot exist within a standard epub file (because epub files do not have a content.opf/toc.ncx file - those are usually two separate files).

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions