Why do I get an import error on this?

Micah Elliott mde at micah.elliott.name
Fri Oct 7 13:48:20 EDT 2005


On Oct 07, Steve wrote:
> I have a simple program:
> ____________________________________________
> 
> #! /home/fergs/python/bin/python
> import sys, os
> import cx_Oracle
> ____________________________________________
> 
> If I run it through the Python interpreter, this way:
> 
>  >> python test.py
> 
> it runs fine.
> 
> But if I try to run it as an executable script, this way:
> 
>  >> test.py
> 
> I get an import error that says it can't find cx_Oracle.

Are "which python" and "/home/fergs/python/bin/python" the same?  If
not, it appears that "which python" can see cx_Oracle, but the latter
cannot.  You could mess with PYTHONPATH or get /home/.../python into the
front of your PATH.

-- 
Micah Elliott
<mde at micah.elliott.name>



More information about the Python-list mailing list