-
Notifications
You must be signed in to change notification settings - Fork 29
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
python and python3 wrappers for logging, sys.excepthook and WSGI #20
Conversation
Reviewing... |
I don't understand, why is it required that we It seems to me that we already rely on global variable |
What will happen to legacy Python services? Will they still work with this new code? |
I don't require |
The very first thing you show me is this:
That is a user service which requires |
User services shouldn't have to require hook.io. JavaScript services don't work that way...neither do any of the other languages. |
You are able to do this. You are not required to do this. |
Understood! Thank you. Will have time to review this weekend. |
After adjusting a few lines, I was just able to get this to work! Very cool. Thank you for your contributions. I need to do more review and more testing, but I will attempt to get this work merged into master and deployed soon. Would be good if we could get a few other comments on this thread for other python developers. |
Looking good. I'm getting closer to getting this merged. Can you provide any examples of doing a binary data request with python? Like using |
I'm getting an error for the Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.4.3_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 138, in run
self.finish_response()
File "/usr/local/Cellar/python3/3.4.3_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 180, in finish_response
self.write(data)
File "/usr/local/Cellar/python3/3.4.3_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 266, in write
"write() argument must be a bytes instance"
AssertionError: write() argument must be a bytes instance
Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.4.3_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 138, in run
self.finish_response()
File "/usr/local/Cellar/python3/3.4.3_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 180, in finish_response
self.write(data)
File "/usr/local/Cellar/python3/3.4.3_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 266, in write
"write() argument must be a bytes instance"
AssertionError: write() argument must be a bytes instance
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/a/dev/stackvana/microcule/bin/binaries/micro-python3", line 21, in <module>
exec(code)
File "<string>", line 15, in <module>
File "/usr/local/Cellar/python3/3.4.3_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 141, in run
self.handle_error()
File "/usr/local/Cellar/python3/3.4.3_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 368, in handle_error
self.finish_response()
File "/usr/local/Cellar/python3/3.4.3_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 180, in finish_response
self.write(data)
File "/usr/local/Cellar/python3/3.4.3_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 279, in write
self._write(data)
File "/usr/local/Cellar/python3/3.4.3_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 453, in _write
self.stdout.write(data)
TypeError: must be str, not bytes
Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.4.3_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 138, in run
self.finish_response()
File "/usr/local/Cellar/python3/3.4.3_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 180, in finish_response
self.write(data)
File "/usr/local/Cellar/python3/3.4.3_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 266, in write
"write() argument must be a bytes instance"
AssertionError: write() argument must be a bytes instance
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/a/dev/stackvana/microcule/bin/binaries/micro-python3", line 21, in <module>
exec(code)
File "<string>", line 15, in <module>
File "/usr/local/Cellar/python3/3.4.3_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 141, in run
self.handle_error()
File "/usr/local/Cellar/python3/3.4.3_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 368, in handle_error
self.finish_response()
File "/usr/local/Cellar/python3/3.4.3_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 180, in finish_response
self.write(data)
File "/usr/local/Cellar/python3/3.4.3_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 279, in write
self._write(data)
File "/usr/local/Cellar/python3/3.4.3_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 453, in _write
self.stdout.write(data)
TypeError: must be str, not bytes Any ideas? Is |
Good news everyone! Merged with db31d6c Should be included in the upcoming |
I'll check WSGI specs for py3. Maybe it required to return bytes (string encoded to 8bit encoding - usually utf8). Then I should change example. |
I have merged this all into master ( minus py3 wsgi examples ). Thank you for your contributions. This is very good! |
This is only preliminary changes.
Python hook can now be like this:
Old format supported too.
Python module
microcule
injected alongside luajson
module.Limitations:
Hook['isHookio']==True
is supported, but not tested.