os.environ['HOME'] may not exists on Windows

Martin Pool mbp at sourcefrog.net
Tue Apr 12 07:29:33 BST 2005


On Mon, 2005-04-11 at 23:35 +1000, Andrew Bennetts wrote:
> On Mon, Apr 11, 2005 at 04:29:24PM +0300, Alexander Belchenko wrote:
> > Hi!
> > 
> > I'm try to run bzr-0.0.3 and got error message:
> > 
> > Traceback (most recent call last):
> [...]
> >     trace_fname = os.path.join(os.environ['HOME'], '.bzr.log')
> >   File "C:\Python24\lib\os.py", line 422, in __getitem__
> >     return self.data[key.upper()]
> > KeyError: 'HOME'
> 
> os.path.expanduser('~/.bzr.log') is a more portable way than
> os.path.join(os.environ['HOME'], '.bzr.log').

Thanks, fixed.

-- 
Martin

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050412/559a68bd/attachment.pgp 


More information about the bazaar mailing list