Python Forum
code works in python shell, but not in a terminal
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
code works in python shell, but not in a terminal
#5
We'll try to see if there is an invisible hidden character in the source file. Try this in a python shell,
in a directory containing the script
>>> for line in open('putPicsinColumn1version4.py'):
...     print(repr(line))
...
Then look around 'for sheet in sheets' in the output to see if there is something special there. Hidden characters may appear when someone copies and pastes a section of code from a pdf file into a code editor for example.
Reply


Messages In This Thread
RE: code works in python shell, but not in a terminal - by Gribouillis - Sep-09-2018, 01:04 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  set -x shell equivalent of python, possible/available? ggpf900 1 608 Jan-25-2025, 08:01 PM
Last Post: Gribouillis
  updating pip, python - understanding terminal and pycharm. endlessnameless 0 1,377 Jun-24-2024, 05:48 AM
Last Post: endlessnameless
  My code works on Jupyter Lab/Notebook, but NOT on Visual Code Editor jst 4 4,940 Nov-15-2023, 06:56 PM
Last Post: jst
  Help creating shell scrip for python file marciokoko 10 3,823 Sep-16-2023, 09:46 PM
Last Post: snippsat
  invoking python in Terminal Euler 2 1,383 Aug-25-2023, 06:17 AM
Last Post: perfringo
  Code works but doesn't give the right results colin_dent 2 1,523 Jun-22-2023, 06:04 PM
Last Post: jefsummers
  Launch Python IDLE Shell from terminal Pavel_47 5 2,870 Feb-17-2023, 02:53 PM
Last Post: Pavel_47
  Python VS Code: using print command twice but not getting output from terminal kdx264 4 2,307 Jan-16-2023, 07:38 PM
Last Post: Skaperen
  Code used to work 100%, now sometimes works! muzicman0 5 2,948 Jan-13-2023, 05:09 PM
Last Post: muzicman0
  Can a program execute code in iPython shell and get result? deanhystad 3 2,930 Jun-17-2022, 03:45 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020