bzr using cwd in pythonpath?

Andrew Bennetts andrew at canonical.com
Wed Nov 30 04:50:26 GMT 2005


On Wed, Nov 30, 2005 at 02:14:37PM +1100, Jamie Wilkinson wrote:
> I have a directory, that's not a bzr working tree (though the code in it has
> since been moved into one) that looks like this:
> 
> plank% ls
[...]
> ast.py        postscript.py   rack2ps.py~   rackbuilder.py~  token.py
[...]
> 
> If I mistakenly run bzr within this directory, I get this traceback:
> 
> plank% bzr merge ../feng.bzr
> Traceback (most recent call last):
>   File "/home/jaq/src/bzr/bzr.dev/bzr", line 49, in ?
>     import bzrlib.commands
>   File "/home/jaq/src/bzr/bzr.dev/bzrlib/commands.py", line 33, in ?
>     from inspect import getdoc
>   File "/usr/lib/python2.4/inspect.py", line 31, in ?
>     import sys, os, types, string, re, dis, imp, tokenize, linecache
>   File "/usr/lib/python2.4/tokenize.py", line 38, in ?
>     COMMENT = N_TOKENS
> NameError: name 'N_TOKENS' is not defined
> 
> I don't get anything in ~/.bzr.log.
> 
> Is it possible that the files in the current directory are interfering with
> bzr?  It looks that way, but having . in the PYTHONPATH seems like such a
> bad idea that it's not possible that the bzr developers could have made that
> mistate :)

tokenize usually gets N_TOKENS from "from token import *", but in your case I'll
bet its finding token.py in your current directory.

This is definitely something that should be fixed...

-Andrew.





More information about the bazaar mailing list