No uos.dupterm in the Unix port?

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
sarusso
Posts: 4
Joined: Fri Dec 09, 2016 9:49 am

No uos.dupterm in the Unix port?

Post by sarusso » Tue Oct 08, 2019 2:53 pm

Hi all,

I compiled the Unix port (from git v1.11 tag) but it seems like there is no uos.dupterm, which I was hoping to use to remotely execute some code. This is what I get:

Code: Select all

MicroPython v1.11 on 2019-10-08; linux version
Use Ctrl-D to exit, Ctrl-E for paste mode
>>> import uos
>>> uos.dupterm
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'dupterm'
Accordingly to the docs (http://docs.micropython.org/en/v1.11/li ... os.dupterm) and to some previous discussions (in particular, here: https://github.com/micropython/micropyt ... -415993868) it should be implemented...

What am I missing?

Thank you,
Stefano.

stijn
Posts: 362
Joined: Thu Apr 24, 2014 9:13 am

Re: No uos.dupterm in the Unix port?

Post by stijn » Tue Oct 08, 2019 3:18 pm

By default it is disabled, according to the last comment in the github link you mention you need to #define MICROPY_PY_OS_DUPTERM (2) in unix/mpconfigport.h (or pass that on the commandline when building)

sarusso
Posts: 4
Joined: Fri Dec 09, 2016 9:49 am

Re: No uos.dupterm in the Unix port?

Post by sarusso » Tue Oct 08, 2019 5:59 pm

It works, thank you so much.

My understanding was that modifying/adding that macro was required in order to change dupterm's behaviour, not to enable dupterm itself.

Thanks again for the precious tip!

Best,
Stefano.

stijn
Posts: 362
Joined: Thu Apr 24, 2014 9:13 am

Re: No uos.dupterm in the Unix port?

Post by stijn » Tue Oct 08, 2019 8:00 pm

Yes indeed the macro does both, though that's only obvious when actually looking at the code.

You're welcome!

Post Reply