FAQ
the codes
return "<iframe src=\"file.txt\" width=\"100%\"
height=\"500\" scrolling=\"auto\"
frameborder=\"2\"></iframe>"

file.txt is genereated by a
previous python script and I need to display it at the web generated by cherrypy, but it gives
me this error:


Traceback (most recent call last):
File
"/usr/lib/pymodules/python2.6/cherrypy/_cprequest.py", line 606, in respond

cherrypy.response.body = self.handler()
File
"/usr/lib/pymodules/python2.6/cherrypy/_cperror.py", line 227, in __call__

raise self
NotFound: (404, "The path '/file.txt' was not found.")





I tryed changing the path with no success, so I guess is something
different

Maybe there is another way to do this....


_______________________
????????????andr?s
chand?a

P No imprima
innecesariamente. ?Cuide el medio ambiente!

Search Discussions

  • Alan Harris-Reid at Apr 9, 2011 at 11:04 pm
    Andreas...
    NotFound: (404, "The path '/file.txt' was not found.")
    This error message often occurs because file.txt is a static file and
    you have not told CherryPy where to look for static files. From the
    look of the error I am guessing that file.txt is in your root directory,
    in which case you need the following in your configuration file.

    [/]
    tools.staticdir.root = '/path/to/root/folder' # no trailing backslash
    tools.staticdir.on = True
    tools.staticdir.dir = "" # necessary
    to serve static files in home folder

    Hope this helps.
    Alan Harris-Reid
  • Andrés Chandía at Apr 10, 2011 at 11:05 am
    Thanks a lot Alan, I'm a complete newbe in cherrypy, actually this is my first cherrypy, so I
    had to go arround many tries to reach the goal, but your help was valuable and finally this is
    the config that gave me success:

    class helloworld(object):
    ???
    indexpage = indexpage()
    ??? _cp_config = {???
    'tools.staticdir.on': True,
    ??? ??? ???
    'tools.staticdir.root': '/path/to/root/folder',
    ??? ???
    ??? 'tools.staticdir.dir': '',
    ??? ???
    ??? }


    On Sun, April 10, 2011 01:04, Alan Harris-Reid wrote:

    Andreas...
    NotFound: (404, "The path '/file.txt' was not
    found.")

    This error message often occurs because file.txt is a static file
    and
    you have not told CherryPy where to look for static files.
    From the
    look
    of the error I am guessing that file.txt is in your root directory,
    in which case you
    need the following in your configuration file.

    [/]
    tools.staticdir.root =
    '/path/to/root/folder' # no trailing backslash
    tools.staticdir.on = True
    tools.staticdir.dir = "" # necessary
    to
    serve static files in home folder

    Hope this helps.
    Alan Harris-Reid

    _______________________________________________
    Tutor maillist - Tutor at python.org
    To unsubscribe or change subscription options:
    http://mail.python.org/mailman/listinfo/tutor




    _______________________
    ????????????andr?s
    chand?a

    P No imprima
    innecesariamente. ?Cuide el medio ambiente!
  • Andrés Chandía at Apr 15, 2011 at 4:21 pm
    Hello everybody,
    I could finally complete succesfully the code I was working with. As I'm
    quite new to python, many of the things I have in my code are copied from different sources,
    and I do not undertand all of them, well, I have to deliver this code for a project, and in
    the best documented way that I could, I already commented all that I know, and I suppouse
    wrongly in some parts.

    So the request is, if you can take a look at the code,
    comment the parts that are not yet commented, correct the errors, and propouse some
    improvement in the parts you think diserves it.

    I attach the code in a tgz file, if
    the attached can not be seen then this link:
    http://www.chandia.net/compart/NMT-2.4-20110415.tar.gz

    Thanks in advance to all
    of you and to the people that already helped me.
    _______________________
    ????????????andr?s
    chand?a

    P
    No imprima innecesariamente. ?Cuide el medio ambiente!
    -------------- next part --------------
    A non-text attachment was scrubbed...
    Name: NMT-2.4-20110415.tar.gz
    Type: application/x-gzip
    Size: 4177 bytes
    Desc: not available
    URL: <http://mail.python.org/pipermail/tutor/attachments/20110415/937a8c20/attachment.bin>

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouptutor @
categoriespython
postedApr 9, '11 at 9:23p
activeApr 15, '11 at 4:21p
posts4
users2
websitepython.org

People

Translate

site design / logo © 2022 Grokbase