3

I just encountered an issue with PyCharm. While I did find a workaround, I'm interested to know if there's a better solution to this issue.

During development, I had a variable named rIndex. I didn't notice until today that it was throwing out the following error, sent multiple times (2-4):

Traceback (most recent call last):
  File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 2016.1.4\helpers\pydev\_pydevd_bundle\pydevd_comm.py", line 1081, in do_it
    result = pydevd_vars.evaluate_expression(self.thread_id, self.frame_id, self.expression, self.doExec)
  File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 2016.1.4\helpers\pydev\_pydevd_bundle\pydevd_vars.py", line 352, in evaluate_expression
    Exec(expression, updated_globals, frame.f_locals)
  File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 2016.1.4\helpers\pydev\_pydevd_bundle\pydevd_exec.py", line 3, in Exec
    exec exp in global_vars, local_vars
  File "<string>", line 1
    rIndex = {NameError}name 'rIndex' is not defined
                           ^
SyntaxError: invalid syntax

I have no idea what would cause that, so I renamed my variable to rindex (replacing every instance), as well as removed a module-level instantiation of it; essentially removing the reference from every line of my code. (I verified this by doing a ctrl+F with the term "rIndex", case sensitive.)

When I went to re-run the script, I got the same error again, with multiple calls to it.

What would be the proper solution to fixing this issue?


My workaround was creating a new project, and copying the code over. While this worked, I would like to know a more-correct way of dealing with it (especially if future projects have multiple files and settings).

Sven
  • 127
  • 10

1 Answers1

5

I was facing similar issue, I realized I had watchers on my old variable. Errors were gone when I removed a variable from the watchlist.

J.S
  • 139
  • 2
  • 5