On Feb 4, 2012, at 7:53 AM, Matloob Khushi wrote:
Hi Galaxy Developers
I aim to write a tool that will interact with Postgres database; here is what I wrote to test database connectivity. This script resides in /galaxy-dist/tools/test_tool/ and gets invoked from the front end. However script generate following error: No module named psycopg2.
Here is my code: #!/usr/bin/env python
import os.path import os from galaxy import eggs
Right here, add: eggs.require('psycopg2') --nate
from galaxy.model import * from sqlalchemy import *
engine = create_engine('postgresql://postgres:@192.168.0.6:5432/galaxy') connection = engine.connect() result_set = connection.execute( "select id from galaxy_user" ) for row in result_set: print row[ 'id' ] connection.close()
Traceback (most recent call last): File "/galaxy-dist/tools/overlapanalysis/db_test.py", line 10, in ? engine = create_engine('postgresql://postgres:@192.168.0.6:5432/galaxy') File "/galaxy-dist/eggs/SQLAlchemy-0.5.6_dev_r6498-py2.4.egg/sqlalchemy/engine/__init__.py", line 223, in create_engine return strategy.create(*args, **kwargs) File "/galaxy-dist/eggs/SQLAlchemy-0.5.6_dev_r6498-py2.4.egg/sqlalchemy/engine/strategies.py", line 62, in create dbapi = dialect_cls.dbapi(**dbapi_args) File "/galaxy-dist/eggs/SQLAlchemy-0.5.6_dev_r6498-py2.4.egg/sqlalchemy/databases/postgres.py", line 368, in dbapi import psycopg2 as psycopg ImportError: No module named psycopg2
Thanks for any help. Regards MK
___________________________________________________________ Please keep all replies on the list by using "reply all" in your mail client. To manage your subscriptions to this and other Galaxy lists, please use the interface at: