1

I'm running CLion (2017.3 RC) with MinGW-w64 (5.0.3) and using gcc/g++ (7.2.0) + CMake (3.9.3) on Windows 10 x64 to compile a target that embeds python (3.6.3 64 bit). Everything works fine when run, however when I try to debug it and step through with CLion, I get

File "C:\Python36\Lib/site.py", line 178 file=sys.stderr) ^ SyntaxError: invalid syntax

I have my PYTHONPATH pointing towards a Python 3 installation. I do not have Python 2 installed on my system yet it seems like a Python 2 interpreter is trying to use the Python 3 Lib. After some digging I noticed that MinGW-w64 has Python 2 bundled with it but even if I delete the libs, include, and exe, I get the same error.

5
  • Have you verified the CLion python interpreter version? jetbrains.com/help/clion/… Commented Nov 16, 2017 at 23:17
  • Had no interpreter set, configured it to use my python3 installation. But no luck the same issue is persisting. Commented Nov 16, 2017 at 23:29
  • What is your CLion version? Commented Nov 17, 2017 at 14:03
  • 2017.3 RC. I can't test it yet but I have a feeling it might be the prerequisite mentioned here jetbrains.com/help/clion/python.html Commented Nov 17, 2017 at 14:44
  • Setting "run.processes.with.pty" in the registry to false did not fix the issue either. Any thoughts? Commented Nov 17, 2017 at 19:01

1 Answer 1

1

After some more digging I learned that python2 has been embedded in gdb from version 7.0+. Because of this, if you try to run MinGW64's gdb (like trying to debug from CLion) and you have PYTHONPATH pointing towards a python3 installation, you'll run into a syntax error. This happens because the embedded python2 is trying to use the python3 libs.

gdb failing with PYTHONPATH pointing towards a python3 installation

I am still unable to debug my C++ target that embeds python but that's a different issue...

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.