Skip to content

Demo34 + NumPy #287

Closed
Closed
@dominiced

Description

@dominiced

Hello!

I would really appreciate some help. I want to completely clear Python state after each script execution so a fresh interpreter is ready for the next time a script is executed. I've used Demo34 as an example for completely destroying and recreating an engine for each script execution, however, this causes problems with NumPy because NumPy doesn't like being finalized and then reinitialized.

This simple problem can be recreated by running demo34, modifying the Python script to simply "import numpy" and nothing else, execute, and then switch to and from a different python version to cause it to destroy and recreate the Python engine.

image

  1. Since we're completely recreating the Python engine, I would have expected all previous memory and state to be cleared. How come NumPy knows it's been previously run?
  2. Is there a better way of completely clearing state when re-running Python scripts in P4D? One which might not cause issues for NumPy? I need to completely clear state, because otherwise I get other issues because old variables are hanging around in memory. I'd prefer everything to be cleaned up after each run.

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions