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

Building Zip archive for python 3 #200

Open
jpfairbanks opened this issue Dec 11, 2017 · 2 comments
Open

Building Zip archive for python 3 #200

jpfairbanks opened this issue Dec 11, 2017 · 2 comments

Comments

@jpfairbanks
Copy link

Desired Behavior: python setup.py zip should create an archive with the distribution.
Actual Behavior: python setup.py zip raises an exception

With python version: Python 3.5.2 :: Anaconda custom (x86_64)
Steps to reproduce:

git clone https://github.com/clips/pattern.git
cd pattern && git checkout development
python setup.py zip

Output:

pattern-2.6.zip
Traceback (most recent call last):
  File "setup.py", line 46, in <module>
    print(hashlib.sha256(open(z.filename).read()).hexdigest())
  File "/Users/jfairbanks6/anaconda/lib/python3.5/codecs.py", line 321, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 12: invalid start byte
@markus-beuckelmann
Copy link
Collaborator

Thanks! The line should be print(hashlib.sha256(open(z.filename).read().encode("utf-8")).hexdigest()), if you want you can submit a PR against development, otherwise I'll fix it at the next opportunity. There might be other problems with ZIP archive creation though, this part is currently untested on Python 3...

@jpfairbanks
Copy link
Author

Are you sure the file z.filename shouldn't be read as raw bytes and then hashed? The output of zipping shouldn't be utf-8 text.

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