Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dangerous side effect in run_C-ESM-EP.py #44

Open
jypeter opened this issue Feb 18, 2021 · 0 comments
Open

Dangerous side effect in run_C-ESM-EP.py #44

jypeter opened this issue Feb 18, 2021 · 0 comments

Comments

@jypeter
Copy link

jypeter commented Feb 18, 2021

@jservonnat I have finally solved one my problems, generated by a vicious python side effect. I had fortunately already run into this kind of error a few times

You have a loop on available_components in your code
for component in available_components:
but you remove the component if you don't find the matching diagnostics_.py file.

        print "Skipping component ", component, " which diagnostic file is not readable"
        available_components.remove(component)

This can happen when the user has created some sub-directories of his own in the comparison directory. It was my case and I ended up with some legitimate components not taken into account (in the front page creation).

To be safe, you should never change the content of an object you are currently looping on!

This problem can be easily solved (in this particular case) by looping on a copy of the object
for component in available_components[:]:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant