Are you using the shell in the web browser, accessed via the Admin app, or the command line shell?
There are currently some limitations in the browser-based shell that prevent things like database connections and open file handles from working. (Speaking more precisely, the online shell can only store variables comprising entirely of objects that can be serialized with Python's "pickle" module.) A week or two ago I proposed some changes to the online shell that would remove these limitations and never heard back from anyone about it. However, I'm now searching for the post and can't find it, so perhaps the post never actually made it up. I'll pull together my notes and post again when I have a chance. Anyway, to solve your immediate problem, I believe you want to use the command line web2py/python shell instead. Assuming you are running the source distribution of web2py, open a command prompt / terminal, cd to your web2py directory, and run: python web2py.py --shell=welcome This launches an interactive shell in the context of the "welcome" application. You may replace this with your own application name if you wish. If you run into trouble, re-post with your operating system and which distribution of web2py you are running (source, Windows, or Mac) and I can give you more specific instructions. Kevin

