Skip to content

Commit 7260247

Browse files
HowManyOliversAreTherepi-anl
authored andcommitted
code: Initial micropython support.
1 parent 50063bc commit 7260247

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

python-stdlib/code/code.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -201,14 +201,14 @@ def interact(self, banner=None, exitmsg=None):
201201
a default message is printed.
202202
203203
"""
204+
## MPY: Older versions of mpy don't support setting ps1 & ps2.
205+
ps1 = ">>> "
206+
ps2 = "... "
204207
try:
205-
sys.ps1
206-
except AttributeError:
207-
sys.ps1 = ">>> "
208-
try:
209-
sys.ps2
210-
except AttributeError:
211-
sys.ps2 = "... "
208+
ps1 = sys.ps1
209+
ps2 = sys.ps2
210+
except:
211+
pass
212212
cprt = 'Type "help", "copyright", "credits" or "license" for more information.'
213213
if banner is None:
214214
self.write("Python %s on %s\n%s\n(%s)\n" %
@@ -220,9 +220,9 @@ def interact(self, banner=None, exitmsg=None):
220220
while 1:
221221
try:
222222
if more:
223-
prompt = sys.ps2
223+
prompt = ps2
224224
else:
225-
prompt = sys.ps1
225+
prompt = ps1
226226
try:
227227
line = self.raw_input(prompt)
228228
except EOFError:

0 commit comments

Comments
 (0)