Trouble Creating Text Input File for Linux Executable
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I am running Ubuntu 16.04.4. I have an executable that takes initial condition inputs from a text file, performs calculations, and generates an output file. I want to run calculations for a large number of initial conditions, so I wrote a python script (python 3.5.2 running in Spyder 3) to create the input file, run the executable, and read in the outputs.
The script seems to create the input text file just fine, but the executable does not recognize the input file unless I first open the input file, make some sort of change, save, and close it. For instance, I can open the file, delete a character, replace it with the original character, save, and everything works. This of course, defeats the purpose of automating the process. Any thoughts as to the cause?
ubuntu text-processing python
add a comment |Â
up vote
0
down vote
favorite
I am running Ubuntu 16.04.4. I have an executable that takes initial condition inputs from a text file, performs calculations, and generates an output file. I want to run calculations for a large number of initial conditions, so I wrote a python script (python 3.5.2 running in Spyder 3) to create the input file, run the executable, and read in the outputs.
The script seems to create the input text file just fine, but the executable does not recognize the input file unless I first open the input file, make some sort of change, save, and close it. For instance, I can open the file, delete a character, replace it with the original character, save, and everything works. This of course, defeats the purpose of automating the process. Any thoughts as to the cause?
ubuntu text-processing python
Can you be more specific than "does not recognize"? One possibility is that your python script is not properly terminating the file - and that the subsequent re-save is
â steeldriver
May 29 at 2:59
Have you diffed the file before and after opening and saving the file? Your text editor maybe doing something else when you save the file like removing whitespace at the end off lines etc.
â rusty shackleford
May 29 at 7:56
The comment from rusty led to a solution. After diffing the two files, I found that the one not recognized by the executable was missing a newline character. Problem solved!
â user292970
May 31 at 18:10
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am running Ubuntu 16.04.4. I have an executable that takes initial condition inputs from a text file, performs calculations, and generates an output file. I want to run calculations for a large number of initial conditions, so I wrote a python script (python 3.5.2 running in Spyder 3) to create the input file, run the executable, and read in the outputs.
The script seems to create the input text file just fine, but the executable does not recognize the input file unless I first open the input file, make some sort of change, save, and close it. For instance, I can open the file, delete a character, replace it with the original character, save, and everything works. This of course, defeats the purpose of automating the process. Any thoughts as to the cause?
ubuntu text-processing python
I am running Ubuntu 16.04.4. I have an executable that takes initial condition inputs from a text file, performs calculations, and generates an output file. I want to run calculations for a large number of initial conditions, so I wrote a python script (python 3.5.2 running in Spyder 3) to create the input file, run the executable, and read in the outputs.
The script seems to create the input text file just fine, but the executable does not recognize the input file unless I first open the input file, make some sort of change, save, and close it. For instance, I can open the file, delete a character, replace it with the original character, save, and everything works. This of course, defeats the purpose of automating the process. Any thoughts as to the cause?
ubuntu text-processing python
asked May 29 at 2:18
user292970
11
11
Can you be more specific than "does not recognize"? One possibility is that your python script is not properly terminating the file - and that the subsequent re-save is
â steeldriver
May 29 at 2:59
Have you diffed the file before and after opening and saving the file? Your text editor maybe doing something else when you save the file like removing whitespace at the end off lines etc.
â rusty shackleford
May 29 at 7:56
The comment from rusty led to a solution. After diffing the two files, I found that the one not recognized by the executable was missing a newline character. Problem solved!
â user292970
May 31 at 18:10
add a comment |Â
Can you be more specific than "does not recognize"? One possibility is that your python script is not properly terminating the file - and that the subsequent re-save is
â steeldriver
May 29 at 2:59
Have you diffed the file before and after opening and saving the file? Your text editor maybe doing something else when you save the file like removing whitespace at the end off lines etc.
â rusty shackleford
May 29 at 7:56
The comment from rusty led to a solution. After diffing the two files, I found that the one not recognized by the executable was missing a newline character. Problem solved!
â user292970
May 31 at 18:10
Can you be more specific than "does not recognize"? One possibility is that your python script is not properly terminating the file - and that the subsequent re-save is
â steeldriver
May 29 at 2:59
Can you be more specific than "does not recognize"? One possibility is that your python script is not properly terminating the file - and that the subsequent re-save is
â steeldriver
May 29 at 2:59
Have you diffed the file before and after opening and saving the file? Your text editor maybe doing something else when you save the file like removing whitespace at the end off lines etc.
â rusty shackleford
May 29 at 7:56
Have you diffed the file before and after opening and saving the file? Your text editor maybe doing something else when you save the file like removing whitespace at the end off lines etc.
â rusty shackleford
May 29 at 7:56
The comment from rusty led to a solution. After diffing the two files, I found that the one not recognized by the executable was missing a newline character. Problem solved!
â user292970
May 31 at 18:10
The comment from rusty led to a solution. After diffing the two files, I found that the one not recognized by the executable was missing a newline character. Problem solved!
â user292970
May 31 at 18:10
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f446584%2ftrouble-creating-text-input-file-for-linux-executable%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Can you be more specific than "does not recognize"? One possibility is that your python script is not properly terminating the file - and that the subsequent re-save is
â steeldriver
May 29 at 2:59
Have you diffed the file before and after opening and saving the file? Your text editor maybe doing something else when you save the file like removing whitespace at the end off lines etc.
â rusty shackleford
May 29 at 7:56
The comment from rusty led to a solution. After diffing the two files, I found that the one not recognized by the executable was missing a newline character. Problem solved!
â user292970
May 31 at 18:10