Mac Terminal Strange Behavior (without entering a line at the entrance, without visible text)

I am on Mac OS X 10.11.3 My terminal looks like this:

[ Fabian@MacBook-Pro ] > [ Fabian@MacBook-Pro ] > pyspark Python 2.7.11 (default, Jan 29 2016, 17:48:19) [GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin Type "help", "copyright", "credits" or "license" for more information. 16/03/17 10:08:22 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable Welcome to ____ __ / __/__ ___ _____/ /__ _\ \/ _ \/ _ `/ __/ '_/ /__ / .__/\_,_/_/ /_/\_\ version 1.6.1 /_/ Using Python version 2.7.11 (default, Jan 29 2016 17:48:19) SparkContext available as sc, HiveContext available as sqlContext. >>> print 'hello' >>> hello >>> quit() >>> [ Fabian@MacBook-Pro ] > [ Fabian@MacBook-Pro ] > [ Fabian@MacBook-Pro ] > [ Fabian@MacBook-Pro ] > -bash: printsf: command not found 

in the first line, I press the enter button, and as you can see, the invitation starts on another line, then I start pyspark, do something and end, and then when I return to the invitation, I press enter and, as you can see , the invitation does not appear on a new line! I actually print and don't print anything on the screen, however the commands are executed, as you can see

  -bash: printsf: command not found 

my.bash_profile (located in the / Users / Fabian folder) looks like this

 # Setting PATH for Python 3.4 # The orginal version is saved in .bash_profile.pysave PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}" export PATH export LC_ALL=en_US.UTF-8 export LANG=en_US.UTF-8 export PYTHONPATH=$PYTHONPATH:/Users/Fabian/Library/Python ## # Your previous /Users/Fabian/.bash_profile file was backed up as /Users/Fabian/.bash_profile.macports-saved_2016-02-07_at_11:26:24 ## # MacPorts Installer addition on 2016-02-07_at_11:26:24: adding an appropriate PATH variable for use with MacPorts. export PATH="/opt/local/bin:/opt/local/sbin:$PATH" # Finished adapting your PATH environment variable for use with MacPorts. export JAVA_HOME=$(/usr/libexec/java_home) export PATH=$PATH:/Users/Fabian/apache-maven-3.3.9/bin export PS1="[\ u@ \h] > " export PATH=$PATH:/Users/Fabian/spark-1.6.1-bin-hadoop2.6/bin 

How can I fix this behavior? Thanks!

+5
source share
3 answers

As noted in the comments (and as described by OP), the expected new line after each message was lost. This is due to the fact that the application has changed the terminal I / O modes regarding carriage return / line, for example,

  • pressing Enter (which is a carriage return) was not translated into a new line (actually a line), but
  • newlines sent from the computer were not translated into carriage return / line.

However, on "any" keyboard, you can enter a new line by pressing control J. Common fixes first press control J to get a prompt, and complete the command by pressing control J ):

  • stty sane (resets the terminal driver)
  • reset (resets the terminal driver, and also asks the terminal to reset itself).
+4
source

This may be caused by an escape character that, when printed to the terminal, causes it to go blank. This usually helps if you close this terminal window and open a new one. Perhaps pyspark uses some escape codes (for color or design) and then forgets to revert its changes. You can try running pyspark with the terminal type dumb instead of xterm-256color . This can be done using the $TERM Environment Variable. Try echo $TERM before starting pyspark .

0
source

I had the same problem installing python 2.7.12 with macport. This might be a coincidence because I tried a lot of things, but "sudo port install py27-readline" fixed the problem for me.

0
source

Source: https://habr.com/ru/post/1245249/


All Articles