Easy filewrite in Python works unexpectedlyCalling an external command in PythonWhat are metaclasses in Python?Finding the index of an item given a list containing it in PythonWhat is the difference between Python's list methods append and extend?How can I safely create a nested directory in Python?Does Python have a ternary conditional operator?How to get the current time in PythonHow can I make a time delay in Python?Does Python have a string 'contains' substring method?How can I find script's directory with Python?
How much of a wave function must reside inside event horizon for it to be consumed by the black hole?
How can I practically buy stocks?
How do I produce this Greek letter koppa: Ϟ in pdfLaTeX?
How do I reattach a shelf to the wall when it ripped out of the wall?
Can someone publish a story that happened to you?
Why must Chinese maps be obfuscated?
All ASCII characters with a given bit count
What is purpose of DB Browser(dbbrowser.aspx) under admin tool?
As an international instructor, should I openly talk about my accent?
How long after the last departure shall the airport stay open for an emergency return?
"The cow" OR "a cow" OR "cows" in this context
Can a level 2 Warlock take one level in rogue, then continue advancing as a warlock?
Unknown code in script
What *exactly* is electrical current, voltage, and resistance?
Magical attacks and overcoming damage resistance
How important is it that $TERM is correct?
Why do games have consumables?
How do I check if a string is entirely made of the same substring?
How can I get rid of an unhelpful parallel branch when unpivoting a single row?
What does "function" actually mean in music?
Why didn't the Space Shuttle bounce back into space as many times as possible so as to lose a lot of kinetic energy up there?
How bug prioritization works in agile projects vs non agile
Cayley's Matrix Notation
I preordered a game on my Xbox while on the home screen of my friend's account. Which of us owns the game?
Easy filewrite in Python works unexpectedly
Calling an external command in PythonWhat are metaclasses in Python?Finding the index of an item given a list containing it in PythonWhat is the difference between Python's list methods append and extend?How can I safely create a nested directory in Python?Does Python have a ternary conditional operator?How to get the current time in PythonHow can I make a time delay in Python?Does Python have a string 'contains' substring method?How can I find script's directory with Python?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I am running the same basic script both via eclipse and via (python) command line.
The script is:
filepath = "C:/remove/"
filename = "odissey.txt"
f = open(filepath+filename, "w")
print(f.write("CHEEECK!"))
f.close()
When I run it on eclipse, it works.
When I run it on command line, it prints the same values as if it worked.
Then I look in to the folder and the folder is empty.
What seems to be happening here?
python filewriter
|
show 10 more comments
I am running the same basic script both via eclipse and via (python) command line.
The script is:
filepath = "C:/remove/"
filename = "odissey.txt"
f = open(filepath+filename, "w")
print(f.write("CHEEECK!"))
f.close()
When I run it on eclipse, it works.
When I run it on command line, it prints the same values as if it worked.
Then I look in to the folder and the folder is empty.
What seems to be happening here?
python filewriter
just put the write command outside the print
– Hugo Delahaye
Mar 22 at 16:47
How exactly are you running things?
– juanpa.arrivillaga
Mar 22 at 16:48
@Hugo Nope, it is not the problem
– Simon
Mar 22 at 16:49
@Juan, Python v3.7. Compiler: eclipse workspace but the same file giving an effect by creating a file when it runs from eclipse is not giving the file (while outputing the same correct print) if called by command line
– Simon
Mar 22 at 16:50
1
No, how exactly? Provide the actual terminal input/output.
– juanpa.arrivillaga
Mar 22 at 16:52
|
show 10 more comments
I am running the same basic script both via eclipse and via (python) command line.
The script is:
filepath = "C:/remove/"
filename = "odissey.txt"
f = open(filepath+filename, "w")
print(f.write("CHEEECK!"))
f.close()
When I run it on eclipse, it works.
When I run it on command line, it prints the same values as if it worked.
Then I look in to the folder and the folder is empty.
What seems to be happening here?
python filewriter
I am running the same basic script both via eclipse and via (python) command line.
The script is:
filepath = "C:/remove/"
filename = "odissey.txt"
f = open(filepath+filename, "w")
print(f.write("CHEEECK!"))
f.close()
When I run it on eclipse, it works.
When I run it on command line, it prints the same values as if it worked.
Then I look in to the folder and the folder is empty.
What seems to be happening here?
python filewriter
python filewriter
edited Mar 22 at 17:52
Pygasm
753721
753721
asked Mar 22 at 16:45
SimonSimon
1
1
just put the write command outside the print
– Hugo Delahaye
Mar 22 at 16:47
How exactly are you running things?
– juanpa.arrivillaga
Mar 22 at 16:48
@Hugo Nope, it is not the problem
– Simon
Mar 22 at 16:49
@Juan, Python v3.7. Compiler: eclipse workspace but the same file giving an effect by creating a file when it runs from eclipse is not giving the file (while outputing the same correct print) if called by command line
– Simon
Mar 22 at 16:50
1
No, how exactly? Provide the actual terminal input/output.
– juanpa.arrivillaga
Mar 22 at 16:52
|
show 10 more comments
just put the write command outside the print
– Hugo Delahaye
Mar 22 at 16:47
How exactly are you running things?
– juanpa.arrivillaga
Mar 22 at 16:48
@Hugo Nope, it is not the problem
– Simon
Mar 22 at 16:49
@Juan, Python v3.7. Compiler: eclipse workspace but the same file giving an effect by creating a file when it runs from eclipse is not giving the file (while outputing the same correct print) if called by command line
– Simon
Mar 22 at 16:50
1
No, how exactly? Provide the actual terminal input/output.
– juanpa.arrivillaga
Mar 22 at 16:52
just put the write command outside the print
– Hugo Delahaye
Mar 22 at 16:47
just put the write command outside the print
– Hugo Delahaye
Mar 22 at 16:47
How exactly are you running things?
– juanpa.arrivillaga
Mar 22 at 16:48
How exactly are you running things?
– juanpa.arrivillaga
Mar 22 at 16:48
@Hugo Nope, it is not the problem
– Simon
Mar 22 at 16:49
@Hugo Nope, it is not the problem
– Simon
Mar 22 at 16:49
@Juan, Python v3.7. Compiler: eclipse workspace but the same file giving an effect by creating a file when it runs from eclipse is not giving the file (while outputing the same correct print) if called by command line
– Simon
Mar 22 at 16:50
@Juan, Python v3.7. Compiler: eclipse workspace but the same file giving an effect by creating a file when it runs from eclipse is not giving the file (while outputing the same correct print) if called by command line
– Simon
Mar 22 at 16:50
1
1
No, how exactly? Provide the actual terminal input/output.
– juanpa.arrivillaga
Mar 22 at 16:52
No, how exactly? Provide the actual terminal input/output.
– juanpa.arrivillaga
Mar 22 at 16:52
|
show 10 more comments
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
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%2fstackoverflow.com%2fquestions%2f55304267%2feasy-filewrite-in-python-works-unexpectedly%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 Stack Overflow!
- 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%2fstackoverflow.com%2fquestions%2f55304267%2feasy-filewrite-in-python-works-unexpectedly%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
just put the write command outside the print
– Hugo Delahaye
Mar 22 at 16:47
How exactly are you running things?
– juanpa.arrivillaga
Mar 22 at 16:48
@Hugo Nope, it is not the problem
– Simon
Mar 22 at 16:49
@Juan, Python v3.7. Compiler: eclipse workspace but the same file giving an effect by creating a file when it runs from eclipse is not giving the file (while outputing the same correct print) if called by command line
– Simon
Mar 22 at 16:50
1
No, how exactly? Provide the actual terminal input/output.
– juanpa.arrivillaga
Mar 22 at 16:52