I'm trying to use PYTHONPATH to let Python know where my library is located, but it seems to ignore it:
$ PYTHONPATH=/home/osqa/EC2/backup/src/boto/
$ ls /home/osqa/EC2/backup/src/boto/boto/ec2/connection.py
/home/osqa/EC2/backup/src/boto/boto/ec2/connection.py
$ python backup.py
Traceback (most recent call last):
File "backup.py", line 4, in <module>
from boto.ec2.connection import EC2Connection
ImportError: No module named boto.ec2.connection
asked Mar 16, 2011 at 13:21
ripper234
232k280 gold badges647 silver badges915 bronze badges
-
@Kalus - that should be an answer, not a comment :)ripper234– ripper2342011年03月16日 13:31:14 +00:00Commented Mar 16, 2011 at 13:31
1 Answer 1
Try
export PYTHONPATH=/home/osqa/EC2/backup/src/
instead, i.e. use export and remove the last path component.
answered Mar 16, 2011 at 13:22
Sven Marnach
608k123 gold badges969 silver badges866 bronze badges
Sign up to request clarification or add additional context in comments.
4 Comments
Wooble
without the last path component, the import will be "from boto.boto.ec2.connection", and will probably fail horribly due to a missing
__init__.py given the likely directory structure.ripper234
Actually, I don't need to remove the last path component, since I have a boto folder inside the boto folder. But export did the trick!
Sven Marnach
@ripper234: Missed the
/boto/boto part, but the problem seems to be solved anayway :)ripper234
I would have accepted your answer sooner if SO had allowed me to :)
lang-py