Spyder crashes when replacing text
See original GitHub issueProblem Description
I have the (poorly written) python script below. I want to replace all instances of “particles” with “self.particles”. To do so, I do [Search] > [Replace text] and try to replace “particles” with “self.particles”. Spyder crashes immediately. I was having the issue with Spyder 4.1.2 inside Anaconda. I installed Spyder 4.2.0 using the stand-alone installer, but the error still exists.
What steps reproduce the problem?
- Copy the EXACT following code into an editor window without saving
import rhinoscriptsyntax as rs
import random
particles = []
speedmax = 10
cycles = 20
sepval =5
alignval = 0.02
chval = 0.02
class Particles:
def __init__(self):
pass
def run(self):
pass
def flock(self):
self.separate(sepval)
self.cohesion(chval)
self.align(alignval)
def separate(self, magnitude):
count = 0
steer = [0.001,0.001,0.001]
for i in range(0, len(particles)):
dist = rs.Distance(self.coord,particles[i].coord)
if dist>0 and dist <30 :
diff = rs.VectorSubtract(self.coord,particles[i].coord)
diff = rs.VectorUnitize(diff)
diff = rs.VectorScale(diff,1/dist)
steer = rs.VectorAdd(steer,diff)
count = count + 1
if count > 0:
steer = rs.VectorScale(steer,1/count)
steer = rs.VectorScale(steer,magnitude)
self.acc = rs.VectorAdd(self.acc,steer)
for i in range(nopoints):
particles.append(Particles())
for i in range(cycles):
for particle in particles:
#particle.drawPosition()
particle.run()
#for particle in particles:
# rs.AddCurve(particle.path)
- Click “CTRL+R” and replace “particles” with “self.particles”
- Click “ALL”
Note: I tried several times to reduce the code to nail down the error. The extremely weird thing is that it’s enough to replace one method’s content with pass
or deleting one of the rows at the beginning of the file containing those variables to prevent the error to occur.
However, with this EXACT content, I can reproduce the error systematically.
Versions
- Spyder version: 4.2.0
- Python version: 3.7.9 64-bit
- Qt version: 5.12.9
- PyQt version: 5.12.3
- Operating System name/version: Windows 10
Dependencies
# Mandatory:
atomicwrites >=1.2.0 : 1.4.0 (OK)
chardet >=2.0.0 : 3.0.4 (OK)
cloudpickle >=0.5.0 : 1.6.0 (OK)
diff_match_patch >=20181111 : 20200713 (OK)
intervaltree : None (OK)
IPython >=4.0 : 7.19.0 (OK)
jedi =0.17.2 : 0.17.2 (OK)
jsonschema >=3.2.0 : 3.2.0 (OK)
nbconvert >=4.0 : 6.0.7 (OK)
numpydoc >=0.6.0 : 1.1.0 (OK)
paramiko >=2.4.0 : 2.7.2 (OK)
parso =0.7.0 : 0.7.0 (OK)
pexpect >=4.4.0 : 4.8.0 (OK)
pickleshare >=0.4 : 0.7.5 (OK)
psutil >=5.3 : 5.7.3 (OK)
pygments >=2.0 : 2.7.2 (OK)
pylint >=1.0 : 2.6.0 (OK)
pyls >=0.36.1;<1.0.0 : 0.36.1 (OK)
pyls_black >=0.4.6 : 0.4.6 (OK)
pyls_spyder >=0.1.1 : 0.1.1 (OK)
qdarkstyle >=2.8 : 2.8.1 (OK)
qtawesome >=0.5.7 : 1.0.1 (OK)
qtconsole >=4.7.7 : 4.7.7 (OK)
qtpy >=1.5.0 : 1.9.0 (OK)
setuptools >=39.0.0 : 50.3.2 (OK)
sphinx >=0.6.6 : 3.3.0 (OK)
spyder_kernels >=1.10.0;<1.11.0 : 1.10.0 (OK)
three_merge >=0.1.1 : 0.1.1 (OK)
watchdog : None (OK)
zmq >=17 : 19.0.2 (OK)
# Optional:
cython >=0.21 : 0.29.21 (OK)
matplotlib >=2.0.0 : 3.3.2 (OK)
numpy >=1.7 : 1.19.4 (OK)
pandas >=1.1.1 : 1.1.4 (OK)
scipy >=0.17.0 : 1.5.4 (OK)
sympy >=0.7.3 : 1.6.2 (OK)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:7 (6 by maintainers)
Top Results From Across the Web
Manually closing the kivy app makes the spyder window ...
When i do it, the window crashes and i can't run the code anymore. import kivy kivy.require('1.0.6') # replace with your current kivy...
Read more >Walkthrough — tellurium 2.2.3 documentation
When Spyder IDE crashes, it will automatically try to recover on the next execution. However, if this does not happen, manually run the...
Read more >Spyder crashes at launch: "python.exe has stopped working"
1. Uninstalling and reinstalling · 2. Resetting spyder (spyder --reset) · 3. deleting the .spyder2 directory · 4. changing the spyder config file,...
Read more >The spyder app keeps crashing when I try to run a code
Changing the Spyder version would possibly solve the problem - I am using Spyder 5.0.5. If the issue persists, take a look at...
Read more >PySimpleGUI
A "Text Element" in PySimpleGUI == "Label Widget" in tkinter. ... Printing to a debug window is as easy as replacing print with...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @pj1989,
I could reproduce this error, we will work in this for our next release.
Thanks for reporting!
@rear1019, thanks for your thorough investigation of this bug! We’ll try to merge PR #16988 in our next version (5.3.3) to fix it.