qtconsole icon indicating copy to clipboard operation
qtconsole copied to clipboard

Turning off line wrapping in the iPython console

Open soldcake opened this issue 7 years ago • 10 comments

According to https://github.com/spyder-ide/spyder/issues/4904, this is issue in qtconsole.

Outputs of large tables and arrays are unreadable due to the line wrapping.

Need option to turn off line wrapping.

soldcake avatar Feb 14 '18 22:02 soldcake

Just want to chime in and support this nearly a year later. I'm on a non-Anaconda version of Spyder (4.0.0.dev3) and wrapping in the console still produces a lot of unreadable data.

MarkMoretto avatar Jan 08 '19 14:01 MarkMoretto

Dewit

ifly6 avatar Apr 15 '19 17:04 ifly6

Would be great if automatic line wrapping could be disabled by the user. Probably need to add to this function, something along the lines of

control.setLineWrapColumnOrWidth(10000)
control.setLineWrapMode(QtGui.QTextEdit.FixedPixelWidth)

Anyone who has more experience with Qt know what else would be needed?

astromancer avatar Sep 26 '19 14:09 astromancer

Another 1.5 years later, I need this too. Due to the numbers wraping its almost impossible to compare them from line to line, while they should be right next (above/below) to each other.

Eheran1 avatar Jun 01 '21 19:06 Eheran1

I don't normally use GitHub but was led here by an internet search. I see the green oval with the word "Open" inside. Would I be correct in concluding that this is still unresolved? I am using Spyder installed via Anaconda on Windows 10 and I see no preference switch for disabling line wrapping, and it has been almost 6 years since this was first mentioned on UseNet: https://groups.google.com/g/spyderlib/c/4ZJmwM2ZaP0. It's a pretty basic and essential function, so I wonder if I'm properly understanding the situation.

As a possible solution, I cannot use Spyder's Variable Explorer to view wide PySpark DataFrames, but it does show native data types fine. The GUI popup message says that the kernel is dead, but it obviously isn't because it can process Python commands. The IPython console is a bit more informative, but since I'm still trying to get to know Spark, I don't really understand it, though suspect that it boils down to something like "Spyder can't access PySpark DataFrames":

"It appears that you are attempting to reference SparkContext from a broadcast variable, action, or transformation. SparkContext can only be used on the driver, not in code that it run on workers. For more information, see SPARK-5063"

Googling SPARK-5063 yields discussions, but I will need to know Spark better in order to be sure of what they mean.

All this to say that being able to disable line wrapping would be very welcome. I hope that I am wrong in concluding that it still can't be disabled.

NotNormallyAGitUser avatar Oct 06 '23 23:10 NotNormallyAGitUser

Hey @NotNormallyAGitUser, please post a screenshot of what you're seeing when viewing PySpark DataFrames in Spyder so we can better understand the situation.

ccordoba12 avatar Oct 07 '23 17:10 ccordoba12

@ccordoba12: The following code is adapted from https://sparkbyexamples.com/pyspark/pyspark-read-csv-file-into-dataframe and the input data file is https://github.com/spark-examples/pyspark-examples/blob/master/resources/zipcodes.csv.

  from pyspark.sql import SparkSession
  spark = SparkSession.builder \
     .appName("SparkExamples.com").getOrCreate()
  df = spark.read.csv(
     r"C:\cygwin64\home\User.Name\tmp\zipcodes.csv",
     header=True )
  df.show()

image

NotNormallyAGitUser avatar Oct 08 '23 04:10 NotNormallyAGitUser

Thanks for the example @NotNormallyAGitUser. I'll try to address this in the next Qtconsole version (5.5.0), to be released next week.

ccordoba12 avatar Oct 19 '23 15:10 ccordoba12

Hey guys, I took a look at this issue and it's going to take more time than I expected. That's because it also needs a graphical option on the Spyder side so users can turn off wrapping (I thought they could do it directly in the console).

So, I'm going to leave it for Spyder 6, to be released at the beginning of next year. Thanks for understanding.

ccordoba12 avatar Nov 05 '23 23:11 ccordoba12

Thanks for the update, ccordoba12.

NotNormallyAGitUser avatar Nov 06 '23 16:11 NotNormallyAGitUser