Trouble Creating Text Input File for Linux Executable

The name of the pictureThe name of the pictureThe name of the pictureClash 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?







share|improve this question



















  • 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














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?







share|improve this question



















  • 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












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?







share|improve this question











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?









share|improve this question










share|improve this question




share|improve this question









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
















  • 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















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















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



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes










 

draft saved


draft discarded


























 


draft saved


draft discarded














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













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?