reloading broken in 0.21

Bug #118683 reported by Aaron Swartz
4
Affects Status Importance Assigned to Milestone
web.py
Fix Released
High
Anand Chitipothu
Tags: iso-testing
Changed in webpy:
importance: Undecided → High
Changed in webpy:
status: New → In Progress
assignee: nobody → anandology
Changed in webpy:
status: In Progress → Fix Committed
Revision history for this message
Jonathan Tapicer (tapicer) wrote :

Hello, using webpy with the revision 181 where this bug is supossedly fixed I get this error:

====================================================
Traceback (most recent call last):
  File "/home/tapicer/eclipse_workspace/py_test/src/test/main.py", line 27, in <module>
    if __name__ == "__main__": web.run(urls, globals(), web.reloader)
  File "/home/tapicer/eclipse_workspace/py_test/src/web/request.py", line 154, in run
    return wsgi.runwsgi(webapi.wsgifunc(webpyfunc(inp, fvars, autoreload), *middleware))
  File "/home/tapicer/eclipse_workspace/py_test/src/web/request.py", line 127, in webpyfunc
    mod = __import__(modname(), None, None, [""])
ImportError: No module named /home/tapicer/eclipse_workspace/py_test/src/test/main
====================================================

The code I use looks like this:

====================================================
import web

class hello:
    def GET(self):
        print 'Hello'

urls = (
    '/', 'hello'
)

web.webapi.internalerror = web.debugerror
if __name__ == "__main__": web.run(urls, globals(), web.reloader)
====================================================

I've found that the reloader only fails with the main file, if I change the function webpyfunc on request.py to return the name of my main module in the inner function modname (instead of a way that tries to guess it but fails), I think it is because the function (modname) is returning the full path of the module instead of the name. I'm running it on linux and eclipse with pydev if it that helps.

I fixed it replacing this line of request.py:

name = os.path.splitext(file)[0] #(line 123)

with this:

name = os.path.splitext(file)[0].split(os.path.sep)[-1]

Is this problem related with a bad usage of the reloader or is it really a bug?

Thanks.

Revision history for this message
Anand Chitipothu (anandology) wrote : Re: [Bug 118683] Re: reloading broken in 0.21

fixed. (hopefully!)

On 18-Aug-07, at 6:21 AM, Jonathan Tapicer wrote:

> Hello, using webpy with the revision 181 where this bug is supossedly
> fixed I get this error:
>
> ====================================================
> Traceback (most recent call last):
> File "/home/tapicer/eclipse_workspace/py_test/src/test/main.py",
> line 27, in <module>
> if __name__ == "__main__": web.run(urls, globals(), web.reloader)
> File "/home/tapicer/eclipse_workspace/py_test/src/web/
> request.py", line 154, in run
> return wsgi.runwsgi(webapi.wsgifunc(webpyfunc(inp, fvars,
> autoreload), *middleware))
> File "/home/tapicer/eclipse_workspace/py_test/src/web/
> request.py", line 127, in webpyfunc
> mod = __import__(modname(), None, None, [""])
> ImportError: No module named /home/tapicer/eclipse_workspace/
> py_test/src/test/main
> ====================================================
>
> The code I use looks like this:
>
> ====================================================
> import web
>
> class hello:
> def GET(self):
> print 'Hello'
>
> urls = (
> '/', 'hello'
> )
>
> web.webapi.internalerror = web.debugerror
> if __name__ == "__main__": web.run(urls, globals(), web.reloader)
> ====================================================
>
> I've found that the reloader only fails with the main file, if I
> change
> the function webpyfunc on request.py to return the name of my main
> module in the inner function modname (instead of a way that tries to
> guess it but fails), I think it is because the function (modname) is
> returning the full path of the module instead of the name. I'm running
> it on linux and eclipse with pydev if it that helps.
>
> I fixed it replacing this line of request.py:
>
> name = os.path.splitext(file)[0] #(line 123)
>
> with this:
>
> name = os.path.splitext(file)[0].split(os.path.sep)[-1]
>
> Is this problem related with a bad usage of the reloader or is it
> really
> a bug?
>
> Thanks.
>
> --
> reloading broken in 0.21
> https://bugs.launchpad.net/bugs/118683
> You received this bug notification because you are a bug assignee.

Revision history for this message
Jonathan Tapicer (tapicer) wrote :

Ok, after that fix reloading works fine for both the main file and the rest of the files.
Thanks for the quick response.
Bye.

Changed in webpy:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.