-
-
Notifications
You must be signed in to change notification settings - Fork 3.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
Unable to save: 'bytes' object has no attribute 'encode' #25
Comments
I also meet this problem, the error message exactly the same with patrick's my environment : Ubuntu 16.04, Anaconda 4, Python 2.7 |
Hi,Thanks for sharing the code,I find a BUG that when I use the tool,if i sliding mouse,the tool will exit。what i have to do if i want to run the code and fix the bug? |
@wkentaro @jjdblast @patrickcgray As a final step one must correct the load function as well. |
I tested in below environment, and they all works. Could you please specify the version again? with labelme==2.6.2
|
Could it be that this problem is platform specific? I am also running on mac OS and I faced the same problem. |
@kentaro Wad i can install labelme on windows and ubuntu sucessfully. the problem is that when i use labeme to label the image, i will exit the GUI when i slide the mouse pulley. |
@landiaokafeiyan Your problem is different from the topic in this issue, right? If so, could you please open a new issue? |
@ibadami i can install labelme on windows and ubuntu sucessfully. i have not test it on Mac |
@wkentaro ok sure could you please fix the bug? |
@landiaokafeiyan I think so. |
@wkentaro many thanks |
@ibadami I also tested on mac also, and it works. (fyi I use conda) |
I too used conda. |
What I do not understand is. When you read the image data using read function in app.py it is read as a binary data. Then how can you encode that binary data in utf-8 during saving. When I googled the error message, I found that this error occurs because the binary data cannot be further encoded. |
+1, same problem |
I used the following and solved the problem: $ pip3 install SIP |
Thanks for sharing this code. |
I tested in this way on windows, and it worked. |
@l02i08u 's way works on my windows with Python 3.6. Thanks for his way. |
Thanks, @l02i08u 's way works for me as well while saving a file (Python 3.6 on Windows). However, when opening a json file saved in this way, the following code in labelFile.py should also be modified, otherwise similar encoding issues would occur:
|
@y-wan
|
os: windows 10 change with open(filename, 'w') as f:
if six.Py3:
imagedata=str(b64encode(imageData), 'utf-8') change with open(filename, 'r') as f:
if six.PY3:
imageData = b64decode(bytes(data['imageData'], 'utf-8')) works |
Sorry for late, but I confirmed this issue on Python3. |
you may try insted of encode, decode. |
I can't actually save a file on mac OS running python 3.6.2. Every time I try to save I get:
AttributeError: 'bytes' object has no attribute 'encode'
The text was updated successfully, but these errors were encountered: