bzr using cwd in pythonpath?
Andrew Bennetts
andrew at canonical.com
Wed Nov 30 13:52:03 GMT 2005
On Wed, Nov 30, 2005 at 06:54:21PM +1100, Jamie Wilkinson wrote:
> This one time, at band camp, Andrew Bennetts wrote:
> >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...
>
> So, bug in tokenize, or bug in bzr's sys.path?
Bug in *your* PYTHONPATH environment variable, now that I think about it. ;)
On my system:
$ echo $PYTHONPATH
$ mkdir foo
$ cd foo
$ touch token.py
$ bzr version | head -1
bzr (bazaar-ng) 0.7pre
$ PYTHONPATH=. bzr version
Traceback (most recent call last):
File "/usr/bin/bzr", line 49, in ?
import bzrlib.commands
File "/usr/lib/python2.4/site-packages/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
What's in your $PYTHONPATH?
Possibly bzr should be more robust about this. (Or someone should fix Python to
only import standard library modules from the one place, e.g. by putting them
all in a 'stdlib' package...)
Of course svn isn't much better:
$ touch libc.so.6
$ LD_LIBRARY_PATH=. svn --version
<wink>
-Andrew.
More information about the bazaar
mailing list