Updated version of yaml file is not getting read The Next CEO of Stack OverflowHow do I check whether a file exists without exceptions?How to get the current time in PythonWhat is the difference between YAML and JSON? When to prefer one over the otherHow can I parse a YAML file in PythonHow do you do block comments in YAML?How do I list all files of a directory?How to read a file line-by-line into a list?In YAML, how do I break a string over multiple lines?Delete a file or folderWhy is reading lines from stdin much slower in C++ than Python?
Is it possible to use a NPN BJT as switch, from single power source?
Dominated convergence theorem - what sequence?
Math-accent symbol over parentheses enclosing accented symbol (amsmath)
How to invert MapIndexed on a ragged structure? How to construct a tree from rules?
Why doesn't UK go for the same deal Japan has with EU to resolve Brexit?
WOW air has ceased operation, can I get my tickets refunded?
When you upcast Blindness/Deafness, do all targets suffer the same effect?
Is it ever safe to open a suspicious HTML file (e.g. email attachment)?
What happened in Rome, when the western empire "fell"?
Where do students learn to solve polynomial equations these days?
Is micro rebar a better way to reinforce concrete than rebar?
Find non-case sensitive string in a mixed list of elements?
How to prove a simple equation?
Why didn't Khan get resurrected in the Genesis Explosion?
Why is information "lost" when it got into a black hole?
Method for adding error messages to a dictionary given a key
Bartok - Syncopation (1): Meaning of notes in between Grand Staff
Proper way to express "He disappeared them"
Is the D&D universe the same as the Forgotten Realms universe?
Help understanding this unsettling image of Titan, Epimetheus, and Saturn's rings?
A small doubt about the dominated convergence theorem
Can we say or write : "No, it'sn't"?
Why isn't the Mueller report being released completely and unredacted?
Where does this common spurious transmission come from? Is there a quality difference?
Updated version of yaml file is not getting read
The Next CEO of Stack OverflowHow do I check whether a file exists without exceptions?How to get the current time in PythonWhat is the difference between YAML and JSON? When to prefer one over the otherHow can I parse a YAML file in PythonHow do you do block comments in YAML?How do I list all files of a directory?How to read a file line-by-line into a list?In YAML, how do I break a string over multiple lines?Delete a file or folderWhy is reading lines from stdin much slower in C++ than Python?
I am reading a yaml file like so in Python3:
def get_file():
file_name = "file.yml"
properties_stream = open(file_name, 'r')
properties_file = yaml.safe_load(properties_stream)
properties_stream.close()
print(properties_file)
return properties_file
When I update file.yml by adding keys or deleting all the contents of the file, the "print(properties_file)" statement is still retaining the contents of the yaml file the first time I ran this code.
Any ideas why this might be happening?
python python-3.x yaml pyyaml
add a comment |
I am reading a yaml file like so in Python3:
def get_file():
file_name = "file.yml"
properties_stream = open(file_name, 'r')
properties_file = yaml.safe_load(properties_stream)
properties_stream.close()
print(properties_file)
return properties_file
When I update file.yml by adding keys or deleting all the contents of the file, the "print(properties_file)" statement is still retaining the contents of the yaml file the first time I ran this code.
Any ideas why this might be happening?
python python-3.x yaml pyyaml
2
Are you sure you are editing the file in the current directory (i.e. from where you start the program)? I recommend you either (temporarily) remove the file or use an absolute path to be 100% sure. Maybe you used the correct/recommended extension for YAML file that you are editing (that has been.yaml
since 2006) and are loading a different file.
– Anthon
Mar 21 at 18:13
Thanks! This helped me resolve the issue.
– jli24
Mar 22 at 13:24
add a comment |
I am reading a yaml file like so in Python3:
def get_file():
file_name = "file.yml"
properties_stream = open(file_name, 'r')
properties_file = yaml.safe_load(properties_stream)
properties_stream.close()
print(properties_file)
return properties_file
When I update file.yml by adding keys or deleting all the contents of the file, the "print(properties_file)" statement is still retaining the contents of the yaml file the first time I ran this code.
Any ideas why this might be happening?
python python-3.x yaml pyyaml
I am reading a yaml file like so in Python3:
def get_file():
file_name = "file.yml"
properties_stream = open(file_name, 'r')
properties_file = yaml.safe_load(properties_stream)
properties_stream.close()
print(properties_file)
return properties_file
When I update file.yml by adding keys or deleting all the contents of the file, the "print(properties_file)" statement is still retaining the contents of the yaml file the first time I ran this code.
Any ideas why this might be happening?
python python-3.x yaml pyyaml
python python-3.x yaml pyyaml
asked Mar 21 at 18:02
jli24jli24
12
12
2
Are you sure you are editing the file in the current directory (i.e. from where you start the program)? I recommend you either (temporarily) remove the file or use an absolute path to be 100% sure. Maybe you used the correct/recommended extension for YAML file that you are editing (that has been.yaml
since 2006) and are loading a different file.
– Anthon
Mar 21 at 18:13
Thanks! This helped me resolve the issue.
– jli24
Mar 22 at 13:24
add a comment |
2
Are you sure you are editing the file in the current directory (i.e. from where you start the program)? I recommend you either (temporarily) remove the file or use an absolute path to be 100% sure. Maybe you used the correct/recommended extension for YAML file that you are editing (that has been.yaml
since 2006) and are loading a different file.
– Anthon
Mar 21 at 18:13
Thanks! This helped me resolve the issue.
– jli24
Mar 22 at 13:24
2
2
Are you sure you are editing the file in the current directory (i.e. from where you start the program)? I recommend you either (temporarily) remove the file or use an absolute path to be 100% sure. Maybe you used the correct/recommended extension for YAML file that you are editing (that has been
.yaml
since 2006) and are loading a different file.– Anthon
Mar 21 at 18:13
Are you sure you are editing the file in the current directory (i.e. from where you start the program)? I recommend you either (temporarily) remove the file or use an absolute path to be 100% sure. Maybe you used the correct/recommended extension for YAML file that you are editing (that has been
.yaml
since 2006) and are loading a different file.– Anthon
Mar 21 at 18:13
Thanks! This helped me resolve the issue.
– jli24
Mar 22 at 13:24
Thanks! This helped me resolve the issue.
– jli24
Mar 22 at 13:24
add a comment |
1 Answer
1
active
oldest
votes
Anthon was correct. Turned out I had two folders with the same name in my project directory in a different subdirectory and it was reading from the wrong file.
add a comment |
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%2f55286620%2fupdated-version-of-yaml-file-is-not-getting-read%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Anthon was correct. Turned out I had two folders with the same name in my project directory in a different subdirectory and it was reading from the wrong file.
add a comment |
Anthon was correct. Turned out I had two folders with the same name in my project directory in a different subdirectory and it was reading from the wrong file.
add a comment |
Anthon was correct. Turned out I had two folders with the same name in my project directory in a different subdirectory and it was reading from the wrong file.
Anthon was correct. Turned out I had two folders with the same name in my project directory in a different subdirectory and it was reading from the wrong file.
answered Mar 22 at 13:24
jli24jli24
12
12
add a comment |
add a comment |
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%2f55286620%2fupdated-version-of-yaml-file-is-not-getting-read%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
2
Are you sure you are editing the file in the current directory (i.e. from where you start the program)? I recommend you either (temporarily) remove the file or use an absolute path to be 100% sure. Maybe you used the correct/recommended extension for YAML file that you are editing (that has been
.yaml
since 2006) and are loading a different file.– Anthon
Mar 21 at 18:13
Thanks! This helped me resolve the issue.
– jli24
Mar 22 at 13:24