Try "import psycopg2" within scrapy shell.

Perhaps you have multiple python installations and the scrapy one does not
have psycopg2.


On Fri, Jan 31, 2014 at 8:10 AM, AritzBi <[email protected]> wrote:

> I am trying to store some scrapy items in a PostgreSQL database. I am
> doing it in the pipelines.py file but when I try to import the psycogp2
> driver I get the following error:
>
> Error loading object 'demo.pipelines.EventPipeline': No module named
> psycopg2.
>
> I am running it in OS X and I know it is already installed because I have
> been doing tests in a separate file and when I try to make the import in
> the python console doesn't throw an exception.
>
> This is the code of the pipelines.py file:
>
> import sysimport psycopg2
> class EventPipeline(object):
>     def __init__(self):
>         conn_string = "host='localhost' dbname='mydb' user='user' 
> password='user'"
>         print "Connecting to database\n ->%s" % (conn_string)
>         conn = psycopg2.connect(conn_string)
>         cursor = conn.cursor()
>     def process_item(self,item,spider):
>         locationDenom=item['location']
>
> I will appreciate any help...
>
>
> Thank you very much.
>
> --
> You received this message because you are subscribed to the Google Groups
> "scrapy-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/scrapy-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"scrapy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/scrapy-users.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to