Importing modules

Dan Stromberg drsalists at gmail.com
Mon Jun 7 16:20:06 EDT 2010


On Sun, Jun 6, 2010 at 8:16 PM, Ben Finney
<ben+python at benfinney.id.au<ben%2Bpython at benfinney.id.au>
> wrote:

> Anthony Papillion <papillion at gmail.com> writes:
>
> > import os
> >
> > os.path.append('$HOME/gsutils/boto')
> >
> > thinking I could then successfully do the import boto statement.
> > Nope.
>
> You'll need to give the literal path. Substitution of environment
> variables isn't performed implicitly in strings.
>
You can however use something like:

os.path.append(os.path.expanduser('~/gsutils/boto'))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100607/f866bd76/attachment-0001.html>


More information about the Python-list mailing list