如何在本地运行这个程序呢
ningyuwhut opened this issue · comments
运行test_simhash.py时候出错:
➜ tests git:(master) python test_simhash.py
...E..
ERROR: test_sparse_features (main.TestSimhash)
Traceback (most recent call last):
File "test_simhash.py", line 68, in test_sparse_features
shs.append(Simhash(features))
File "build/bdist.macosx-10.9-intel/egg/simhash/init.py", line 41, in init
self.build_by_features(value)
File "build/bdist.macosx-10.9-intel/egg/simhash/init.py", line 63, in build_by_features
hashs = [self.hashfunc(w.encode('utf-8')) for w in features]
AttributeError: 'tuple' object has no attribute 'encode'
好像使用的不是simhash目录下的程序,而是系统自带的
You can use nose
to test.
谢谢。
我用nose测试貌似也是一样的错误:
➜ tests git:(master) ✗ nosetests
...E..
ERROR: test_sparse_features (test_simhash.TestSimhash)
Traceback (most recent call last):
File "/Users/ningyu/simhash/tests/test_simhash.py", line 67, in test_sparse_features
shs.append(Simhash(features))
File "build/bdist.macosx-10.9-intel/egg/simhash/init.py", line 41, in init
self.build_by_features(value)
File "build/bdist.macosx-10.9-intel/egg/simhash/init.py", line 63, in build_by_features
hashs = [self.hashfunc(w.encode('utf-8')) for w in features]
AttributeError: 'tuple' object has no attribute 'encode'
Ran 6 tests in 0.619s
FAILED (errors=1)
是我用法有错误吗
谢谢
把系统的simhash删掉试试?
删掉之后就正常了,多谢