sdiehl / gevent-tutorial Goto Github PK
View Code? Open in Web Editor NEWGevent tutorial for the Working Python Developer
Home Page: sdiehl.github.com/gevent-tutorial
Gevent tutorial for the Working Python Developer
Home Page: sdiehl.github.com/gevent-tutorial
Traceback (most recent call last):
File "/home/vagrant/.py_venvs/test/local/lib/python2.7/site-packages/gevent/greenlet.py", line 390, in run
result = self._run(*self.args, **self.kwargs)
File "gzmq.py", line 19, in client
client_socket = context.socket(zmq.REP)
File "/home/vagrant/.py_venvs/test/local/lib/python2.7/site-packages/zmq/sugar/context.py", line 82, in socket
s = self._socket_class(self, socket_type)
File "/home/vagrant/.py_venvs/test/local/lib/python2.7/site-packages/gevent_zeromq/core.py", line 36, in __init__
self.__in_send_multipart = False
File "/home/vagrant/.py_venvs/test/local/lib/python2.7/site-packages/zmq/sugar/attrsettr.py", line 38, in __setattr__
self.__class__.__name__, upper_key)
AttributeError: GreenSocket has no such option: _GREENSOCKET__IN_SEND_MULTIPART
<Greenlet at 0x7f678ba41910: client> failed with AttributeError
There seem to be several small issues with the sidebar. One of them is that when I click on Core>Timeouts, what actually becomes bold is either "Program Shutdown" or "Monkeypatching". The page scrolls to the right anchor, but the highlighting in the TOC is shifted. I'm using Firefox 18.
I was playing around with the subsections in "Data Structures" (when building new versions of the tutorial) and observed the same behavior there when more than 7 subsections were existing in that section.
There's pool.start() call in SocketPool, but that's not right: Pool.start() accepts 1 argument.
Following your tutorial and learning gevent, i am translating to spanish.
https://github.com/ovnicraft/gevent-tutorial
On gevent tutorial page it say:
"gevent is a concurrency library based around libev. It provides a clean API for a variety of concurrency and network related tasks."
Gevent is based on libevent (http://libevent.org/) and NOT libev (http://software.schmorp.de/pkg/libev.html). Check out http://www.gevent.org/ for more information.
Quick reference:
"gevent is a coroutine-based Python networking library that uses greenlet to provide a high-level synchronous API on top of the libevent event loop."
The Program Shutdown section suggests coupling gevent.event with gevent.shutdown to cause a program to exit immediately. gevent.shutdown doesn't exist in gevent 1.0b2, and it seems that this behavior is builtin autoamatically now (through the use of gevent.hub.Hub.SYSTEM_ERROR.
It would be nice if the tutorial mentioned this (or alternatively mentioned the tutorial was written for gevent 0.13.7 or earlier) as not to cause confusion when an AttributeError is raised.
A couple times in the tutorial, the word 'emplict' is used.
e.g.:
print('Emplict context switch to foo again')
I'm not exactly sure that's a word. (At least I can't find any reference to it in dictionaries/online.)
Trying to figure it out from the context... but is the use of 'emplict' supposed to mean 'implicit' or 'explicit'?
First example code of this section raises exception on 1.0rc2
.
AttributeError: 'NoneType' object has no attribute 'value'
And AFAIK gevent.Greenlet.join
returns None
regardless.
When I run to build:
~$ ./build
Traceback (most recent call last):
File "/Users/G_will/Works/python/gevent-tutorial/lib/python2.7/site-packages/gevent/greenlet.py", line 390, in run
result = self._run(*self.args, **self.kwargs)
File "tutorial.md+367", line 8, in fail
Exception: You fail at failing.
<Greenlet at 0x1066af4b0: fail> failed with Exception
Wrote index.html
What's wrong? The output index.html seems right.
Hi,
great stuff, thanks for working on it.
There's some confusion about libev and libevent. Let me clarify.
gevent 0.x is based on libevent. libevent includes and http servers. gevent 0.x provides wrappers for (gevent.http and gevent.wsgi modules). There's also pure Python WSGI server, called gevent.pywsgi
gevent 1.x is based on libev. libev does not have an HTTP server bundled and we currently don't have a replacement. so gevent.http is missing from gevent 1.x and gevent.wsgi is an alias for gevent.pywsgi.
This sentence is wrong: "wsgi is a Python bridge to libev's very fast HTTP server.", as you see from above, libev has no fast HTTP server and gevent 1.x currently has only pure Python HTTP server which is not as fast as gevent 0.x's gevent.wsgi is.
The code example using Multiprocessing with wait_write and wait_read does not work on Windows (tested on Windows 7).
In Gevent 1.0b2, an example error message is:
IOError: 496 is not a socket (files are not supported)
<Greenlet at 0x2e30a60L: get_msg> failed with IOError
In pre1.0 versions of gevent the error is less specific:
IOError: [Errno 2] No such file or directory
I am curious about the underlying reason for the errors. I know Windows lacks the "socket is a socket" functionality of POSIX, but in vanilla python select() works with Multiprocessing pipes... I haven't looked too deeply at the issue but I suppose the standard library uses WinSock for the pipes and gevent does not?
Full traceback here:
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\gevent\greenlet.py", line 328, in run
result = self._run(*self.args, **self.kwargs)
File "C:\Users\user\Desktop\prj\gevent_multiprocess_example.py", line 23, in get_msg
wait_read(d.fileno())
File "C:\Python27\lib\site-packages\gevent\socket.py", line 160, in wait_read
io = get_hub().loop.io(fileno, 1)
File "core.pyx", line 406, in gevent.core.loop.io (gevent/gevent.core.c:6413)
File "core.pyx", line 656, in gevent.core.io.__init__ (gevent/gevent.core.c:10369)
IOError: 496 is not a socket (files are not supported)
<Greenlet at 0x2e30a60L: get_msg> failed with IOError
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.