python - Write to file with nccurses -


i'm attempting create menu system ncurses configure ip address of ubuntu box. i've taken example found here:

http://tuxradar.com/content/code-project-build-ncurses-ui-python

the program prompts information, run issues when attempting write /etc/network/interfaces.

code snippet

screen.addstr(4, 4, "1 - configure static ip address") ..... staticip = get_param("enter ip address") system("echo 'address ' + staticip >> /etc/network/interfaces") 

this writing file, it's writing literal text without using value of variable.

address staticip 

the last line "execute_cmd", discovered "system" seems same thing without prompting after each line executed.

i'm python/ncurses newb...and pro tips out there appreciated! if there's better option, i'm open well...not tied ncurses.

thanks!

you have command wrongly escaped. should read:

system("echo 'address '" + staticip + " >> /etc/network/interfaces") 

else, sending params address, + , staticip echo command.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -