Last active
August 29, 2015 14:20
-
-
Save nudomarinero/92e13f5da0fb799c8797 to your computer and use it in GitHub Desktop.
example of asurv called with pexpect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pexpect | |
file_in = "input.dat" | |
file_out = "output.txt" | |
c = pexpect.spawn ('asurv') | |
c.expect('(CARRIAGE RETURN TO CONTINUE)') | |
c.sendline('') | |
c.expect('(CARRIAGE RETURN TO CONTINUE)') | |
c.sendline('') | |
c.expect('CHOICE ?') | |
c.sendline('1') | |
c.expect('CHOICE ?') | |
c.sendline('1') | |
c.expect('FROM A COMMAND FILE (Y/N)?') | |
c.sendline('N') | |
c.expect('WHAT IS THE DATA FILE NAME ?') | |
c.sendline(file_in) | |
c.expect('WHAT IS THE PROBLEM TITLE?') | |
c.sendline('-5') | |
c.expect('HOW MANY VARIABLES DO YOU HAVE?') | |
c.sendline('1') | |
c.expect('VARIABLE 1 IS NAMED') | |
c.sendline('L') | |
c.sendline('Y') | |
c.expect('THE DIFFERENTIAL FORM (Y/N)?') | |
c.sendline('N') | |
#c.expect('DO YOU WANT TO PRINT THE ORIGINAL DATA (Y/N) ?') | |
c.sendline('N') | |
c.expect('DO YOU WANT TO SAVE THE RESULTS IN A FILE (Y/N)?') | |
c.sendline('Y') | |
c.expect('HAT IS THE NAME OF THE FILE?') | |
c.sendline(file_out) | |
c.sendline('N') | |
c.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment