linux - Using python subprocess.call() to launch an ncurses process -


I am trying to call ct-ng () from a SCons SConstruct script, so basically from Python .

Use the following method:

  ret = subprocess.call (["/ mnt / build / pw_build / crosstool-ng / bin / Ct-ng menuconfig   

crosstool-ng uses ncurses to present the user with a menu:

Enter the image details here

Unfortunately when I try to get the menu I get what I get:

Enter image details here < / P>

I see arrow keys Using the cat to display scenes while using:

 : / mnt / build $ cat> / dev / null ^ [o ^^ ^ [OB ^ [O. O ^ [OB ^ [OD ^ [OC ^ [OY ^ [OB   

It seems that it is possible to separate the characters who escape the order.

When I call the CT-NG script in the terminal from the command line it works correctly, this happens when I subprocess.call () Things are bad Not.

My environment includes:

  • xfce4- Terminal 0.6.3
  • Linux 3.13.0-32 -Decor # 57-Ubuntu SMP prepaid Tuesday July 15 04:08:59 UTC 2014 x86_64 x86_64 x86_64 GNU / Linux
  • Python 2.7.6
  • NCURSES_VERSION "5.9"
  • Make GNU 3.81
  • CrosTotal-NG Version 1.19.0

    Am I seeing a known issue? Is there anything else I should do?

    UPDATE: Thanks Eric .. He got me 0.5 F method. I can navigate the menu now, but still leaves behind drops:

    > Enter image details here

    In order to run a curse program under Python, I recommend that you use it.

    For example here is a simple program which vim , add some text, Avoid command mode, issue one: w command, and then interact with user ( Or to continue editing it or whatever) Then the control returns to Python:

      #! / Usr / bin / env dragon import child = pexpect.spawn ("/ usr / bin / vim") child.send ('a \ n \ nIt is another test.) Child.send (' \ x1b ') Child.send (': w! Test.txt \ n') child.interact ()   

    You can also pass the passed character, and for input and output in the interactive method Filter function. But they get a little harder.

    (BTW: You can send this desired code to ct-ng dialog / menu in your code ... this is just one thing for your terminal settings. For example, for example, a "down arrow" cursor movement ^ "[[[[[E] [bracket] [B]] under MacD X running with Termom = xterm-256color on my item. This will be 'x1b [b' as a python string].

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -