Skip to content

Unable to use debugger on scenario which calls parseAndLoadXML() from radiationPressure.py #187

@ephraim271

Description

@ephraim271

Describe the bug
While trying to use VS Code python debugger on a scenario which uses parseAndLoadXML() from radiationPressure.py, it stops with a valueError :
ValueError: cannot resize an array that references or is referenced by another array in this way. Use the resize function
So was unable to debug the scenario.

To reproduce
Steps to reproduce the behavior:
This should occur with any scenario which directly or indirectly calls parseAndLoadXML().
As an example : In basilisk/src/simulation/dynamics/RadiationPressure/_UnitTest/test_radiationPressure.py

  1. Change unitRadiationPressure(False, "cannonball", False) to unitRadiationPressure(False, "lookup", False) in __main__
  2. Set up a breakpoint in vscode just after handler.parseAndLoadXML(os.path.dirname(__file__) + "/cube_lookup.xml")
  3. Choose Debug python file in VS Code
  4. See error

Expected behavior
Ability to debug files which use parseAndLoadXML()

Screenshots
If applicable, add screenshots/plots to help explain your problem.
image

Desktop (please complete the following information):

  • OS: Ubuntu
  • Version 22.04
  • Python version 3.10

Additional context
Fix :
Adding refcheck=False to these resize calls in basilisk/src/simulation/dynamics/RadiationPressure/parseSRPLookup.py fixed the issue :

self.sHatBLookup.resize([len(list(sHatBTree)), 3], refcheck=False)
self.forceBLookup.resize([len(list(forceBTree)), 3], refcheck=False)
self.torqueBLookup.resize([len(list(torqueBTree)), 3], refcheck=False)

I can open a PR if others are able to reproduce.

Similar :
microsoft/ptvsd#465 (comment)
AUTOMATIC1111/stable-diffusion-webui#6506

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No fields configured for Bug.

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions