简体   繁体   中英

Pycharm Debug mode syntax error

all of a sudden when running PyCharm Community edition i've started to get this syntax error when running debug mode. I tried reinstalling PyCharm but had no luck with the error. Anyone see this before?

Traceback (most recent call last):
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydevd.py", line 26, in <module>
    from _pydevd_bundle.pydevd_additional_thread_info import PyDBAdditionalThreadInfo
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydevd_bundle/pydevd_additional_thread_info.py", line 19, in <module>
    from _pydevd_bundle.pydevd_additional_thread_info_regular import PyDBAdditionalThreadInfo  # @UnusedImport
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydevd_bundle/pydevd_additional_thread_info_regular.py", line 5, in <module>
    from _pydevd_bundle.pydevd_frame import PyDBFrame
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydevd_bundle/pydevd_frame.py", line 10, in <module>
    from _pydevd_bundle.pydevd_breakpoints import get_exception_breakpoint
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydevd_bundle/pydevd_breakpoints.py", line 15, in <module>
    from _pydevd_bundle.pydevd_comm import get_global_debugger
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydevd_bundle/pydevd_comm.py", line 75, in <module>
    import pydevconsole
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydevconsole.py", line 10, in <module>
    from _pydevd_bundle.pydevconsole_code_for_ironpython import InteractiveConsole
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydevd_bundle/pydevconsole_code_for_ironpython.py", line 105
    except SyntaxError, err:
                      ^
SyntaxError: invalid syntax

If you don't care about any project specific configurations or run configurations:

  1. quit pycharm
  2. delete .idea folder in your project folder
  3. start pycharm

I've used this method as a quick fix solution when I encountered this issue late last night. But, the very nature of this solution indicates that this issue is caused by some corruption in the .idea folder. Were I to encounter this problem again, I would suggest a different approach:

  1. first, try to search for the error text in the files in the .idea folder
  2. if the previous step fails:
    1. quit pycharm
    2. move the .idea folder inside the project folder to a safe location
    3. start pycharm to create a fresh .idea folder and quit it again
    4. preform a 3-way merge between the old and the new .idea folders
    5. start pycharm

If you have __init__.py in your current path, delete it. Or if your file name is code.py , rename to something else.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM