Importing modules

Chris Rebert clp2 at rebertia.com
Mon Jun 7 01:30:29 EDT 2010


On Sun, Jun 6, 2010 at 10:25 PM, Anthony Papillion <papillion at gmail.com> wrote:
> On Jun 6, 10:33 pm, Chris Rebert <c... at rebertia.com> wrote:
>> On Sun, Jun 6, 2010 at 8:16 PM, Ben Finney <ben+pyt... at benfinney.id.au> wrote:
>> > Anthony Papillion <papill... 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.
>>
>> Also, that should be sys.path.append(); os.path is an unrelated module
>> that has no `append` function. You'll need to import sys instead of os
>> obviously.
>>
>> Cheers,
>> Chris
>
> Hi Chris,
> Thanks for saving me (again). I appreciate the help. While the
> os.path.append() was a typo (I really had sys.path.append()), the
> substitution was what was killing me.  Thanks for the help! I owe you
> a beer.

Er, in point of fact, the substitution problem was first pointed out
by Ben, not myself.
Not that I could legally have your beer anyway. :)

Cheers,
Chris
--
2 more months!
http://blog.rebertia.com



More information about the Python-list mailing list