Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: coercing to Unicode: need string or buffer, bool found #41

Closed
Dieterbe opened this issue Jun 24, 2011 · 1 comment
Closed

Comments

@Dieterbe
Copy link
Contributor

Hi,
when I try to save a SparseMatrixSimilarity object using the latest develop code in git, I get a TypeError.
Below is the complete output.
Note also the line: INFO:gensim.similarity.docsim:storing SimmatrixSparseMatrixSimilarity object to False and False.npy doesn't look very correct. (my SimmatrixSparseMatrixSimilarity class just extends SparseMatrixSimilarity and adds custom load/save.. HOLD ON, let me figure this out myself first. probably my own mistake :p )


INFO:gensim.similarity.docsim:creating sparse index
INFO:gensim.matutils:creating sparse matrix from corpus
INFO:gensim.matutils:PROGRESS: at document #0
INFO:gensim.matutils:PROGRESS: at document #10000
INFO:gensim.matutils:PROGRESS: at document #20000
INFO:gensim.matutils:PROGRESS: at document #30000
INFO:gensim.matutils:PROGRESS: at document #40000
INFO:gensim.matutils:PROGRESS: at document #50000
INFO:gensim.matutils:PROGRESS: at document #60000
INFO:gensim.matutils:PROGRESS: at document #70000
INFO:gensim.matutils:PROGRESS: at document #80000
INFO:gensim.matutils:PROGRESS: at document #90000
INFO:gensim.matutils:PROGRESS: at document #100000
INFO:gensim.matutils:PROGRESS: at document #110000
INFO:gensim.matutils:PROGRESS: at document #120000
INFO:gensim.matutils:PROGRESS: at document #130000
INFO:gensim.matutils:PROGRESS: at document #140000
INFO:gensim.matutils:PROGRESS: at document #150000
INFO:gensim.matutils:PROGRESS: at document #160000
INFO:gensim.matutils:PROGRESS: at document #170000
INFO:gensim.similarity.docsim:created <178643x3248178 sparse matrix of type '<type 'numpy.float32'>'
    with 14085600 stored elements in Compressed Sparse Row format>
DEBUG:root:build_matrix doc/min: 59928.944920
INFO:gensim.similarity.docsim:storing SimmatrixSparseMatrixSimilarity object to False and False.npy
Traceback (most recent call last):
  File "./build-models.py", line 321, in <module>
    rebuild_data_files(r, args.tag, args.force) #takes 10minutes or so (most part dictionary)
  File "./build-models.py", line 155, in rebuild_data_files
    sim.save(force)
  File "/usr/local/lib/python2.6/dist-packages/gensim-0.8.0rc1-py2.6.egg/gensim/similarities/docsim.py", line 513, in save
    utils.pickle(self, fname) # store array-less object
  File "/usr/local/lib/python2.6/dist-packages/gensim-0.8.0rc1-py2.6.egg/gensim/utils.py", line 427, in pickle
    with open(fname, 'wb') as fout: # 'b' for binary, needed on Windows
TypeError: coercing to Unicode: need string or buffer, bool found
@Dieterbe
Copy link
Contributor Author

this is a PEBKAC.
i was using custom save/load functions that didn't behave as they should
sorry for the noise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant