# Why is my Python CLI input mangled?

**URL:** <https://discuss.python.org/t/why-is-my-python-cli-input-mangled/108891>\
**Category:** Python Help\
**Tags:** help\
**Created:** [September 4, 2026, 2:05pm UTC](https://discuss.python.org/t/why-is-my-python-cli-input-mangled/108891 "2026-09-04T14:05:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rokejulianlockhart](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/rokejulianlockhart/32/33823_2.png) [@rokejulianlockhart](https://discuss.python.org/u/rokejulianlockhart)\
**Post date:** [September 4, 2026, 2:05pm UTC](https://discuss.python.org/t/why-is-my-python-cli-input-mangled/108891/1 "2026-09-04T14:05:50Z")

</div>

When I invoke `/usr/bin/python3` (from `python3-3.14.7-1.fc44`), whether in `konsole-26.08.0-1.fc44` or [`warp-terminal-preview-v0.2026.09.02.08.27.preview_01-1`](https://releases.warp.dev/preview/v0.2026.09.02.08.27.preview_01/warp-terminal-preview-v0.2026.09.02.08.27.preview_01-1.x86_64.rpm) (irrespective of whether first invoked in another shell, like [`powershell-7.6.3-1.fc44`](https://repos.fyralabs.com/terra44/powershell-0:7.6.3-1.fc44.x86_64.rpm), or `bash-5.3.9-3.fc44`), if the terminal emulator’s window is short, the first few lines, of code that I paste into it, are redacted from the pasted output:

> ```python
> Python 3.14.7 (main, Aug 10 2026, 00:00:00) [GCC 16.1.1 20260515 (Red Hat 16.1.1-2)] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> 
> 
> ... properties = {}
> ... for name in tags:
> ... value = header[
> ... getattr(
> ... rpm,
> ... f"RPMTAG_{name}"
> ... )
> ... ]
> ... if name in (
> ... "INSTALLTIME",
> ... "BUILDTIME"
> ... ):
> ... value = (
> ... datetime.fromtimestamp(
> ... value,
> ... timezone.utc
> ... )
> ... .isoformat(timespec="seconds")
> ... .replace(
> ... "+00:00",
> ... "Z"
> ... )
> ... )
> ... properties[name] = value
> ... print(
> ... yaml.safe_dump(
> ... properties,
> ... sort_keys=False,
> ... default_flow_style=False,
> ... )
> ... )
> ... 
> NAME: signal-desktop
> VERSION: 8.26.0
> RELEASE: 1.fc44
> ARCH: x86_64
> INSTALLTIME: '2026-09-03T23:39:58Z'
> SIZE: 430169042
> SIGPGP: !!binary |
> wqsEABYIAF0FgmqZ3YsJEADNq0PeIm1vNRQAAAAAABwAEHNhbHRAbm90YXRpb25zLm9wZW5wZ3Bq
> cy5vcmepfwkn0zWmu3r3TN1XpYFiFiEErgkVek3oi0l+odXTAM2rQ94ibW8AAO9jAP9ku8M7/ktQ
> hCoEgSNyC9jp8nXYlboW1tSQuMAdQ35zhwD8DeKbCnQpvy8qyke21uVWhHhta0ibbIJ20oyYd7Kq
> Tgc=
> SOURCERPM: signal-desktop-8.26.0-1.fc44.src.rpm
> BUILDTIME: '2026-09-03T20:44:19Z'
> BUILDHOST: 262b08a52583
> PACKAGER: junefish <june@fyralabs.com>
> VENDOR: Terra
> 
> >>>
> 
> ```

> ****
>
> ![Screenshot_20260904_150729](https://us1.discourse-cdn.com/flex002/uploads/python1/original/3X/6/0/60a381fc29bc45469d19af9f1c8f8142b6634c02.png)

Otherwise, the indentation is corrupted:

> ```python
> Python 3.14.7 (main, Aug 10 2026, 00:00:00) [GCC 16.1.1 20260515 (Red Hat 16.1.1-2)] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> #!/usr/bin/env python3
> ... import rpm, yaml
> ... from datetime import datetime, timezone
> ... from shutil import which
> ... package = which("signal-desktop")
> ... header = next(
> ... rpm.TransactionSet().dbMatch(
> ... "basenames",
> ... package
> ... )
> ... )
> ... tags = (
> ... "NAME",
> ... "VERSION",
> ... "RELEASE",
> ... "ARCH",
> ... "INSTALLTIME",
> ... "SIZE",
> ... "SIGPGP",
> ... "SOURCERPM",
> ... "BUILDTIME",
> ... "BUILDHOST",
> ... "PACKAGER",
> ... "VENDOR",
> ... )
> ... properties = {}
> ... for name in tags:
> ... value = header[
> ... getattr(
> ... rpm,
> ... f"RPMTAG_{name}"
> ... )
> ... ]
> ... if name in (
> ... "INSTALLTIME",
> ... "BUILDTIME"
> ... ):
> ... value = (
> ... datetime.fromtimestamp(
> ... value,
> ... timezone.utc
> ... )
> ... .isoformat(timespec="seconds")
> ... .replace(
> ... "+00:00",
> ... "Z"
> ... )
> ... )
> ... properties[name] = value
> ... print(
> ... yaml.safe_dump(
> ... properties,
> ... sort_keys=False,
> ... default_flow_style=False,
> ... )
> ... )
> ... 
> NAME: signal-desktop
> VERSION: 8.26.0
> RELEASE: 1.fc44
> ARCH: x86_64
> INSTALLTIME: '2026-09-03T23:39:58Z'
> SIZE: 430169042
> SIGPGP: !!binary |
> wqsEABYIAF0FgmqZ3YsJEADNq0PeIm1vNRQAAAAAABwAEHNhbHRAbm90YXRpb25zLm9wZW5wZ3Bq
> cy5vcmepfwkn0zWmu3r3TN1XpYFiFiEErgkVek3oi0l+odXTAM2rQ94ibW8AAO9jAP9ku8M7/ktQ
> hCoEgSNyC9jp8nXYlboW1tSQuMAdQ35zhwD8DeKbCnQpvy8qyke21uVWhHhta0ibbIJ20oyYd7Kq
> Tgc=
> SOURCERPM: signal-desktop-8.26.0-1.fc44.src.rpm
> BUILDTIME: '2026-09-03T20:44:19Z'
> BUILDHOST: 262b08a52583
> PACKAGER: junefish <june@fyralabs.com>
> VENDOR: Terra
> 
> >>>
> 
> ```

> ****
>
> ![Screenshot_20260904_150741](https://us1.discourse-cdn.com/flex002/uploads/python1/original/3X/9/9/9924473931ebe617e393bbcd2473b88a270dd5c1.png)

Even worse, albeit potentially tangential, attempting to go back a command mangles the output further:

 ![Screenshot_20260904_151235](https://us1.discourse-cdn.com/flex002/uploads/python1/original/3X/d/4/d416bf5d8185390f75c32a8d88cc92f323456039.png)

However, it executes correctly, regardless. The original code is:

```python
#!/usr/bin/env python3
import rpm, yaml
from datetime import datetime, timezone
from shutil import which
package = which("signal-desktop")
header = next(
	rpm.TransactionSet().dbMatch(
		"basenames",
		package
	)
)
tags = (
	"NAME",
	"VERSION",
	"RELEASE",
	"ARCH",
	"INSTALLTIME",
	"SIZE",
	"SIGPGP",
	"SOURCERPM",
	"BUILDTIME",
	"BUILDHOST",
	"PACKAGER",
	"VENDOR",
)
properties = {}
for name in tags:
	value = header[
		getattr(
			rpm,
			f"RPMTAG_{name}"
		)
	]
	if name in (
		"INSTALLTIME",
		"BUILDTIME"
	):
		value = (
			datetime.fromtimestamp(
				value,
				timezone.utc
			)
			.isoformat(timespec="seconds")
			.replace(
				"+00:00",
				"Z"
			)
		)
	properties[name] = value
print(
	yaml.safe_dump(
		properties,
		sort_keys=False,
		default_flow_style=False,
	)
)

```

#### My Environment

> ```YAML
> NAME: python3 
> VERSION: 3.14.7 
> RELEASE: 1.fc44 
> ARCH: x86_64 
> INSTALLTIME: '2026-08-19T23:41:21Z' 
> SIZE: 29390 
> SIGPGP: null 
> SOURCERPM: python3.14-3.14.7-1.fc44.src.rpm 
> BUILDTIME: '2026-08-12T08:46:11Z' 
> BUILDHOST: buildvm-x86-19.rdu3.fedoraproject.org 
> PACKAGER: Fedora Project 
> VENDOR: Fedora Project
> 
> ```

---

<div class="post-metadata">

**Author:** ![barry-scott](https://avatars.discourse-cdn.com/v4/letter/b/e9c0ed/32.png) [@barry-scott](https://discuss.python.org/u/barry-scott)\
**Post date:** [September 4, 2026, 2:16pm UTC](https://discuss.python.org/t/why-is-my-python-cli-input-mangled/108891/2 "2026-09-04T14:16:14Z")

</div>

I’d think this is not a python issue.  
Do other commands also fail to wrap?

I notice you have a horizontal scroll bar, that is not the default.  
I see the long lines wrapping.

My guess is that you may have changed a setting with stty or maybe terminal emulator settings?

What does your `stty` report? It should only list non-default options.

---

<div class="post-metadata">

**Author:** ![rokejulianlockhart](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/rokejulianlockhart/32/33823_2.png) [@rokejulianlockhart](https://discuss.python.org/u/rokejulianlockhart)\
**Post date:** [September 4, 2026, 2:50pm UTC](https://discuss.python.org/t/why-is-my-python-cli-input-mangled/108891/3 "2026-09-04T14:50:37Z")

</div>

> [@barry-scott](#):
>
> I notice you have a horizontal scroll bar, that is not the default.

@barry-scott, I do not. Konsole does not offer one:

> **[Is is possible to enable horizontal scrolling in Konsole?](https://discuss.kde.org/t/is-is-possible-to-enable-horizontal-scrolling-in-konsole/6995/8?u=rokejulianlockhart)**
>
> @saverio, this isn’t possible (in at least \< konsole-25.04.0). \[1\] I agree, although there are as many who dislike it. \[2\] bugs.kde.org/show\_bug.cgi?id=62380 ↩︎ github.com/microsoft/terminal/issues/6895#issuecomment-658997728 ↩︎

* * *

> [@barry-scott](#):
>
> Do other commands also fail to wrap?

Has anything failed to wrap? Even you state that you observe the lines wrap. The problem depicted is that the indentation is syntactically erroneous, and that lines outside of the immediately visible section of the viewport are redacted upon paste.

* * *

> [@barry-scott](#):
>
> What does your `stty` report?

```python
Python 3.14.7 (main, Aug 10 2026, 00:00:00) [GCC 16.1.1 20260515 (Red Hat 16.1.1-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import builtins; import subprocess; builtins.print(subprocess.check_output("stty", text=True))
speed 38400 baud; line = 0;
-brkint -imaxbel iutf8

>>>

```

The output is identical in all aforementioned shells and terminal emulators.

---

<div class="post-metadata">

**Author:** ![barry-scott](https://avatars.discourse-cdn.com/v4/letter/b/e9c0ed/32.png) [@barry-scott](https://discuss.python.org/u/barry-scott)\
**Post date:** [September 4, 2026, 4:01pm UTC](https://discuss.python.org/t/why-is-my-python-cli-input-mangled/108891/4 "2026-09-04T16:01:03Z")

</div>

> [@rokejulianlockhart](#):
>
> > [@barry-scott](#):
> >
> > I notice you have a horizontal scroll bar, that is not the default.
> 
> @barry-scott, I do not. Konsole does not offer one:

Oh its the web browser adding the scroll bar! Sorry.

---

<div class="post-metadata">

**Author:** ![rokejulianlockhart](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/rokejulianlockhart/32/33823_2.png) [@rokejulianlockhart](https://discuss.python.org/u/rokejulianlockhart)\
**Post date:** [October 15, 2026, 4:38pm UTC](https://discuss.python.org/t/why-is-my-python-cli-input-mangled/108891/5 "2026-10-15T16:38:09Z")

</div>

The solution is to utilise spaces, rather than tabulators:

> <https://github.com/python/cpython/issues/159478#issue-5870041947>
>
> \### Bug report
> 
> \#### What My Environment Is
> 
> ~~~YAML
> NAME: python3
> VERSION: 3.14….8
> RELEASE: 1.fc44
> ARCH: x86\_64
> INSTALLTIME: '2026-10-09T11:34:23Z'
> SIZE: 29352
> SIGPGP: null
> SOURCERPM: python3.14-3.14.8-1.fc44.src.rpm
> BUILDTIME: '2026-10-01T23:42:52Z'
> BUILDHOST: buildhw-x86-17.rdu3.fedoraproject.org
> PACKAGER: Fedora Project
> VENDOR: Fedora Project
> ~~~
> 
> \#### What The Problem Is
> 
> As I first noticed at \[\`discuss.python.org/t/108891\`\](https://discuss.python.org/t/why-is-my-python-cli-input-mangled/108891), when I invoke \`python3\`, whether in \`konsole\` or \`warp-terminal\` (irrespective of whether first invoked in another shell, like \`powershell\`, or \`bash\`), if the terminal emulator's window is short, the first few lines, of code that I paste into it, are redacted from the pasted output:
> 
> \<blockquote\>
> 
> ~~~python
> Python 3.14.7 (main, Aug 10 2026, 00:00:00) \[GCC 16.1.1 20260515 (Red Hat 16.1.1-2)\] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> \>\>\> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ... properties = {}
> ... for name in tags:
> ... value = header\[
> ... getattr(
> ... rpm,
> ... f"RPMTAG\_{name}"
> ... )
> ... \]
> ... if name in (
> ... "INSTALLTIME",
> ... "BUILDTIME"
> ... ):
> ... value = (
> ... datetime.fromtimestamp(
> ... value,
> ... timezone.utc
> ... )
> ... .isoformat(timespec="seconds")
> ... .replace(
> ... "+00:00",
> ... "Z"
> ... )
> ... )
> ... properties\[name\] = value
> ... print(
> ... yaml.safe\_dump(
> ... properties,
> ... sort\_keys=False,
> ... default\_flow\_style=False,
> ... )
> ... )
> ... 
> NAME: signal-desktop
> VERSION: 8.26.0
> RELEASE: 1.fc44
> ARCH: x86\_64
> INSTALLTIME: '2026-09-03T23:39:58Z'
> SIZE: 430169042
> SIGPGP: !!binary |
> wqsEABYIAF0FgmqZ3YsJEADNq0PeIm1vNRQAAAAAABwAEHNhbHRAbm90YXRpb25zLm9wZW5wZ3Bq
> cy5vcmepfwkn0zWmu3r3TN1XpYFiFiEErgkVek3oi0l+odXTAM2rQ94ibW8AAO9jAP9ku8M7/ktQ
> hCoEgSNyC9jp8nXYlboW1tSQuMAdQ35zhwD8DeKbCnQpvy8qyke21uVWhHhta0ibbIJ20oyYd7Kq
> Tgc=
> SOURCERPM: signal-desktop-8.26.0-1.fc44.src.rpm
> BUILDTIME: '2026-09-03T20:44:19Z'
> BUILDHOST: 262b08a52583
> PACKAGER: junefish \<june@fyralabs.com\>
> VENDOR: Terra
> 
> \>\>\>
> ~~~
> 
> \</blockquote\>
> 
> \<details\>
> 
> \<img width="1276" height="1388" alt="Image" src="https://github.com/user-attachments/assets/876159f1-c544-4c3e-9eaf-dc80dbb714c1" /\>
> 
> \</details\>
> 
> Otherwise, the indentation is corrupted:
> 
> \<blockquote\>
> 
> ~~~python
> Python 3.14.7 (main, Aug 10 2026, 00:00:00) \[GCC 16.1.1 20260515 (Red Hat 16.1.1-2)\] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> \>\>\> #!/usr/bin/env python3
> ... import rpm, yaml
> ... from datetime import datetime, timezone
> ... from shutil import which
> ... package = which("signal-desktop")
> ... header = next(
> ... rpm.TransactionSet().dbMatch(
> ... "basenames",
> ... package
> ... )
> ... )
> ... tags = (
> ... "NAME",
> ... "VERSION",
> ... "RELEASE",
> ... "ARCH",
> ... "INSTALLTIME",
> ... "SIZE",
> ... "SIGPGP",
> ... "SOURCERPM",
> ... "BUILDTIME",
> ... "BUILDHOST",
> ... "PACKAGER",
> ... "VENDOR",
> ... )
> ... properties = {}
> ... for name in tags:
> ... value = header\[
> ... getattr(
> ... rpm,
> ... f"RPMTAG\_{name}"
> ... )
> ... \]
> ... if name in (
> ... "INSTALLTIME",
> ... "BUILDTIME"
> ... ):
> ... value = (
> ... datetime.fromtimestamp(
> ... value,
> ... timezone.utc
> ... )
> ... .isoformat(timespec="seconds")
> ... .replace(
> ... "+00:00",
> ... "Z"
> ... )
> ... )
> ... properties\[name\] = value
> ... print(
> ... yaml.safe\_dump(
> ... properties,
> ... sort\_keys=False,
> ... default\_flow\_style=False,
> ... )
> ... )
> ... 
> NAME: signal-desktop
> VERSION: 8.26.0
> RELEASE: 1.fc44
> ARCH: x86\_64
> INSTALLTIME: '2026-09-03T23:39:58Z'
> SIZE: 430169042
> SIGPGP: !!binary |
> wqsEABYIAF0FgmqZ3YsJEADNq0PeIm1vNRQAAAAAABwAEHNhbHRAbm90YXRpb25zLm9wZW5wZ3Bq
> cy5vcmepfwkn0zWmu3r3TN1XpYFiFiEErgkVek3oi0l+odXTAM2rQ94ibW8AAO9jAP9ku8M7/ktQ
> hCoEgSNyC9jp8nXYlboW1tSQuMAdQ35zhwD8DeKbCnQpvy8qyke21uVWhHhta0ibbIJ20oyYd7Kq
> Tgc=
> SOURCERPM: signal-desktop-8.26.0-1.fc44.src.rpm
> BUILDTIME: '2026-09-03T20:44:19Z'
> BUILDHOST: 262b08a52583
> PACKAGER: junefish \<june@fyralabs.com\>
> VENDOR: Terra
> 
> \>\>\>
> ~~~
> 
> \</blockquote\>
> 
> \<details\>
> 
> \<img width="1276" height="1388" alt="Image" src="https://github.com/user-attachments/assets/1f5dc9df-799a-415d-8e5f-fdf7be351533" /\>
> 
> \</details\>
> 
> Even worse, albeit potentially tangential, attempting to go back a command mangles the output further:
> 
> \<img width="1276" height="1388" alt="Image" src="https://github.com/user-attachments/assets/e1590ec4-188b-4a8f-90ae-9e5b07c27cb5" /\>
> 
> However, it executes correctly, regardless.
> 
> The original, problematic code is:
> 
> ~~~python
> \#!/usr/bin/env python3
> import rpm, yaml
> from datetime import datetime, timezone
> from shutil import which
> package = which("signal-desktop")
> header = next(
> rpm.TransactionSet().dbMatch(
> "basenames",
> package
> )
> )
> tags = (
> "NAME",
> "VERSION",
> "RELEASE",
> "ARCH",
> "INSTALLTIME",
> "SIZE",
> "SIGPGP",
> "SOURCERPM",
> "BUILDTIME",
> "BUILDHOST",
> "PACKAGER",
> "VENDOR",
> )
> properties = {}
> for name in tags:
> value = header\[
> getattr(
> rpm,
> f"RPMTAG\_{name}"
> )
> \]
> if name in (
> "INSTALLTIME",
> "BUILDTIME"
> ):
> value = (
> datetime.fromtimestamp(
> value,
> timezone.utc
> )
> .isoformat(timespec="seconds")
> .replace(
> "+00:00",
> "Z"
> )
> )
> properties\[name\] = value
> print(
> yaml.safe\_dump(
> properties,
> sort\_keys=False,
> default\_flow\_style=False,
> )
> )
> ~~~
> 
> However, if one converts its indentative tabs into spaces:
> 
> \<details\>
> 
> ~~~python3
> \#!/usr/bin/env python3
> import rpm, yaml
> from datetime import datetime, timezone
> from shutil import which
> package = which("signal-desktop")
> header = next(
> rpm.TransactionSet().dbMatch(
> "basenames",
> package
> )
> )
> tags = (
> "NAME",
> "VERSION",
> "RELEASE",
> "ARCH",
> "INSTALLTIME",
> "SIZE",
> "SIGPGP",
> "SOURCERPM",
> "BUILDTIME",
> "BUILDHOST",
> "PACKAGER",
> "VENDOR",
> )
> properties = {}
> for name in tags:
> value = header\[
> getattr(
> rpm,
> f"RPMTAG\_{name}"
> )
> \]
> if name in (
> "INSTALLTIME",
> "BUILDTIME"
> ):
> value = (
> datetime.fromtimestamp(
> value,
> timezone.utc
> )
> .isoformat(timespec="seconds")
> .replace(
> "+00:00",
> "Z"
> )
> )
> properties\[name\] = value
> print(
> yaml.safe\_dump(
> properties,
> sort\_keys=False,
> default\_flow\_style=False,
> )
> )
> ~~~
> 
> \</details\>
> 
> …the code renders as expected:
> 
> \<img width="1276" height="1388" alt="Image" src="https://github.com/user-attachments/assets/194ad8ad-6d62-4aa6-8f16-e34971e41b0b" /\>
> 
> \#### Triage
> 
> \[\`/issues?q=sort%3Aupdated-desc+is%3Aissue+state%3Aopen+interpreter+tab\`\](https://github.com/python/cpython/issues?q=sort%3Aupdated-desc+is%3Aissue+state%3Aopen+interpreter+tab) returned no relevant, pre-existent issues:
> 
> \<img width="2204" height="1661" alt="Image" src="https://github.com/user-attachments/assets/d477b9a4-93fb-4108-9b69-6b79eb0a8083" /\>
> 
> \### CPython versions tested on:
> 
> \<del\>\`3.14\`\</del\> \`3.15\`
> 
> \### Operating systems tested on:
> 
> Linux
