lukew3 / mathgenerator

A math problem generator, created for the purpose of giving self-studying students and teaching organizations the means to easily get access to high-quality, generated math problems to suit their needs.
https://lukew3.github.io/mathgenerator
MIT License
690 stars 178 forks source link

Fix issue of path separators and UnicodeDecodeError on adoptGenerator.py #379

Closed lahdjirayhan closed 2 years ago

lahdjirayhan commented 2 years ago

This PR attempts to fix problems with adoptGenerator.py, specifically, when running main() imported from makeReadme, as follows:

  1. I've explained the path separators issue on #378. Basically, there's an unintended result when running adoptGenerator.py on my device and I highly suspect it's because Windows has backslash \ as path separator. I've replaced the hardcoded separator / with os.sep to make it work with as minimal change as possible.

  2. There are Unicode symbols present in mathgenerator/funcs/geometry/basic_trigonometry.py. I've changed how makeReadme open file by adding the argument encoding = "utf-8". Without this argument, running adoptGenerator.py on my device is pointless as it raises UnicodeDecodeError every time. I'm not 100% sure if adding that argument will affect devices with different configurations/specs.

I don't have an access to other device apart from my own, so unfortunately I can't test to see if my proposed change can have side-effects on other OSes.