-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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: a bytes-like object is required, not 'str' #698
Comments
The issue tracker is for bugs/feature-requests, not support questions – those are better handled at the project discussion list: https://groups.google.com/forum/#!forum/gensim And, you'd have to provide a lot more context/code/logging-info for us to have any idea what line of your code is triggering that error. So if you ask on the list, please better describe what you're trying to accomplish, and how. |
Sounds like a bug report for the DTM wrapper in gensim... but a very incomplete one. @Tesfamariam, please review the contributing guide. Add relevant information so we know what you're talking about. |
Sorry for the incomplete information! Sample dataset:
corpus = DTMcorpus(texts) /home/tesfish/anaconda3/lib/python3.5/site-packages/gensim/models/wrappers/dtmmodel.py in init(self, dtm_path, corpus, time_slices, mode, model, num_topics, id2word, prefix, lda_sequence_min_iter, lda_sequence_max_iter, lda_max_em_iter, alpha, top_chain_var, rng_seed, initialize_lda) /home/tesfish/anaconda3/lib/python3.5/site-packages/gensim/models/wrappers/dtmmodel.py in train(self, corpus, time_slices, mode, model) /home/tesfish/anaconda3/lib/python3.5/site-packages/gensim/models/wrappers/dtmmodel.py in convert_input(self, corpus, time_slices) TypeError: a bytes-like object is required, not 'str' |
Ping @bhargavvader |
@bhargavvader Do you have any thoughts on this? |
@tmylk will have a look. |
Just a +1 -- also having this error. |
|
@boomsbloom that is not a good idea as Proper solution is to open in binary mode and store binary strings. |
@piskvorky , could you elaborate a bit on your proposed solution? I tried poking around but am not too sure how to fix this. |
I meant simply opening files in binary mode ( I am not familiar with this particular issue though, maybe it's something different. What is the actual problem, why are we storing unicode strings into binary files in this wrapper? |
Ping @bhargavvader |
@Tesfamariam , do have a look at the PR, it will fix the problem. |
Fixed in #768 |
Nice blog to address the issu |
I am trying to implement dynamic topic modeling with python Anaconda 3.4 distribution on Linux OS.However, I am having the following error:
TypeError: a bytes-like object is required, not 'str'
Any idea how I could solve this problem?
The text was updated successfully, but these errors were encountered: