arthur.sw
arthur.sw

Reputation: 11629

Cannot import name psyco_gevent

I have an import error with

from psycogreen.gevent import psyco_gevent
psyco_gevent.make_psycopg_green()

it says:

ImportError: cannot import name psyco_gevent

I installed psycopg2 and psycogreen; and I followed this nice article about Django, Gevent, and Socket.io. This article also talks about it (it might be the source of the first article) and talks about a file named psyco_gevent.py on bitbucket which is not available anymore (404 error).

Upvotes: 0

Views: 504

Answers (2)

J.Doe
J.Doe

Reputation: 1

I suffer from a similar question like this when I import a model named as greenlet:

ImportError: cannot import name 'greenlet'

I don't know exactly the reason but I resolved the problem by renaming the file name greenlet.py to gl.py. Maybe we can't name a file by a model's name.

Upvotes: 0

arthur.sw
arthur.sw

Reputation: 11629

For the psycogreen, it does look like its changed a bit. Check it out on bitbucket: https://bitbucket.org/dvarrazzo/psycogreen/overview

It looks like this code:

from psycogreen.gevent import psyco_gevent
psyco_gevent.make_psycopg_green()

Should be changed to the same as the other psycogreen calls:

from psycogreen.gevent import patch_psycopg
patch_psycopg()

Upvotes: 2

Related Questions