Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6178169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:24:49+00:00 2026-05-24T00:24:49+00:00

Every time I try this the browser raises an error app.py import web urls

  • 0

Every time I try this the browser raises an error

app.py

import web
urls = (
'/hello','/file_upload_form','Index'
)

app = web.application(urls, globals())

render = web.template.render('templates/', base = "layout")

class Index(object):
    def POST(self):
        uploaded_file = web.input(uploaded_file_loc = 'file')
        form = web.input(name = "Nobody", greet = None)
        greeting = "%s, %s" % (form.greet, form.name)
        return render.index(greeting = greeting)
    def GET(self):
        return render.hello_form()
        return render.file_upload_form()


if __name__ == "__main__":
    app.run()

file_upload_form.html

<div id='upload_form'>
<center>
<form action="/file_upload" method="POST">
File to upload:<input type="text" name="uploaded_file_loc">
<br />
<input type="submit">
</form>
</center>
</div>

hello_form.html

<div id="header">
<h1>Company</h1>
</div>

<div id="form">
<form action="/hello" method ="POST">
greeting: <input type="text" name="greet">
<br />
name: <input type="text"name="name">
<br />
<input type="submit">
</form>
<a href="/file_upload">Upload a file</a>
</div>
<div id="home">
</div>

layout.html

$def with (content)

<html>
<head>
    <title>Gothons from Planet Percal #25</title>
<style type = "text/css">
body {
        background-color:#bbbbbb;
    }

#form{
        background-color:#008899;
        color: #ffffff;
        width: 200px;
        margin-left:80%;
        border-width: thin;
        border-style: solid;
        border-color: #aaaaaa;
        padding: 10px 10px 450px 40px;
        font-size: 20;
        font-family: "verdana";
    }
#header{
        background-color:#008899;
        color:#ffffff;
        height: 80px;
        margin-left: 0%;
        margin-right: 0%;
        font-size:30;
    }
#home{
        background-color:#008899
        }
#talk{
        background-color:#008899;
        margin-left:20%;
        margin-right:20%;
        border-width:1px;
        border-style: solid;
        border-color:#ffffff;
        color:#ffffff;
        font-family: "verdana";
        font-size:20;
        padding 30px 30px 30px 30px;
        height: 100px;

    }
#upload_form{
        background-color:#008899;
        border-width: 1px;
        border-color:#ffffff;
        padding 20px 20px 20px 20px;
        margin-right: 20%;
        margin-left: 20%;
   }
</style>
</head>
<body>
$:content
</body>
</html>

index.html

$def with (greeting)
<div id="talk">
<center>
$if greeting:
    I just wanted to say $greeting
$else:
    <em>hello</em>
<br />
</center>
</div>
<div id="link">
<a href = "/hello"> The Form! </a>
</div>

What is wrong with this?

Traceback:

    Traceback (innermost first)
/usr/local/lib/python2.7/dist-packages/web/application.py in _delegate
            cls = fvars[f] ...
    ▼ Local vars
    Variable    Value
  args  
    []
     f  
     u'/file_upload_form'
     fvars  
     {'Index': <class 'app_1.Index'>, '__builtins__': {'ArithmeticError': <type             'exceptions.ArithmeticError'>, 'AssertionError': <type 'exceptions.AssertionError'>,     'AttributeError': <type 'exceptions.AttributeError'>, 'BaseException': <type 'exceptions.BaseException'>, 'BufferError': <type 'exceptions.BufferError'>, 'BytesWarning': <type 'exceptions.BytesWarning'>, 'DeprecationWarning': <type 'exceptions.DeprecationWarning'>, 'EOFError': <type 'exceptions.EOFError'>, 'Ellipsis': Ellipsis, 'EnvironmentError': <type 'exceptions.EnvironmentError'>, 'Exception': <type 'exceptions.Exception'>, 'False': False, 'FloatingPointError': <type 'exceptions.FloatingPointError'>, 'FutureWarning': <type 'exceptions.FutureWarning'>, 'GeneratorExit': <type 'exceptions.GeneratorExit'>, 'IOError': <type 'exceptions.IOError'>, 'ImportError': <type 'exceptions.ImportError'>, 'ImportWarning': <type 'exceptions.ImportWarning'>, 'IndentationError': <type 'exceptions.IndentationError'>, 'IndexError': <type 'exceptions.IndexError'>, 'KeyError': <type 'exceptions.KeyError'>, 'KeyboardInterrupt': <type 'exceptions.KeyboardInterrupt'>, 'LookupError': <type 'exceptions.LookupError'>, 'MemoryError': <type 'exceptions.MemoryError'>, 'NameError': <type 'exceptions.NameError'>, 'None': None, 'NotImplemented': NotImplemented, 'NotImplementedError': <type 'exceptions.NotImplementedError'>, 'OSError': <type 'exceptions.OSError'>, 'OverflowError': <type 'exceptions.OverflowError'>, 'PendingDeprecationWarning': <type 'exceptions.PendingDeprecationWarning'>, 'ReferenceError': <type 'exceptions.ReferenceError'>, 'RuntimeError': <type 'exceptions.RuntimeError'>, 'RuntimeWarning': <type 'exceptions.RuntimeWarning'>, 'StandardError': <type 'exceptions.StandardError'>, 'StopIteration': <type 'exceptions.StopIteration'>, 'SyntaxError': <type 'exceptions.SyntaxError'>, 'SyntaxWarning': <type 'exceptions.SyntaxWarning'>, 'SystemError': <type 'exceptions.SystemError'>, 'SystemExit': <type 'exceptions.SystemExit'>, 'TabError': <type 'exceptions.TabError'>, 'True': True, 'TypeError': <type 'exceptions.TypeError'>, 'UnboundLocalError': <type 'exceptions.UnboundLocalError'>, 'UnicodeDecodeError': <type 'exceptions.UnicodeDecodeError'>, 'UnicodeEncodeError': <type 'exceptions.UnicodeEncodeError'>, 'UnicodeError': <type 'exceptions.UnicodeError'>, 'UnicodeTranslateError': <type 'exceptions.UnicodeTranslateError'>, 'UnicodeWarning': <type 'exceptions.UnicodeWarning'>, 'UserWarning': <type 'exceptions.UserWarning'>, 'ValueError': <type 'exceptions.ValueError'>, 'Warning': <type 'exceptions.Warning'>, 'ZeroDivisionError': <type 'exceptions.ZeroDivisionError'>, '__debug__': True, '__doc__': "Built-in functions, exceptions, and other objects.\n\nNoteworthy: None is the `nil' object; Ellipsis represents `...' in slices.", '__import__': <built-in function __import__>, '__name__': '__builtin__', '__package__': None, 'abs': <built-in function abs>, 'all': <built-in function all>, 'any': <built-in function any>, 'apply': <built-in function apply>, 'basestring': <type 'basestring'>, 'bin': <built-in function bin>, 'bool': <type 'bool'>, 'buffer': <type 'buffer'>, 'bytearray': <type 'bytearray'>, 'bytes': <type 'str'>, 'callable': <built-in function callable>, 'chr': <built-in function chr>, 'classmethod': <type 'classmethod'>, 'cmp': <built-in function cmp>, 'coerce': <built-in function coerce>, 'compile': <built-in function compile>, 'complex': <type 'complex'>, 'copyright': Copyright (c) 2001-2011 Python Software Foundation. All Rights Reserved. Copyright (c) 2000 BeOpen.com. All Rights Reserved. Copyright (c) 1995-2001 Corporation for National Research Initiatives. All Rights Reserved. Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam. All Rights Reserved., 'credits': Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands for supporting Python development. See www.python.org for more information., 'delattr': <built-in function delattr>, 'dict': <type 'dict'>, 'dir': <built-in function dir>, 'divmod': <built-in function divmod>, 'enumerate': <type 'enumerate'>, 'eval': <built-in function eval>, 'execfile': <built-in function execfile>, 'exit': Use exit() or Ctrl-D (i.e. EOF) to exit, 'file': <type 'file'>, 'filter': <built-in function filter>, 'float': <type 'float'>, 'format': <built-in function format>, 'frozenset': <type 'frozenset'>, 'getattr': <built-in function getattr>, 'globals': <built-in function globals>, 'hasattr': <built-in function hasattr>, 'hash': <built-in function hash>, 'help': Type help() for interactive help, or help(object) for help about object., 'hex': <built-in function hex>, 'id': <built-in function id>, 'input': <built-in function input>, 'int': <type 'int'>, 'intern': <built-in function intern>, 'isinstance': <built-in function isinstance>, 'issubclass': <built-in function issubclass>, 'iter': <built-in function iter>, 'len': <built-in function len>, 'license': Type license() to see the full license text, 'list': <type 'list'>, 'locals': <built-in function locals>, 'long': <type 'long'>, 'map': <built-in function map>, 'max': <built-in function max>, 'memoryview': <type 'memoryview'>, 'min': <built-in function min>, 'next': <built-in function next>, 'object': <type 'object'>, 'oct': <built-in function oct>, 'open': <built-in function open>, 'ord': <built-in function ord>, 'pow': <built-in function pow>, 'print': <built-in function print>, 'property': <type 'property'>, 'quit': Use quit() or Ctrl-D (i.e. EOF) to exit, 'range': <built-in function range>, 'raw_input': <built-in function raw_input>, 'reduce': <built-in function reduce>, 'reload': <built-in function reload>, 'repr': <built-in function repr>, 'reversed': <type 'reversed'>, 'round': <built-in function round>, 'set': <type 'set'>, 'setattr': <built-in function setattr>, 'slice': <type 'slice'>, 'sorted': <built-in function sorted>, 'staticmethod': <type 'staticmethod'>, 'str': <type 'str'>, 'sum': <built-in function sum>, 'super': <type 'super'>, 'tuple': <type 'tuple'>, 'type': <type 'type'>, 'unichr': <built-in function unichr>, 'unicode': <type 'unicode'>, 'vars': <built-in function vars>, 'xrange': <type 'xrange'>, 'zip': <built-in function zip>}, '__doc__': None, '__file__': '/home/colin/projects/gothonweb/bin/app_1.pyc', '__name__': 'app_1', '__package__': None, 'app': <web.application.application instance at 0xa60488c>, 'render': <web.template.Render instance at 0xa60498c>, 'urls': ('/hello', '/file_upload_form', 'Index'), 'web': <module 'web' from '/usr/local/lib/python2.7/dist-packages/web/__init__.pyc'>}
    handle_class    

is_class

self

/usr/local/lib/python2.7/dist-packages/web/application.py in handle
return self._delegate(fn, self.fvars, args) …
▼ Local vars
Variable Value
args
[]
fn
u’/file_upload_form’
self

/usr/local/lib/python2.7/dist-packages/web/application.py in process
return self.handle() …
▼ Local vars
Variable Value
process

processors
[]
self

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T00:24:50+00:00Added an answer on May 24, 2026 at 12:24 am

    Error is caused by wrong urls param. I think it should be:

    urls = (
        '/hello', 'Index',
        '/file_upload_form','Index'
    )
    

    See http://webpy.org/cookbook/url_handling:

    The format of this tuple is: url-path-pattern, handler-class this pattern will repeat as more url patterns are defined.

    By the way:

    def GET(self):
        return render.hello_form()
        return render.file_upload_form()
    

    You understand that second return is never called?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Every time I try to run a small application that uses a Derby DB
Every time I try to post to twitter in my rails app, the first
I am getting a conversion error every time I try to submit a date
Every time try to set the value of any variable in my model object,
Every time I try to do something seemingly-simple in CSS, it doesn't work. I
For some reason every time I try to count the number of rows in
I have one particular FLA that is crashing every time I try to compile
I'm using VS2008 (with windows XP). Every time I try to run a unit
I have a Visual Studio 2005 solution. Every time I try to run the
Im having some trouble with an oracle database. Every time i try to connect,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.