I copied entire web folder of web.py-0.34 to code.py folder and thus
solved import web issue.

But now I am having issue with sqlite3. How to solve sqlite issue?

Please help

On Feb 18, 7:24 pm, harsha <[email protected]> wrote:
> I am new with GAE. Started with installing python 2.7.1 and
> GoogleAppEngine-1.4.2 on Windows 7.
> And I am using SQLite 3. Then I followed instructions on Web.py site to
> install web module. python setup.py install
>
> When I import web module on python console it works as expected
>
> $python
> Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)]
> on win32
> Type "help", "copyright", "credits" or "license" for more information.
>
> >>> import web
>
> I created a sample application using web.py framework. Here is my code.py
> ==============================================================
> import os
> import web
> from web import form
>
> os.path.join(os.path.dirname(__file__), 'templates/')
>
> render = web.template.render('templates/')
> db = web.database(dbn='sqlite', db='testdb')
>
> urls = (
> '/', 'index',
> '/todo(/?|/edit/?|/delete/?)(\d*)', 'todo'
> )
> app = web.application(urls, globals())
>
> class index:
> def GET(self):
> return render.index()
>
> class todo:
> def GET(self,mode,args):
> if args:
> items = db.select('todo',where='id={0}'.format(args))
> item = items[0]
> todoform = form.Form(
> form.Textbox("id", value=item.id),
> form.Textarea("title", form.notnull, value=item.title),
> form.Textbox("created", value=item.created),
> form.Checkbox('done', checked=(item.done!='f')))
> return render.todo_item(todoform(),mode)
>
> todos = db.select('todo')
> return render.todo(todos)
>
> def POST(self,mode,args):
> i = web.input()
> if args:
> if mode == "/delete/":
> n = db.delete('todo', where='id={0}'.format(args))
> raise web.seeother('/todo')
> if mode == "/edit/":
> taskdone = "t" if (i.has_key('done')) else "f"
> n = db.update('todo', where='id={0}'.format(args), title=i.title,
> done=taskdone )
> raise web.seeother('/todo')
> else:
> n = db.insert('todo', title=i.title)
> raise web.seeother('/todo')
>
> if __name__ == "__main__": app.run()
> ==============================================================
>
> And this code works as expected when I start server from command line
>
> ==============================================================
> $python code.pyhttp://0.0.0.0:8080/
> 127.0.0.1:24480 - - [18/Feb/2011 19:45:37] "HTTP/1.1 GET /" - 200 OK
> 127.0.0.1:24480 - - [18/Feb/2011 19:45:42] "HTTP/1.1 GET /" - 200 OK
> 0.02 (1): SELECT * FROM todo
> 127.0.0.1:24480 - - [18/Feb/2011 19:45:43] "HTTP/1.1 GET /todo" - 200 OK
> 0.0 (1): SELECT * FROM todo WHERE id=2
> 127.0.0.1:24480 - - [18/Feb/2011 19:45:51] "HTTP/1.1 GET /todo/edit/2" - 200
> OK
> 0.0 (1): UPDATE todo SET done = 't', title = 'Learn how to insert.s' WHERE
> id=2
> 127.0.0.1:24489 - - [18/Feb/2011 19:46:03] "HTTP/1.1 POST /todo/edit/2" -
> 303 See Other
> 0.0 (1): SELECT * FROM todo
> 127.0.0.1:24491 - - [18/Feb/2011 19:46:03] "HTTP/1.1 GET /todo" - 200 OK
> 0.0 (1): SELECT * FROM todo WHERE id=2
> 127.0.0.1:24504 - - [18/Feb/2011 19:46:17] "HTTP/1.1 GET /todo/delete/2" -
> 200 OK
> 0.0 (1): DELETE FROM todo WHERE id=2
> 127.0.0.1:24504 - - [18/Feb/2011 19:46:19] "HTTP/1.1 POST /todo/delete/2" -
> 303 See Other
> 0.0 (1): SELECT * FROM todo
> 127.0.0.1:24505 - - [18/Feb/2011 19:46:19] "HTTP/1.1 GET /todo" - 200 OK
> 0.0 (1): INSERT INTO todo (title) VALUES ('sd')
> 0.0 (2): SELECT last_insert_rowid();
> 127.0.0.1:24505 - - [18/Feb/2011 19:46:27] "HTTP/1.1 POST /todo" - 303 See
> Other
> 0.0 (1): SELECT * FROM todo
> 127.0.0.1:24511 - - [18/Feb/2011 19:46:28] "HTTP/1.1 GET /todo" - 200 OK
> ==============================================================
>
> Then to deploy I added app.yaml and index.yaml files in same folder as
> code.py
>
> When I run dev_appserver.py  I get *    import web **ImportError: No module
> named web*
> *
> *
> $dev_appserver.py webpy
> INFO     2011-02-18 14:21:58,562 appengine_rpc.py:153] Server:
> appengine.google.com
> INFO     2011-02-18 14:21:58,568 appcfg.py:413] Checking for updates to the
> SDK.
> INFO     2011-02-18 14:22:01,757 appcfg.py:422] Update check failed:
> <urlopen error timed out>
> WARNING  2011-02-18 14:22:01,759 datastore_file_stub.py:573] Could not read
> datastore data from c:\users\insrt3\appdata\local\temp\dev_appserver.datas
> WARNING  2011-02-18 14:22:01,792 dev_appserver.py:3700] Could not initialize
> images API; you are likely missing the Python "PIL" module. ImportError:
> e named _imaging
> INFO     2011-02-18 14:22:01,803 dev_appserver_main.py:507] Running
> application rajeevtreddy on port 8080:http://localhost:8080
> ERROR    2011-02-18 14:22:03,979 dev_appserver.py:3285] Exception
> encountered handling request
> Traceback (most recent call last):
>   File "C:\Program
> Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line
> 3245, in _HandleRequest
>     self._Dispatch(dispatcher, self.rfile, outfile, env_dict)
>   File "C:\Program
> Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line
> 3186, in _Dispatch
>     base_env_dict=env_dict)
>   File "C:\Program
> Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line
> 531, in Dispatch
>     base_env_dict=base_env_dict)
>   File "C:\Program
> Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line
> 2410, in Dispatch
>     self._module_dict)
>   File "C:\Program
> Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line
> 2320, in ExecuteCGI
>     reset_modules = exec_script(handler_path, cgi_path, hook)
>   File "C:\Program
> Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line
> 2216, in ExecuteOrImportScript
>     exec module_code in script_module.__dict__
>   File "D:\source\webpy\code.py", line 2, in <module>
>     import web
> ImportError: No module named web
> INFO     2011-02-18 14:22:03,986 dev_appserver.py:3317] "GET /todo HTTP/1.1"
> 500 -
> ERROR    2011-02-18 14:22:05,263 dev_appserver.py:3285] Exception
> encountered handling request
> Traceback (most recent call last):
>   File "C:\Program
> Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line
> 3245, in _HandleRequest
>     self._Dispatch(dispatcher, self.rfile, outfile, env_dict)
>   File "C:\Program
> Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line
> 3186, in _Dispatch
>     base_env_dict=env_dict)
>   File "C:\Program
> Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line
> 531, in Dispatch
>     base_env_dict=base_env_dict)
>   File "C:\Program
> Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line
> 2410, in Dispatch
>     self._module_dict)
>   File "C:\Program
> Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line
> 2320, in ExecuteCGI
>     reset_modules = exec_script(handler_path, cgi_path, hook)
>   File "C:\Program
> Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line
> 2216, in ExecuteOrImportScript
>     exec module_code in script_module.__dict__
>   File "D:\source\webpy\code.py", line 2, in <module>
> *    import web*
> *ImportError: No module named web*
>
> What am I doing wrong. Please help me?

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/webpy?hl=en.

Reply via email to