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

shutil.copy error #105

Closed
benureau opened this issue Jun 5, 2016 · 3 comments
Closed

shutil.copy error #105

benureau opened this issue Jun 5, 2016 · 3 comments
Labels

Comments

@benureau
Copy link
Contributor

benureau commented Jun 5, 2016

I get an error relating to the Hexlified class having no encode method, when copying binary files inside the fake filesystem, using shutil.copy. I don't have the error on hand anymore, I can regenerate it if you need. I made a very crude fix for it, but I am sure there is a better way:
benureau@8e702c4

@mrbean-bremen
Copy link
Member

I think, SetContents() is not the right function to be used in copyfile() in this case.
I would propose to either directly assign the contents in copyfile(), or add a respective CopyContents() method (not sure about the coding guidelines here).

@mrbean-bremen
Copy link
Member

On a second thought, I find your fix better, with the exception that there is no need to decode and encode the contents in this case. I added a small test that reproduces the problem without the fix - will put it in a PR in a second.

mrbean-bremen added a commit to mrbean-bremen/pyfakefs that referenced this issue Jun 10, 2016
@jmcgeheeiv
Copy link
Contributor

Closing due to @mrbean-bremen #108.

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

No branches or pull requests

3 participants