Debugging and Environment Variables
I am stuck on a minor problem that someone here could probably help me with. I have posted this a few times now and gotten no answers so ANY help is greatly appreciated. I am trying to simulate an HTTP request to the Zope Server using the techniques described in the "Testing and Debugging" chapter of the Developers Guide:
ZPublisher.Zope('') Status: 200 OK X-Powered-By: Zope (www.zope.org), Python (www.python.org) Content-Length: 1238 Content-Type: text/html
<HTML><HEAD><TITLE>Zope</TITLE> ... blah blah... </BODY></HTML>
However, I am unable to get the simulated HTTP requests to return anything when I mimic the tutorial:
ZPublisher.Zope('http://localhost:8080/')
Status: 404 Not Found ..... <P><STRONG>Resource not found</STRONG></P> Sorry, the requested resource does not exist.<p>Check the URL and try again.</p><p><b>Resource:</b> http://127.0.0.1/Zope/h ttp%3A</p> .....
I noticed that (http://127.0.0.1/Zope/h ttp%3A) is being called instead of (http://127.0.0.1:8080/). It seems that I need to set the SERVER_URL environment variable to (http://localhost:8080/). I have tried doing so like this:
ZPublisher.Zope("http://localhost:8080/", -e SERVER_URL="http://localhost:8080")
but I get a syntax error. Can ANYONE answer my (apparently) stupid questions? Do I need to set the SERVER_URL environment variable prior to debugging? Is there something wrong with my Zope installation? Am I retarded beyond belief? Thanks Everyone, Derek Basch __________________________________________________ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com
On Sun, 2003-03-30 at 10:48, Derek Basch wrote:
ZPublisher.Zope('http://localhost:8080/')
Status: 404 Not Found ..... <P><STRONG>Resource not found</STRONG></P> Sorry, the requested resource does not exist.<p>Check the URL and try again.</p><p><b>Resource:</b> http://127.0.0.1/Zope/h ttp%3A</p>
The error message says it can't find "http:". Since that's the first 5 letters of what you typed in, I'd suspect this might be your problem. And indeed it is. You're already connected to a running Zope instance, so there's no need to specify the protocol or hostname. Not only is there no need, it's wrong. You just need to specify what object you want to access, relative to the root of the process you're connected to. Try this: ZPublisher.Zope('/path/to/object') HTH, Dylan
Dylan, Thanks for the reply. I see now that I was misunderstanding how to include paths while simulating a call to an object. So, I tried what you suggested: ZPublisher.Zope('/test/index_html') and here is the traceback: <P><STRONG>Resource not found</STRONG></P> Sorry, the requested resource does not exist.<p>Check the URL and try again.</p><p><b>Resource:</b> http://127.0.0.1/Zope/test</p> It seems that it is still performing all traversals with (http://127.0.0.1/Zope) as the root with no port defined. Is this because of how the request is simulated? Suggestions? Thanks again, Derek Basch --- Dylan Reinhardt <zope@dylanreinhardt.com> wrote:
On Sun, 2003-03-30 at 10:48, Derek Basch wrote:
ZPublisher.Zope('http://localhost:8080/')
Status: 404 Not Found ..... <P><STRONG>Resource not found</STRONG></P> Sorry, the requested resource does not exist.<p>Check the URL and try again.</p><p><b>Resource:</b> http://127.0.0.1/Zope/h ttp%3A</p>
The error message says it can't find "http:". Since that's the first 5 letters of what you typed in, I'd suspect this might be your problem.
And indeed it is.
You're already connected to a running Zope instance, so there's no need to specify the protocol or hostname. Not only is there no need, it's wrong. You just need to specify what object you want to access, relative to the root of the process you're connected to.
Try this:
ZPublisher.Zope('/path/to/object')
HTH,
Dylan
__________________________________________________ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com
On Sun, 2003-03-30 at 14:52, Derek Basch wrote:
So, I tried what you suggested:
ZPublisher.Zope('/test/index_html')
and here is the traceback:
<P><STRONG>Resource not found</STRONG></P> Sorry, the requested resource does not exist.<p>Check the URL and try again.</p><p><b>Resource:</b> http://127.0.0.1/Zope/test</p>
Running Zope this way isn't an area of great expertise for me... but it seems pretty clear that you're asking for something that isn't there. Or isn't where you're looking for it, anyway. I say that because you're getting back a Zope-style error message. Throwing up a "not found" error message is correct behavior when Zope can't find the object you request. If this: ZPublisher.Zope('') returns the "Quick Start" page (or whatever root index you defined) then you can surmise that the connection to Zope is working. Any other problems you encounter probably have something to do with your request.
It seems that it is still performing all traversals with (http://127.0.0.1/Zope) as the root with no port defined. Is this because of how the request is simulated? Suggestions?
The port is irrelevant, as you're not connecting through the web. It's responding *as though* it's running on 80, but there isn't actually any port involved. You might also find this howto helpful: http://www.zope.org/Members/michel/HowTos/TheDebuggerIsYourFriend HTH, Dylan
Running Zope this way isn't an area of great expertise for me...
This seems to be no ones area of expertise. Did I pick a weird way to debug or something?
If this:
ZPublisher.Zope('')
returns the "Quick Start" page (or whatever root index you defined) then you can surmise that the connection to Zope is working. Any other problems you encounter probably have something to do with your request.
Here is the traceback from my root object request:
ZPublisher.Zope('') Status: 200 OK X-Powered-By: Zope (www.zope.org), Python (www.python.org) Content-Length: 0
I have tried this on 2 separate Zope installs and both fail to return the "Zope Quick Start" page. So, it looks like there is a fundamental flaw in how my requests are being processed. I can't believe that no one has ever run into this problem before? Suggestions?
You might also find this howto helpful: http://www.zope.org/Members/michel/HowTos/TheDebuggerIsYourFriend
Thanks for the suggestion but that is the page that got me started down this highway of confusion! Thanks for the help, Derek Basch --- Dylan Reinhardt <zope@dylanreinhardt.com> wrote:
On Sun, 2003-03-30 at 14:52, Derek Basch wrote:
So, I tried what you suggested:
ZPublisher.Zope('/test/index_html')
and here is the traceback:
<P><STRONG>Resource not found</STRONG></P> Sorry, the requested resource does not exist.<p>Check the URL and try again.</p><p><b>Resource:</b> http://127.0.0.1/Zope/test</p>
Running Zope this way isn't an area of great expertise for me... but it seems pretty clear that you're asking for something that isn't there. Or isn't where you're looking for it, anyway.
I say that because you're getting back a Zope-style error message. Throwing up a "not found" error message is correct behavior when Zope can't find the object you request.
If this:
ZPublisher.Zope('')
returns the "Quick Start" page (or whatever root index you defined) then you can surmise that the connection to Zope is working. Any other problems you encounter probably have something to do with your request.
It seems that it is still performing all
traversals
with (http://127.0.0.1/Zope) as the root with no port defined. Is this because of how the request is simulated? Suggestions?
The port is irrelevant, as you're not connecting through the web. It's responding *as though* it's running on 80, but there isn't actually any port involved.
You might also find this howto helpful:
http://www.zope.org/Members/michel/HowTos/TheDebuggerIsYourFriend
HTH,
Dylan
__________________________________________________ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com
On Mon, 2003-03-31 at 08:31, Derek Basch wrote:
Running Zope this way isn't an area of great expertise for me...
This seems to be no ones area of expertise. Did I pick a weird way to debug or something?
Well... it doesn't appear to offer a lot of advantages over debugging with a web client. I may be missing something critical, but I find the development cycle is much faster when debugging on a live instance... particularly when what I'm debugging creates layouts or other visual artifacts.
Here is the traceback from my root object request:
ZPublisher.Zope('') Status: 200 OK X-Powered-By: Zope (www.zope.org), Python (www.python.org) Content-Length: 0
I have tried this on 2 separate Zope installs and both fail to return the "Zope Quick Start" page. So, it looks like there is a fundamental flaw in how my requests are being processed. I can't believe that no one has ever run into this problem before? Suggestions?
Fire up Zope and connect with a local web browser? Testing is all well and good, but if you're having difficulty troubleshooting your testing environment, it might be better to just take an easier route. Interacting with the ZMI may also provide some insight... tough to say.
You might also find this howto helpful: http://www.zope.org/Members/michel/HowTos/TheDebuggerIsYourFriend
Thanks for the suggestion but that is the page that got me started down this highway of confusion!
Oh... well, maybe the debugger isn't *your* friend after all... :-) Dylan
I may be missing something critical, but I find the development cycle is much faster when debugging on a live instance...
I also prefer to debug on a live instance. However, I am attempting to debug someone else's product: http://www.zope.org/Members/mwoj/kinterbasdbDA I need to know the value of a variable that is generated during the usage of kinterbasdbDA and have not had much luck returning the variable value in a live session.
Fire up Zope and connect with a local web browser?
Works fine. I think that the debugger really could be my friend if I could just get ZPublisher.Zope() to return something. Perhaps I should submit another request to the list titled: "Does Zope Debugging Even Work??" If you know of any Zopers who might be able to help me (and the community) out I would greatly appreciate you forwarding this to them. Thanks for everything Dylan, Derek Basch --- Dylan Reinhardt <zope@dylanreinhardt.com> wrote:
On Mon, 2003-03-31 at 08:31, Derek Basch wrote:
Running Zope this way isn't an area of great expertise for me...
This seems to be no ones area of expertise. Did I pick a weird way to debug or something?
Well... it doesn't appear to offer a lot of advantages over debugging with a web client. I may be missing something critical, but I find the development cycle is much faster when debugging on a live instance... particularly when what I'm debugging creates layouts or other visual artifacts.
Here is the traceback from my root object request:
ZPublisher.Zope('') Status: 200 OK X-Powered-By: Zope (www.zope.org), Python (www.python.org) Content-Length: 0
I have tried this on 2 separate Zope installs and both fail to return the "Zope Quick Start" page. So, it looks like there is a fundamental flaw in how my requests are being processed. I can't believe that no one has ever run into this problem before? Suggestions?
Fire up Zope and connect with a local web browser?
Testing is all well and good, but if you're having difficulty troubleshooting your testing environment, it might be better to just take an easier route. Interacting with the ZMI may also provide some insight... tough to say.
You might also find this howto helpful:
http://www.zope.org/Members/michel/HowTos/TheDebuggerIsYourFriend
Thanks for the suggestion but that is the page
that
got me started down this highway of confusion!
Oh... well, maybe the debugger isn't *your* friend after all... :-)
Dylan
__________________________________________________ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com
On Mon, 2003-03-31 at 10:00, Derek Basch wrote:
I may be missing something critical, but I find the development cycle is much faster when debugging on a live instance...
I also prefer to debug on a live instance. However, I am attempting to debug someone else's product:
Ah... somehow I had gotten the impression you were trying to test new installations. My apologies for suggesting the obvious.
http://www.zope.org/Members/mwoj/kinterbasdbDA
I need to know the value of a variable that is generated during the usage of kinterbasdbDA and have not had much luck returning the variable value in a live session.
In many cases you can do something like: if error_condition: raise 'my_variable is: %s' % my_variable But more generally, you'll probably want to use pdb: http://www.zopelabs.com/cookbook/1034779450
Perhaps I should submit another request to the list titled:
"Does Zope Debugging Even Work??"
Not a bad idea... though Python's debugging is good enough that I suspect it may not matter. Dylan
Dylan Reinhardt wrote at 2003-3-31 09:36 -0800:
You might also find this howto helpful: http://www.zope.org/Members/michel/HowTos/TheDebuggerIsYourFriend
Thanks for the suggestion but that is the page that got me started down this highway of confusion!
Oh... well, maybe the debugger isn't *your* friend after all... :-)
Sometimes, it is not. Of course, presentation problems are not fixed by means of a debugger ;-) But for some problems, a debugger makes analysis much simpler and sometimes possible. This is the case whenever you have complex logic which does not work as it should. Dieter
participants (3)
-
Derek Basch -
Dieter Maurer -
Dylan Reinhardt