-
-
Notifications
You must be signed in to change notification settings - Fork 410
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
PyCharm debugging leads to TypeError
if add_xxx()
is called
#6789
Comments
Hi @LucaMarconato. It looks really strange as self is popped form kwargs here: napari/napari/utils/_register.py Line 9 in daf7205
And a line referred by this error is napari/napari/utils/_register.py Line 13 in daf7205
As I cannot reproduce this on my machine so I could only ask you to try to use debugger with steep by steep and see where is a problem, why |
I tried adding a |
I haven't tried updating/reinstalling PyCharm or installing |
…6791) # References and relevant issues The problem is visible in stacktrace from here #6789 (comment) # Description Instead of using a string template and passing source file name, create template file and pass the path to it to compile function. On main: ```python Traceback (most recent call last): File "/home/czaki/Projekty/napari/examples/add_points.py", line 22, in <module> viewer.add_points(points, size=size) File "/home/czaki/Projekty/napari/napari/components/viewer_model.py", line 7, in add_points from collections.abc import Iterator, Sequence ^^^^^^^^^^^^^^^^ File "/home/czaki/Projekty/napari/napari/layers/base/base.py", line 112, in __call__ raise ValueError("sample exception") ValueError: sample exception ``` with this PR: ```python Traceback (most recent call last): File "/home/czaki/Projekty/napari/examples/add_points.py", line 22, in <module> viewer.add_points(points, size=size) File "/home/czaki/Projekty/napari/napari/utils/add_layer.py_tmpl", line 7, in add_points layer = {cls_name}(**kwargs) ^^^^^^^^^^^^^^^^ File "/home/czaki/Projekty/napari/napari/layers/base/base.py", line 112, in __call__ raise ValueError("sample exception") ValueError: sample exception ``` You can see that before this change, `from collections.abc import Iterator, Sequence` points to an incorrect line of code regarding the source of the error.
Reinstalling napari from main didn't help, working on a fresh conda env neither. I ended up completely removing conda from my machine and reinstalling it, which worked. So now I am finally not experiencing this bug anymore. |
I celebrated too early, the problem was not fixed, but now I managed to implement a workaround. In details:
|
What happens if you change |
Good point! Yes, now it works, by applying the change you proposed in |
@LucaMarconato would you like to open a PR? 😃 |
🐛 Bug Report
I used to be able to use the debugger in PyCharm for code using
napari
. Since around 2 weeks if I try to run a script in debug mode in PyCharm and the script calls one of theadd_xxx
functions, for instanceadd_points()
, I receive aTypeError
exception.Running the script in Run mode works. Also the debugger works everywhere else. I am using the latest released napari.
The backtrace for the error I get is the following:
💡 Steps to Reproduce
💡 Expected Behavior
The script should execute normally.
🌎 Environment
napari: 0.4.19.post1
Platform: macOS-13.4.1-arm64-arm-64bit
System: MacOS 13.4.1
Python: 3.10.13 | packaged by conda-forge | (main, Oct 26 2023, 18:09:17) [Clang 16.0.6 ]
Qt: 5.15.8
PyQt5: 5.15.9
NumPy: 1.26.3
SciPy: 1.11.4
Dask: 2023.12.1
VisPy: 0.14.1
magicgui: 0.8.1
superqt: 0.6.1
in-n-out: 0.1.9
app-model: 0.2.4
npe2: 0.7.3
OpenGL:
Screens:
Settings path:
Plugins:
💡 Additional Context
No response
The text was updated successfully, but these errors were encountered: