0

When I copy and paste Python code for evaluation into iTerm, or the Mac terminal, often times it will come up with an error if I am pasting in many functions. I have to repeat the process often many times until I can get it to read correctly.

I suspect this is related to the speed at which iTerm reads the pasted lines. Is there a reason for this problem and is there a way for me to fix it? Thanks

user145416
  • 173
  • 3
  • write to a file and run it as a command, for example linux uses .sh files for bash commands in files and you can do the same in windows with .bat –  Apr 20 '22 at 17:37
  • When you talk about terminal, you mean that you're running Python's REPL in it before pasting your code, right? If this is the case, note that the REPL really needs empty lines after functions bodies, so make sure they are present everywhere in your code. – Thierry Lathuille Apr 20 '22 at 17:39
  • Instead of pasting into the REPL, paste into a file and run the script with `python filename`. The REPL is really only good for very small bits of code, not whole scripts. – Barmar Apr 20 '22 at 17:46

0 Answers0