Search found 5 matches

by rockindy
Wed Nov 11, 2020 7:55 am
Forum: Programs, Libraries and Tools
Topic: How to add VFS support to windows port?
Replies: 1
Views: 1468

How to add VFS support to windows port?

I have added following configs to port/windows/mpconfigport.h but with no luck. #define MICROPY_VFS (1) #define MICROPY_VFS_POSIX (1) #define MICROPY_PY_UOS_VFS (1) #define MICROPY_READER_VFS (1) #define MICROPY_PY_OS_STATVFS (0) #define mp_import_stat mp_vfs_import_stat #define mp_builtin_open mp_v...
by rockindy
Wed Apr 29, 2020 6:38 am
Forum: Programs, Libraries and Tools
Topic: I can’t interact with micropython by Popen
Replies: 11
Views: 9036

Re: I can’t interact with micropython by Popen

Sorry, I think I misunderstood dhylands' post. The correct understanding is: if (ret == NOTHING_EXECUTED || inspect) { - if (isatty(0)) { + if (isatty(0) || inspect) { prompt_read_history(); With this patch, it should work as excepted. Thank you @dhylands and @Christian Walther .
by rockindy
Tue Apr 28, 2020 3:05 am
Forum: Programs, Libraries and Tools
Topic: I can’t interact with micropython by Popen
Replies: 11
Views: 9036

Re: I can’t interact with micropython by Popen

In the current code, once you redirect stdin, it won't call do_repl().

And I don't know how to tell the redirection is from '<' or from Popen.

My suggestion is once you set -i flag, it will always call do_repl().

And if you want to run script from a file, just use '<' without -i flag.
by rockindy
Mon Apr 27, 2020 3:52 am
Forum: Programs, Libraries and Tools
Topic: I can’t interact with micropython by Popen
Replies: 11
Views: 9036

Re: I can’t interact with micropython by Popen

Hi, Thanks for your replies. I want to let user interacts with MicroPython REPL via gui widget, so I need to pipe the stdin/stdout. @Christian Walther your way works but can only write the stdin once. Finally I found a way to do it. For whom encountered the same problem, you can modify the main.c of...
by rockindy
Fri Apr 24, 2020 3:18 am
Forum: Programs, Libraries and Tools
Topic: I can’t interact with micropython by Popen
Replies: 11
Views: 9036

I can’t interact with micropython by Popen

Hi, I tried to use Popen of python2/3 to interact with micropyton unix port, but will be blocked by proc.stdout.readline() function: proc = subprocess.Popen(['./micropython', '-i'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) proc.stdin.write(b'2+2\n') proc.stdin.flush() p...