running Python script within Spyder does not show output in Console
I've created a script in Spyder. If I step through each line I see the output in the console. HOwever, if I click on the green "play" button to run the script, I see this message in the console,
pic of console message
However, if I F9 the last instruction, I get the expected output,
pic of console after F9 last script instruction
Here is the code:
path="C:/Users/jeriv/Documents/Python/ML_Andew_NG/data"
os.chdir(path)
file="ex1data1.txt"
data = pd.read_csv(file, header=None, names=['Population', 'Profit'])
data.head()
Any help is appreciated.
python
add a comment |
I've created a script in Spyder. If I step through each line I see the output in the console. HOwever, if I click on the green "play" button to run the script, I see this message in the console,
pic of console message
However, if I F9 the last instruction, I get the expected output,
pic of console after F9 last script instruction
Here is the code:
path="C:/Users/jeriv/Documents/Python/ML_Andew_NG/data"
os.chdir(path)
file="ex1data1.txt"
data = pd.read_csv(file, header=None, names=['Population', 'Profit'])
data.head()
Any help is appreciated.
python
You should see ifrunfile()
have an option such asstdout
andbuffer
. Usually this behavior arise when you run a script inside a script. The launcher will buffer the script output and dump the whole thing in one go instead of line by line. I think this has less to do with Spyder and more with the console being used iPython(because of the screenshots)
– dmb
Feb 8 at 18:00
I modified data.heat() to print(data.head()) and that displays the output in the console. Not sure I understand why F9'ing data.head() displays the output in the console, but executing that same instruction within the script when it is run does not. Thanks for your help @dmb.
– jrive
Feb 9 at 14:51
add a comment |
I've created a script in Spyder. If I step through each line I see the output in the console. HOwever, if I click on the green "play" button to run the script, I see this message in the console,
pic of console message
However, if I F9 the last instruction, I get the expected output,
pic of console after F9 last script instruction
Here is the code:
path="C:/Users/jeriv/Documents/Python/ML_Andew_NG/data"
os.chdir(path)
file="ex1data1.txt"
data = pd.read_csv(file, header=None, names=['Population', 'Profit'])
data.head()
Any help is appreciated.
python
I've created a script in Spyder. If I step through each line I see the output in the console. HOwever, if I click on the green "play" button to run the script, I see this message in the console,
pic of console message
However, if I F9 the last instruction, I get the expected output,
pic of console after F9 last script instruction
Here is the code:
path="C:/Users/jeriv/Documents/Python/ML_Andew_NG/data"
os.chdir(path)
file="ex1data1.txt"
data = pd.read_csv(file, header=None, names=['Population', 'Profit'])
data.head()
Any help is appreciated.
python
python
asked Feb 8 at 16:17
jrivejrive
12
12
You should see ifrunfile()
have an option such asstdout
andbuffer
. Usually this behavior arise when you run a script inside a script. The launcher will buffer the script output and dump the whole thing in one go instead of line by line. I think this has less to do with Spyder and more with the console being used iPython(because of the screenshots)
– dmb
Feb 8 at 18:00
I modified data.heat() to print(data.head()) and that displays the output in the console. Not sure I understand why F9'ing data.head() displays the output in the console, but executing that same instruction within the script when it is run does not. Thanks for your help @dmb.
– jrive
Feb 9 at 14:51
add a comment |
You should see ifrunfile()
have an option such asstdout
andbuffer
. Usually this behavior arise when you run a script inside a script. The launcher will buffer the script output and dump the whole thing in one go instead of line by line. I think this has less to do with Spyder and more with the console being used iPython(because of the screenshots)
– dmb
Feb 8 at 18:00
I modified data.heat() to print(data.head()) and that displays the output in the console. Not sure I understand why F9'ing data.head() displays the output in the console, but executing that same instruction within the script when it is run does not. Thanks for your help @dmb.
– jrive
Feb 9 at 14:51
You should see if
runfile()
have an option such as stdout
and buffer
. Usually this behavior arise when you run a script inside a script. The launcher will buffer the script output and dump the whole thing in one go instead of line by line. I think this has less to do with Spyder and more with the console being used iPython(because of the screenshots)– dmb
Feb 8 at 18:00
You should see if
runfile()
have an option such as stdout
and buffer
. Usually this behavior arise when you run a script inside a script. The launcher will buffer the script output and dump the whole thing in one go instead of line by line. I think this has less to do with Spyder and more with the console being used iPython(because of the screenshots)– dmb
Feb 8 at 18:00
I modified data.heat() to print(data.head()) and that displays the output in the console. Not sure I understand why F9'ing data.head() displays the output in the console, but executing that same instruction within the script when it is run does not. Thanks for your help @dmb.
– jrive
Feb 9 at 14:51
I modified data.heat() to print(data.head()) and that displays the output in the console. Not sure I understand why F9'ing data.head() displays the output in the console, but executing that same instruction within the script when it is run does not. Thanks for your help @dmb.
– jrive
Feb 9 at 14:51
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
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',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1403581%2frunning-python-script-within-spyder-does-not-show-output-in-console%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1403581%2frunning-python-script-within-spyder-does-not-show-output-in-console%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You should see if
runfile()
have an option such asstdout
andbuffer
. Usually this behavior arise when you run a script inside a script. The launcher will buffer the script output and dump the whole thing in one go instead of line by line. I think this has less to do with Spyder and more with the console being used iPython(because of the screenshots)– dmb
Feb 8 at 18:00
I modified data.heat() to print(data.head()) and that displays the output in the console. Not sure I understand why F9'ing data.head() displays the output in the console, but executing that same instruction within the script when it is run does not. Thanks for your help @dmb.
– jrive
Feb 9 at 14:51