reloadware / reloadium

Hot Reloading and Profiling for Python
https://reloadium.io
Apache License 2.0
2.74k stars 56 forks source link

only can't run in reloadium #155

Closed jialay closed 10 months ago

jialay commented 11 months ago

when the class "CollinearMagneticStructureAnalyzer" from "pymatgen.analysis.magnetism.analyzer" is used, the reloadium failed to run or debug. The code is ok in original debug mode. I find that the 'struc' object is changed to a generator, which should not be.

dkrystki commented 11 months ago

Could you provide the source code of the class or a reproducer? Also could you paste the error message ( you may need to run it with "RW_DEBUG" environmental variable set to True )?

jialay commented 11 months ago

Could you provide the source code of the class or a reproducer? Also could you paste the error message ( you may need to run it with "RW_DEBUG" environmental variable set to True )?

the following code reproduce the error, it runs well, but only can't debug in reloadium, and just output the error code :“AttributeError: 'generator' object has no attribute 'copy' ”.

"

to run the code, module pymatgen should be installed.

from pymatgen.core import Structure from pymatgen.analysis.magnetism.analyzer import CollinearMagneticStructureAnalyzer struct_a = Structure([[3, 0, 0], [0, 3, 0], [0, 0, 3]], ['Cr'], [[0, 0, 0]]) struct_b = Structure([[3, 0, 0], [0, 3, 0], [0, 0, 3]], ['Cr'], [[0, 0.5, 0.5]]) dup_ck = CollinearMagneticStructureAnalyzer(struct_a, overwrite_magmom_mode="none") if dup_ck.matches_ordering2(struct_b): print('same structure') "

dkrystki commented 11 months ago

I was unable to reproduce this.

2023-08-01_12:53:15

Run on: Reloadium version: 1.2.0 Python version: 3.10.8 pymagnet version: 2023.7.20 Os: Linux q 5.4.0-42-generic #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

dkrystki commented 10 months ago

I managed to reproduce and fix this in Reloadium 1.2.1 and PyCharm plugin 1.2.1