inkstitch / pyembroidery

libembroidery/EmbroideryFormats converted to python
MIT License
71 stars 28 forks source link

Input/Output stream mode detection and rejection. #67

Open tatarize opened 5 years ago

tatarize commented 5 years ago

While taking either a stream or a string filename gives maximal compatibility it's entirely possible to hand pyembroidery an invalid stream. Such as one opened in textmode to write a format that requires binary. This should be detected an an error should be raised rejecting unacceptable stream modes. It also might be possible to reopen a stream in the correct mode, in some cases though .name could be a file descriptor instead so better to just raise an error.