apparentlymart / python-stl

Python library for parsing and producing STL files, in both ASCII and binary formats. No longer maintained.
MIT License
9 stars 13 forks source link

mod to binary write for Python 3.x #8

Closed ng110 closed 9 years ago

ng110 commented 9 years ago

Actually, this is not producing working files. Another solution is needed.

apparentlymart commented 9 years ago

Thanks for this!

I've not really gone anywhere near Python 3 yet so forgive the naive question: it seems like the issue you're looking at here is that a plain string is a byte string in Python 2 but a unicode string in Python 3, so by adding that b prefix you force Python 3 to make a byte string and presumably some recent versions of Python 2 also accept that prefix as being identical to an unprefixed string?

Do you know which versions of Python 2 this will work in?

ng110 commented 9 years ago

Your summary is correct. I have only tried in 2.7.6 and 3.4.3, both of which work with the modified version. With the original, v3.4.3 complains about the attempt to write unicode to a file. I have just tried writing to an ascii file and that also needs some changes for 3.x, which I have just committed.

apparentlymart commented 9 years ago

Thanks! I rebased it and pushed as af8d06747803b0de7c02477542361fe8da9c9dc7.

I also reconfigured Travis-CI to try to run the tests on 3.4, which doesn't seem to be working yet: https://travis-ci.org/apparentlymart/python-stl/jobs/83406263

I don't have time to dive into why that is now but I'll try to find some time soon to understand what's failing there, and once it's working I can cut a release.