Unable to import package over NFS in solaris

A

Ashok

Hi,

I have sqlalchemy package installed on the server. However I want to
run a script on the client that uses the sqlalchemy package. Hence I
shared the directory containing the sqlalchemy unsing NFS. Then I
added the NFS pathname to the sqlalchemy packege in the client
program. Now when I import sqlalchemy in the client program it throws
the following error.

Traceback (most recent call last):
File "/net/sqlhost/ashok/send.py", line 9, in ?
from sqlalchemy import *
ImportError: No module named sqlalchemy


I have added the NFS path to the PYTHONPATH as folllows in my program.

#!/usr/bin/python

import os,commands,sys

os.environ['PYTHONPATH']='/net/sqlhost/usr/lib/python2.4/site-packages/
SQLAlchemy-0.5.6-py2.4.egg/sqlalchemy'
sys.path.append('/net/sqlhost/usr/lib/python2.4/site-packages/
SQLAlchemy-0.5.6-py2.4.egg/sqlalchemy')
from sqlalchemy import *

Contents of the directory shared under NFS in Solaris.

bash-3.00# ls /usr/lib/python2.4/site-packages/SQLAlchemy-0.5.6-
py2.4.egg/sqlalchemy/
__init__.py engine ext log.py
pool.py queue.pyc sql topological.pyc
util.py
__init__.pyc exc.py interfaces.py log.pyc
pool.pyc schema.py test types.py
util.pyc
databases exc.pyc interfaces.pyc orm
queue.py schema.pyc topological.py types.pyc

Please let me know what went wrong?

thx,
~Ashok.
 
J

Jeff McNeil

Hi,

I have sqlalchemy package installed on the server. However I want to
run a script on the client that uses the sqlalchemy package. Hence I
shared the directory containing the sqlalchemy unsing NFS. Then I
added the NFS pathname to the sqlalchemy packege in the client
program. Now when I import sqlalchemy in the client program it throws
the following error.

Traceback (most recent call last):
  File "/net/sqlhost/ashok/send.py", line 9, in ?
    from sqlalchemy import *
ImportError: No module named sqlalchemy

I have added the NFS path to the PYTHONPATH as folllows in my program.

#!/usr/bin/python

import os,commands,sys

os.environ['PYTHONPATH']='/net/sqlhost/usr/lib/python2.4/site-packages/
SQLAlchemy-0.5.6-py2.4.egg/sqlalchemy'
sys.path.append('/net/sqlhost/usr/lib/python2.4/site-packages/
SQLAlchemy-0.5.6-py2.4.egg/sqlalchemy')
from sqlalchemy import *

Contents of the directory shared under NFS in Solaris.

bash-3.00# ls /usr/lib/python2.4/site-packages/SQLAlchemy-0.5.6-
py2.4.egg/sqlalchemy/
__init__.py      engine           ext              log.py
pool.py          queue.pyc        sql              topological.pyc
util.py
__init__.pyc     exc.py           interfaces.py    log.pyc
pool.pyc         schema.py        test             types.py
util.pyc
databases        exc.pyc          interfaces.pyc   orm
queue.py         schema.pyc       topological.py   types.pyc

Please let me know what went wrong?

thx,
~Ashok.

You don't need the additional 'sqlalchemy' after the '/net/sqlhost/usr/
lib/python2.4/site-packages/
SQLAlchemy-0.5.6-py2.4.egg/' path. Using your configuration, Python
is looking for:

/net/sqlhost/usr/lib/python2.4/site-packages/
SQLAlchemy-0.5.6-py2.4.egg/sqlalchemy/sqlalchemy/

As an example, see below. Note that this is in a virtual environment
that is not part of sys.path by default (I didn't run bin/activate).

[jeff@marvin ~]$ export PYTHONPATH=/home/jeff/Work/hostapi/lib/
python2.6/site-packages/SQLAlchemy-0.5.5-py2.6.egg/sqlalchemy/
[jeff@marvin ~]$ python -c 'import sqlalchemy'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named sqlalchemy
[jeff@marvin ~]$ export PYTHONPATH=/home/jeff/Work/hostapi/lib/
python2.6/site-packages/SQLAlchemy-0.5.5-py2.6.egg/
[jeff@marvin ~]$ python -c 'import sqlalchemy'
[jeff@marvin ~]$
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top