Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

mergevec.py for Python 3.x #22

Closed
rejaverion opened this issue Oct 27, 2016 · 4 comments
Closed

mergevec.py for Python 3.x #22

rejaverion opened this issue Oct 27, 2016 · 4 comments

Comments

@rejaverion
Copy link

Hi. When I try to execute mergevec.py the shell returns TypeError: 'str' does not support the buffer interface" for lines 170 and 120

Turns out there is a distinct incompatibilty between Py 2.x and 3.x that causes this error. How do I modify the py script to make it compatible with my Python 3.4?

@rejaverion
Copy link
Author

rejaverion commented Oct 27, 2016

I got the solution. Python 3,x treats unicode string and byte string differently. So you would need to edit the py script and change 'str' data types to 'bytes'

@Timebutt
Copy link

Hi @rejaverion, I'm no Python expert: how exactly would one solve this issue then? I get the following error when trying to run the mergevec.py script with Python 3.6 (on Windows x64):

Traceback (most recent call last):
  File "tools/mergevec.py", line 170, in <module>
    merge_vec_files(vec_directory, output_filename)
  File "tools/mergevec.py", line 120, in merge_vec_files
    val = struct.unpack('<iihh', content[:12])
TypeError: a bytes-like object is required, not 'str'

Are we having the same issue?
Changing the str( to bytes( on lines 119, 132 and 156 doesn't solve my issue.

It would be a great idea if this repository offered the mergevec.py both for Python 2.x and 3.x, that way nobody runs into this issue again.

@rrphotosoft
Copy link

Hi,
I'm facing the same issue, any idea on how to solve this? @rejaverion @Timebutt

@Timebutt
Copy link

Hi @rrphotosoft, if I recall correctly I just installed Python 2.7 and ran it with that Python version. There are plenty of other libraries that don't support Python 3 yet anyway, so I'd say it really is a necessity to have both version on your development machine ;)

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

No branches or pull requests

3 participants