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

Error in moban 0.4.3 #265

Closed
ayan-b opened this issue Apr 19, 2019 · 10 comments
Closed

Error in moban 0.4.3 #265

ayan-b opened this issue Apr 19, 2019 · 10 comments
Assignees

Comments

@ayan-b
Copy link
Member

ayan-b commented Apr 19, 2019

Using moban 0.4.3, we get this error: UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte in the coala-mobans repo, although this error does not arise with moban 0.3.3.

CI log:

@chfw
Copy link
Member

chfw commented Apr 19, 2019

0.4.3 read and write

0.3.3 uses shutils to copy.

when reading in, if the file is not encoded in utf-8, this problem will rise.

@ayan-b
Copy link
Member Author

ayan-b commented Apr 19, 2019

when reading in, if the file is not encoded in utf-8, this problem will rise.

That is also what I suspected. So we can by default convert the file to utf-8 in this repo while reading?

@chfw
Copy link
Member

chfw commented Apr 20, 2019

https://github.com/moremoban/moban/blob/dev/moban/copy/__init__.py

Copy engine should have read with 'rb' flag and ignore encoding. Simple 'open' fuction should work.

When saving, it should use 'wb' flag, treating the content as binary throughout the journey within moban.

@ayan-b
Copy link
Member Author

ayan-b commented Apr 21, 2019

Ok, I will send a PR by tonight.

ayan-b added a commit to ayan-b/moban that referenced this issue Apr 21, 2019
ayan-b added a commit to ayan-b/moban that referenced this issue Apr 21, 2019
ayan-b added a commit to ayan-b/moban that referenced this issue Apr 21, 2019
ayan-b added a commit to ayan-b/moban that referenced this issue Apr 21, 2019
ayan-b added a commit to ayan-b/moban that referenced this issue Apr 21, 2019
ayan-b added a commit to ayan-b/moban that referenced this issue Apr 21, 2019
@ayan-b ayan-b self-assigned this Apr 21, 2019
@chfw chfw closed this as completed in e4442d0 Apr 22, 2019
@ayan-b
Copy link
Member Author

ayan-b commented Apr 24, 2019

@chfw This error is not yet fixed: https://gitlab.com/ayan-b/mobans/-/jobs/201319687 . It comes from https://github.com/moremoban/moban/pull/267/files#diff-4ce3d7a5af974a09dae6519b5a45cc44R65. If we ignore decoding python3 tests fail. Interestingly, the test_copy_encoding does not fail here.

@ayan-b
Copy link
Member Author

ayan-b commented Apr 26, 2019

@chfw what do you think?

@chfw chfw reopened this Apr 26, 2019
@chfw
Copy link
Member

chfw commented Apr 26, 2019

I think you have just shifted decoding from copy engine to write function. In python 3, cannot we write bytes directly to a file?

@chfw
Copy link
Member

chfw commented Apr 26, 2019

And it also means that the unit test case failed to capture the bug.

@ayan-b
Copy link
Member Author

ayan-b commented Apr 26, 2019

By the way, I wonder if we can simply copy in these scenarios (where we are not touching the contents of the file) using os module without reading or writing. This will greatly enhance the performance.

@ayan-b
Copy link
Member Author

ayan-b commented Apr 26, 2019

I will try to solve the issue over the weekend.

ayan-b added a commit to ayan-b/moban that referenced this issue Apr 27, 2019
ayan-b added a commit to ayan-b/moban that referenced this issue Apr 27, 2019
ayan-b added a commit to ayan-b/moban that referenced this issue Apr 27, 2019
ayan-b added a commit to ayan-b/moban that referenced this issue Apr 27, 2019
ayan-b added a commit to ayan-b/moban that referenced this issue Apr 27, 2019
@chfw chfw closed this as completed in 2416e40 May 20, 2019
@chfw chfw mentioned this issue May 25, 2019
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

2 participants