pfalcon / utemplate

Micro template engine in Python with low memory usage, designed for Pycopy, a minimalist Python dialect, but also compatible with other Pythons.
https://github.com/pfalcon/pycopy
76 stars 8 forks source link

os and io imports do not match established Micropython naming conventions #1

Closed cefn closed 7 years ago

cefn commented 7 years ago

Hi, and thanks for utemplate. Potentially really promising for a project I'm working on, unless you think there is a better candidate for python-oriented templating on ESP8266 Micropython

To get this version of utemplate to run the example template squares.tpl, I had to make the following changes so that _io was satisfied instead by uio and os satisfied by uos meaning that it could execute against micropython 1.8.7 on unix...

diff --git a/utemplate_util.py b/utemplate_util.py
index 348e8eb..1129264 100644
--- a/utemplate_util.py
+++ b/utemplate_util.py
@@ -1,6 +1,6 @@
 import sys
-import os
-import _io as io
+import uos as os
+import uio as io
 import utemplate.source
 import utemplate.compiled

After this, I successfully generated the example templated text....

| 0 |  0 |
| 1 |  1 |
| 2 |  4 |
| 3 |  9 |
| 4 | 16 |
pfalcon commented 7 years ago

Thanks for the report, fixed.