0

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).

arthur.sw
  • 11,052
  • 9
  • 47
  • 104

2 Answers2

1

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()
arthur.sw
  • 11,052
  • 9
  • 47
  • 104
0

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.

ascripter
  • 5,665
  • 12
  • 45
  • 68
J.Doe
  • 1
  • 1