runemadsen / Magic-Book-Project

DEPRECATED: We are reviving the Magic Book project as a node package: https://github.com/magicbookproject/magicbook
http://itp.nyu.edu
621 stars 59 forks source link

Sinatra doesn't find file, despite file existing: #155

Closed candeira closed 11 years ago

candeira commented 11 years ago

I have installed the Magic Book Project and tried to build the Nature of Code book with it. Sinatra shows an exception with sinatra error:

<Errno::ENOENT: No such file or directory - /home/kandinski/data/work/hack/The-Nature-of-Code/noc_html/index.xml>

This is the url I'm accessing:

http://127.0.0.1:9393/create_html/home/kandinski/data/work/hack/The-Nature-of-Code/raw/

The files for the book are there:

kandinski@desire:~/data/work/hack/The-Nature-of-Code/raw/noc_html$ ls -l index.xml -rw-rw-r-- 1 kandinski kandinski 0 Dec 5 23:34 index.xml kandinski@desire:~/data/work/hack/The-Nature-of-Code/raw/noc_html$ pwd /home/kandinski/data/work/hack/The-Nature-of-Code/raw/noc_html

This is the traceback on the terminal:

kandinski@desire:~/data/work/hack/Magic-Book-Project$ shotgun config.ru == Shotgun/WEBrick on http://127.0.0.1:9393/ [2012-12-05 23:48:31] INFO WEBrick 1.3.1 [2012-12-05 23:48:31] INFO ruby 1.9.3 (2011-10-30) [x86_64-linux] [2012-12-05 23:48:31] INFO WEBrick::HTTPServer#start: pid=26957 port=9393 Errno::ENOENT - No such file or directory - /home/kandinski/data/work/hack/The-Nature-of-Code/noc_html/index.xml: /home/kandinski/data/work/hack/Magic-Book-Project/gems/asciidoc/lib/asciidoc/ascii_document.rb:21:in initialize' /home/kandinski/data/work/hack/Magic-Book-Project/gems/asciidoc/lib/asciidoc/ascii_document.rb:21:inopen' /home/kandinski/data/work/hack/Magic-Book-Project/gems/asciidoc/lib/asciidoc/ascii_document.rb:21:in initialize' /home/kandinski/data/work/hack/Magic-Book-Project/application.rb:17:innew' /home/kandinski/data/work/hack/Magic-Book-Project/application.rb:17:in block in <class:Application>' /var/lib/gems/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:1212:incall' /var/lib/gems/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:1212:in block in compile!' /var/lib/gems/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:785:in[]' /var/lib/gems/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:785:in block (3 levels) in route!' /var/lib/gems/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:801:inroute_eval' /var/lib/gems/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:785:in block (2 levels) in route!' /var/lib/gems/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:822:inblock in process_route' /var/lib/gems/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:820:in catch' /var/lib/gems/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:820:inprocess_route' /var/lib/gems/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:784:in block in route!' /var/lib/gems/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:783:ineach' /var/lib/gems/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:783:in route!' /var/lib/gems/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:886:indispatch!' /var/lib/gems/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:719:in block in call!' /var/lib/gems/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:871:inblock in invoke' /var/lib/gems/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:871:in catch' /var/lib/gems/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:871:ininvoke' /var/lib/gems/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:719:in call!' /var/lib/gems/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:705:incall' /var/lib/gems/1.9.1/gems/rack-protection-1.2.0/lib/rack/protection/xss_header.rb:22:in call' /var/lib/gems/1.9.1/gems/rack-protection-1.2.0/lib/rack/protection/path_traversal.rb:16:incall' /var/lib/gems/1.9.1/gems/rack-protection-1.2.0/lib/rack/protection/json_csrf.rb:17:in call' /var/lib/gems/1.9.1/gems/rack-protection-1.2.0/lib/rack/protection/base.rb:47:incall' /var/lib/gems/1.9.1/gems/rack-protection-1.2.0/lib/rack/protection/xss_header.rb:22:in call' /var/lib/gems/1.9.1/gems/rack-1.4.1/lib/rack/nulllogger.rb:9:incall' /var/lib/gems/1.9.1/gems/rack-1.4.1/lib/rack/head.rb:9:in call' /var/lib/gems/1.9.1/gems/sinatra-1.3.2/lib/sinatra/showexceptions.rb:21:incall' /var/lib/gems/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:1334:in block in call' /var/lib/gems/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:1416:insynchronize' /var/lib/gems/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:1334:in call' /var/lib/gems/1.9.1/gems/rack-1.4.1/lib/rack/lint.rb:48:in_call' /var/lib/gems/1.9.1/gems/rack-1.4.1/lib/rack/lint.rb:36:in call' /var/lib/gems/1.9.1/gems/rack-1.4.1/lib/rack/showexceptions.rb:24:incall' /var/lib/gems/1.9.1/gems/rack-1.4.1/lib/rack/commonlogger.rb:20:in call' /var/lib/gems/1.9.1/gems/shotgun-0.9/lib/shotgun/loader.rb:86:inproceed_as_child' /var/lib/gems/1.9.1/gems/shotgun-0.9/lib/shotgun/loader.rb:31:in call!' /var/lib/gems/1.9.1/gems/shotgun-0.9/lib/shotgun/loader.rb:18:incall' /var/lib/gems/1.9.1/gems/shotgun-0.9/lib/shotgun/favicon.rb:12:in call' /var/lib/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:134:incall' /var/lib/gems/1.9.1/gems/rack-1.4.1/lib/rack/handler/webrick.rb:59:in service' /usr/lib/ruby/1.9.1/webrick/httpserver.rb:138:inservice' /usr/lib/ruby/1.9.1/webrick/httpserver.rb:94:in run' /usr/lib/ruby/1.9.1/webrick/server.rb:191:inblock in start_thread' [2012-12-05 23:48:36] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true

And this is the whole of the Sinatra error:

BACKTRACE

(expand)

JUMP TO: GET POST COOKIES ENV

/home/kandinski/data/work/hack/Magic-Book-Project/gems/asciidoc/lib/asciidoc/ascii_document.rb in initialize
    File.open(args[:debug_xml_to_file], 'w') {|f| f.write(@xml) }
/home/kandinski/data/work/hack/Magic-Book-Project/gems/asciidoc/lib/asciidoc/ascii_document.rb in open
    File.open(args[:debug_xml_to_file], 'w') {|f| f.write(@xml) }
/home/kandinski/data/work/hack/Magic-Book-Project/gems/asciidoc/lib/asciidoc/ascii_document.rb in initialize
    File.open(args[:debug_xml_to_file], 'w') {|f| f.write(@xml) }
/home/kandinski/data/work/hack/Magic-Book-Project/application.rb in new
    @document = AsciiDoc::AsciiDocument.new(asciidoc_file, {:debug_xml_to_file => File.join(output_folder, "index.xml") })
/home/kandinski/data/work/hack/Magic-Book-Project/application.rb in block in <class:Application>
    @document = AsciiDoc::AsciiDocument.new(asciidoc_file, {:debug_xml_to_file => File.join(output_folder, "index.xml") })
/usr/lib/ruby/1.9.1/webrick/httpserver.rb in service
    si.service(req, res)
/usr/lib/ruby/1.9.1/webrick/httpserver.rb in run
    server.service(req, res)
/usr/lib/ruby/1.9.1/webrick/server.rb in block in start_thread
    block ? block.call(sock) : run(sock)

GET

No GET data. POST

No POST data. COOKIES

No cookie data. Rack ENV Variable Value GATEWAY_INTERFACE
CGI/1.1 HTTPACCEPT
text/html,application/xhtml+xml,application/xml;q=0.9,
/_;q=0.8 HTTP_ACCEPT_ENCODING
gzip, deflate HTTP_ACCEPT_LANGUAGE
en-US,en;q=0.5 HTTP_CACHE_CONTROL
max-age=0 HTTP_CONNECTION
keep-alive HTTP_DNT
1 HTTP_HOST
127.0.0.1:9393 HTTP_USER_AGENT
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:17.0) Gecko/20100101 Firefox/17.0 HTTP_VERSION
HTTP/1.1 PATH_INFO
/create_html/home/kandinski/data/work/hack/The-Nature-of-Code/raw/ QUERY_STRING
REMOTE_ADDR
127.0.0.1 REMOTE_HOST
localhost REQUEST_METHOD
GET REQUEST_PATH
/create_html/home/kandinski/data/work/hack/The-Nature-of-Code/raw/ REQUEST_URI
http://127.0.0.1:9393/create_html/home/kandinski/data/work/hack/The-Nature-of-Code/raw/ SCRIPT_NAME
SERVER_NAME
127.0.0.1 SERVER_PORT
9393 SERVER_PROTOCOL
HTTP/1.1 SERVER_SOFTWARE
WEBrick/1.3.1 (Ruby/1.9.3/2011-10-30) rack.errors

Object:0x000000022ff448

rack.input

<Rack::Lint::InputWrapper:0x007fe850953dd8 @input=#>

rack.logger

<Rack::NullLogger:0x00000001d9f868 @app=#<Rack::Protection::FrameOptions:0x00000001d9fe58 @app=#<Rack::Protection::IPSpoofing:0x00000001d9ff48 @app=#<Rack::Protection::JsonCsrf:0x00000001da0038 @app=#<Rack::Protection::PathTraversal:0x00000001da00d8 @app=#<Rack::Protection::XSSHeader:0x00000001da0448 @app=#<Application:0x007fe850955a98 @default_layout=:layout, @app=nil, @template_cache=#<Tilt::Cache:0x007fe850955a70 @cache={}>>, @options={:reaction=>:default_reaction, :logging=>true, :message=>"Forbidden", :encryptor=>Digest::SHA1, :session_key=>"rack.session", :status=>403, :allow_empty_referrer=>true, :xss_mode=>:block, :except=>[:session_hijacking, :remote_token]}>, @options={:reaction=>:default_reaction, :logging=>true, :message=>"Forbidden", :encryptor=>Digest::SHA1, :session_key=>"rack.session", :status=>403, :allow_empty_referrer=>true, :except=>[:session_hijacking, :remote_token]}>, @options={:reaction=>:default_reaction, :logging=>true, :message=>"Forbidden", :encryptor=>Digest::SHA1, :session_key=>"rack.session", :status=>403, :allow_empty_referrer=>true, :except=>[:session_hijacking, :remote_token]}>, @options={:reaction=>:default_reaction, :logging=>true, :message=>"Forbidden", :encryptor=>Digest::SHA1, :session_key=>"rack.session", :status=>403, :allow_empty_referrer=>true, :except=>[:session_hijacking, :remote_token]}>, @options={:reaction=>:default_reaction, :logging=>true, :message=>"Forbidden", :encryptor=>Digest::SHA1, :session_key=>"rack.session", :status=>403, :allow_empty_referrer=>true, :xss_mode=>:block, :frame_options=>:sameorigin, :except=>[:session_hijacking, :remote_token]}>>

rack.multiprocess
false rack.multithread
true rack.request.cookie_hash
{} rack.request.query_hash
{} rack.request.query_string
rack.run_once
false rack.url_scheme
http rack.version
[1, 1] sinatra.error

<Errno::ENOENT: No such file or directory - /home/kandinski/data/work/hack/The-Nature-of-Code/noc_html/index.xml>

You're seeing this error because you have enabled the show_exceptions setting.

shiffman commented 11 years ago

You need to reference a specific asciidoc file, i.e.

http://127.0.0.1:9393/create_html/home/kandinski/data/work/hack/The-Nature-of-Code/raw/book.asc