I may have found it, by adding the assignment "isLeaf = True" to the DelayedResponse class it also appears to work. However many of the examples in the documentation do not assign "isLeaf = True". Would this also explain the difference in behaviour?
-Jason Cell: 604 644 8611 Email: [email protected] LinkedIn: http://www.linkedin.com/in/drjasonharrison Twitter: http://twitter.com/drjasonharrison On Wed, Aug 8, 2018 at 1:19 PM, Jason Harrison <[email protected]> wrote: > > On Wed, 8 Aug 2018 at 11:58 AM Jean-Paul Calderone < >> [email protected]> wrote: > > One possible explanation is that it has nothing to do with import time per >> se. Instead, *any* change to your source file would have fixed the >> problem. This could be because you had "stale" pyc files lying around >> (cached bytecode the interpreter *thought* was up-to-date with your source >> but was actually outdated). It could also be that your server process was >> left running and was still using your old code. Then, for some reason, >> after you added the import time your server got the new version of the >> code >> (perhaps you're relying on an auto-reloader and it missed a change, for >> example, or you just forgot to restart the server yourself). >> >> import time itself is definitely not a requirement for arbitrary Twisted >> Web-based programs to return a response other than 404. >> >> Jean-Paul >> >> > Hi Jean-Paul, > > I made many changes to the example in order to get it to work. So perhaps > it's a caching issue, but I can't find any caches. Here's what I'm > developing on: > > - OSX 10.13.6 > - I'm using Sublime text, no auto reloaders afaik > - python3 --version : Python 3.7.0 > - pip3 list: > > Package Version > -------------- ------- > attrs 18.1.0 > Automat 0.7.0 > constantly 15.1.0 > dlib 19.15.0 > hyperlink 18.0.0 > idna 2.7 > incremental 17.5.0 > numpy 1.15.0 > pip 18.0 > PyHamcrest 1.9.0 > setuptools 39.2.0 > six 1.11.0 > Twisted 18.7.0 > wheel 0.31.1 > zope.interface 4.5.0 > > - running the server using ./asynchronous.py > - I don't have any .pyc files in the script directory, possibly because I > "chmod +x" the source file and included the #! at the top > - I added logging and while the main program (setup of Twisted reactor) > logged, the DelayedResource class did not > - I added parts of the example at https://twistedmatrix.com/ > documents/current/web/howto/web-in-60/dynamic-content.html > - I changed "resource = DelayedResource()" to "resource = ClockPage()" > - I changed the render_GET handler to return the Clock page example output > - etc until I stopped getting a 404 > - I restarted the server many many times > > I removed and backed out every change until I got a 404, concluding it was > the "import time" line. > Any other ideas? >
_______________________________________________ Twisted-web mailing list [email protected] https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
