Skip to content

autoreload fails when running module within package #175

Vultaire opened this Issue Aug 17, 2012 · 1 comment

1 participant


I've encountered issues with autoreload when running a module within a package. (python -m package.module <port>)

I've written an SSCCE which demonstrates this. I expected to get the response "Hello World!", but instead I got:

<type 'exceptions.ImportError'> at /
No module named mymodule

SSCCE follows below.

Best Regards,
Paul Goins


Folder structure:


myapp/ is empty.


import web

class Hello(object):
    def GET(self):
        return "Hello world!"

urls = (
    '/', Hello,

if __name__ == "__main__":
    app = web.application(urls, globals())

Execute via:

python -m myapp.mymodule <port>


Any of the following seem to work:

  • Moving the web.application creation code into a separate module.
  • Editing PYTHONPATH to include the directory within the package containing the module being run.
  • Setting web.config.debug to False.

Forgot to mention (although it may be obvious to most): the error occurs not when starting the above program, but when accessing it through a browser. The error appears browser-side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.