Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop CLion from automatic line breaking in string when printing to the Console in Python

Surprisingly I didn't find an answer to this seemingly very common problem. In Python when I print something to the CLion Console when the printed text is longer than 80 characters, an automatic line break is inserted. In hexadecimal I can see the inserted symbol is carriage return (0D 0A) on Windows. How can I stop this from happending?

Example:

print("99b17c2b92123eb0ba2a0afb2568d18247fc2b24385a65b8e2da7245bef278f799b17c2b92123eb0ba2a0afb2568d18247fc2b24385a65b8e2da7245bef278f7")

On the console it will automatically insert a line break after 80 characters:

Connected to pydev debugger (build 203.7148.70)
99b17c2b92123eb0ba2a0afb2568d18247fc2b24385a65b8e2da7245bef278f799b17c2b92123eb0
ba2a0afb2568d18247fc2b24385a65b8e2da7245bef278f7

I just want this to be printed unmodified like as follows:

Connected to pydev debugger (build 203.7148.70)
99b17c2b92123eb0ba2a0afb2568d18247fc2b24385a65b8e2da7245bef278f799b17c2b92123eb0ba2a0afb2568d18247fc2b24385a65b8e2da7245bef278f7
like image 589
BullyWiiPlaza Avatar asked Oct 19 '25 13:10

BullyWiiPlaza


1 Answers

As it turns out, this is a CLion bug which is still unresolved. However, a solution has been posted here:

  • go to Help | Edit Custom VM Options
  • when asked to create .vmoption file press OK
  • add -Dwin.pty.cols=120 (the number here is for console output width) restart CLion You might want to use this because run.processes.with.pty can be useful for an output of C/C++ applications.
like image 170
BullyWiiPlaza Avatar answered Oct 22 '25 01:10

BullyWiiPlaza



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!