Python and location of .so files?

E

Efrat Regev

Hello,

On FC4, I've generated an .so file from C++ which I want to use from
python. It works when I copy it into /usr/lib/python2.4/site-packages.
(I.e., say I have hello.so in that directory, then from the python
prompt I can 'import hello', and the code works fine). The problem is
that the said directory requires su - so I'd rather python load my .so
from a different user-privilege directory (when I type 'import hello').
Is there some way to tell python to use a different directory?

Many thanks for considering this question. Also, it's possible that
this question belongs in a different forum, and if so, I'd appreciate if
you'd tell me where.

Thanks,

Efrat
 
C

Carsten Haese

Hello,

On FC4, I've generated an .so file from C++ which I want to use from
python. It works when I copy it into /usr/lib/python2.4/site-packages.
(I.e., say I have hello.so in that directory, then from the python
prompt I can 'import hello', and the code works fine). The problem is
that the said directory requires su - so I'd rather python load my .so
from a different user-privilege directory (when I type 'import hello').
Is there some way to tell python to use a different directory?

Yes. See
http://docs.python.org/tut/node8.html#SECTION008110000000000000000 for
information on Python's module search path.

Hope this helps,

Carsten.
 

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
474,276
Messages
2,571,384
Members
48,072
Latest member
FaustoBust

Latest Threads

Top