0

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
1
  • @Kalus - that should be an answer, not a comment :) Commented Mar 16, 2011 at 13:31

1 Answer 1

3

Try

export PYTHONPATH=/home/osqa/EC2/backup/src/

instead, i.e. use export and remove the last path component.

Sign up to request clarification or add additional context in comments.

4 Comments

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.
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!
@ripper234: Missed the /boto/boto part, but the problem seems to be solved anayway :)
I would have accepted your answer sooner if SO had allowed me to :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.