I have been lurking for a while, trying to figure out if I can tackle a project with MP on SP32. MP beginner. I guess is time to start with a silly questions...
Why does this work
>>> import os as ox
>>> ox.listdir()
but I get syntax error on
>>> import TTGO-T4-Pins as pinmap
Traceback (most recent call last):
File "<stdin>", line 1
SyntaxError: invalid syntax
import module as new name
Re: import module as new name
Because TTGO-T4-Pins is an expression and not a name. Try using TTGO_T4_Pins or the like.
Re: import module as new name
microPython... microCobol... aren't they similar?
I just took a piece of a github package as the name... Now it likes it and what is more, with a couple of tweaks, the board is working!
Thank you
I just took a piece of a github package as the name... Now it likes it and what is more, with a couple of tweaks, the board is working!
Thank you
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: import module as new name
I know nothing of Cobol but Python interprets "-" as an operator. Consequently, as @Roberthh says, "TTGO-T4-Pins" is interpreted as an expression and not a name.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: import module as new name
Thank you Peter, many other languages do to... Just as a COBOL curiosity tidbit, variables are commonly a string of hyphenated words, a bit on the verbose side. Operators have to be space separated from variables.
Thank you again
Tony
Thank you again
Tony