Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with repyhelper + httpserver #18

Closed
choksi81 opened this issue May 24, 2014 · 3 comments
Closed

Problem with repyhelper + httpserver #18

choksi81 opened this issue May 24, 2014 · 3 comments

Comments

@choksi81
Copy link
Contributor

I noticed some buggy behavior when trying to use httpserver and httpretrieve in a pure Python script using repyhelper.

There seems to be an issue with the callback function given to httpserver_registercallback() not having access certain code imported using repyhelper's translate_and_import() function. In the attached file, I try to run a simple webpage on localhost:1234 using httpserver_registercallback(). Running it with the version of httpserver.repy currently in trunk results in nothing being retrieved upon request. However, changing the break statement on line 216 of httpserver.repy to a raise causes the following exception to be thrown:

Exception (with type 'exceptions.NameError'): global name '_httpretrieve_parse_responseheaders' is not defined

For some reason, methods within httpretrieve.repy aren't accessible to the callback function.

@choksi81 choksi81 self-assigned this May 24, 2014
@choksi81
Copy link
Contributor Author

Author: justinc
Conrad: I can replicate. Can you decide where the blame lies?

It seems the break statement that is mentioned is either erroneous or a bad idea.

@choksi81
Copy link
Contributor Author

Author: cemeyer
The break statement was not casually thrown in to intentionally make it hard to debug things; instead, I realized that it made debugging things very challenging, but weighed in the consequences of raising an exception and killing the server when an exception happened. Obviously it's not written in stone and can be flipped trivially.

Although it is in this case masking an error in something else, I suppose that the real bug Evan found is in repyhelper or the namespace layer.

@choksi81
Copy link
Contributor Author

Author: justinc
I've committed a fix to repyhelper in r3485.

The problem was that names that start with '' aren't imported. I've changed repyhelper to import names that start with '', but not '' names (to avoid problems with things like __name).

On an unrelated note, content_type is undefined on line 12 of debug.py. This is just a problem with the example and doesn't impact the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant