You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ValueError: Bad Args PS1 object – when using VSCode Python extension v2024.0.0 or newer #1041
A similar problem occurs when running bpython in VSCode.
bpython version 0.25 on top of Python 3.13.7 /home/q/.local/share/pipx/venvs/bpython/bin/python
Traceback (most recent call last):
File "/home/q/.local/bin/bpython", line 8, in <module>
sys.exit(main())
~~~~^^
File "/home/q/.local/share/pipx/venvs/bpython/lib/python3.13/site-packages/bpython/curtsies.py", line 245, in main
repl.mainloop(True, paste)
~~~~~~~~~~~~~^^^^^^^^^^^^^
File "/home/q/.local/share/pipx/venvs/bpython/lib/python3.13/site-packages/bpython/curtsies.py", line 170, in mainloop
self.process_event_and_paint(None)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/home/q/.local/share/pipx/venvs/bpython/lib/python3.13/site-packages/bpython/curtsies.py", line 148, in process_event_and_paint
array, cursor_pos = self.paint()
~~~~~~~~~~^^
File "/home/q/.local/share/pipx/venvs/bpython/lib/python3.13/site-packages/bpython/curtsiesfrontend/repl.py", line 1611, in paint
min_height, width, self.current_cursor_line
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/q/.local/share/pipx/venvs/bpython/lib/python3.13/site-packages/bpython/curtsiesfrontend/repl.py", line 1517, in current_cursor_line
return self.current_cursor_line_without_suggestion + suggest(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/q/.local/share/pipx/venvs/bpython/lib/python3.13/site-packages/bpython/curtsiesfrontend/repl.py", line 1506, in current_cursor_line_without_suggestion
"" if self.coderunner.running else self.display_line_with_prompt
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/q/.local/share/pipx/venvs/bpython/lib/python3.13/site-packages/bpython/curtsiesfrontend/repl.py", line 1495, in display_line_with_prompt
prompt(self.ps1) if self.done else more(self.ps2)
~~~~~~^^^^^^^^^^
File "/home/q/.local/share/pipx/venvs/bpython/lib/python3.13/site-packages/curtsies/formatstring.py", line 868, in fmtstr
raise ValueError(
f"Bad Args: {string!r} (of type {type(string)}), {args!r}, {kwargs!r}"
)
ValueError: Bad Args: <__main__.PS1 object at 0x7f6297e402f0> (of type <class '__main__.PS1'>), (), {'fg': 36, 'bold': False}
In the kitty terminal, the startup is successful:
~ ᐅ bpython
bpython version 0.25 on top of Python 3.13.7 /home/q/.local/share/pipx/venvs/bpython/bin/python
>>>
I think it's something relating to VSCode. I've gotten the error in VSCode's integrated terminal on two different computers (one Linux, one Mac) but not in any other terminal emulator. And in VSCode I get the same error regardless of the shell environment. Even happened in a bash --noprofile --norc session:
bash-5.3$ uv run --with bpython bpython
bpython version 0.25 on top of Python 3.13.7 /home/emberquill/.cache/uv/builds-v0/.tmpwSeVZH/bin/python
Traceback (most recent call last):
File "/home/emberquill/.cache/uv/builds-v0/.tmpwSeVZH/bin/bpython", line 10, in <module>
sys.exit(main())
~~~~^^
File "/home/emberquill/.cache/uv/archive-v0/0r178DEbVx0TTGhkxMmvD/lib/python3.13/site-packages/bpython/curtsies.py", line 245, in main
repl.mainloop(True, paste)
~~~~~~~~~~~~~^^^^^^^^^^^^^
File "/home/emberquill/.cache/uv/archive-v0/0r178DEbVx0TTGhkxMmvD/lib/python3.13/site-packages/bpython/curtsies.py", line 170, in mainloop
self.process_event_and_paint(None)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/home/emberquill/.cache/uv/archive-v0/0r178DEbVx0TTGhkxMmvD/lib/python3.13/site-packages/bpython/curtsies.py", line 148, in process_event_and_paint
array, cursor_pos = self.paint()
~~~~~~~~~~^^
File "/home/emberquill/.cache/uv/archive-v0/0r178DEbVx0TTGhkxMmvD/lib/python3.13/site-packages/bpython/curtsiesfrontend/repl.py", line 1611, in paint
min_height, width, self.current_cursor_line
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/emberquill/.cache/uv/archive-v0/0r178DEbVx0TTGhkxMmvD/lib/python3.13/site-packages/bpython/curtsiesfrontend/repl.py", line 1517, in current_cursor_line
return self.current_cursor_line_without_suggestion + suggest(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/emberquill/.cache/uv/archive-v0/0r178DEbVx0TTGhkxMmvD/lib/python3.13/site-packages/bpython/curtsiesfrontend/repl.py", line 1506, in current_cursor_line_without_suggestion
"" if self.coderunner.running else self.display_line_with_prompt
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/emberquill/.cache/uv/archive-v0/0r178DEbVx0TTGhkxMmvD/lib/python3.13/site-packages/bpython/curtsiesfrontend/repl.py", line 1495, in display_line_with_prompt
prompt(self.ps1) if self.done else more(self.ps2)
~~~~~~^^^^^^^^^^
File "/home/emberquill/.cache/uv/archive-v0/0r178DEbVx0TTGhkxMmvD/lib/python3.13/site-packages/curtsies/formatstring.py", line 868, in fmtstr
raise ValueError(
f"Bad Args: {string!r} (of type {type(string)}), {args!r}, {kwargs!r}"
)
ValueError: Bad Args: <__main__.PS1 object at 0x7ff768e1c1a0> (of type <class '__main__.PS1'>), (), {'fg': 36, 'bold': False}
@emberquill You are complete right! I am no longer using terminal in standalone mode, only through VSCode, and did not realize that VSCode is doing something weird with it... So the issue was not in upgrading Python but rather the version of the VSCode Python extension.
changed the title [-]ValueError: Bad Args PS1 object – on python 3.12[/-][+]ValueError: Bad Args PS1 object – when using VSCode Python extension v2024.0.0 or newer[/+]on Sep 24, 2025
Activity
chet-manley commentedon Sep 18, 2025
Just ran into this same issue using Python
3.13.7and bpython0.25.sebastinas commentedon Sep 20, 2025
I am unable to reproduce the issue. Do you set PS1 to some specific value?
paranoik1 commentedon Sep 23, 2025
A similar problem occurs when running bpython in VSCode.
In the kitty terminal, the startup is successful:
emberquill commentedon Sep 23, 2025
I think it's something relating to VSCode. I've gotten the error in VSCode's integrated terminal on two different computers (one Linux, one Mac) but not in any other terminal emulator. And in VSCode I get the same error regardless of the shell environment. Even happened in a
bash --noprofile --norcsession:emberquill commentedon Sep 23, 2025
Actually, it only happens with the Microsoft Python extension in VSCode. It does something weird to
sys.ps1:Regular terminal:
VSCode terminal with Python extension:
Edit: looks like the extension changes the PYTHONSTARTUP environment variable to point at its own
pythonrc.pythat changes sys.ps1 here.interDist commentedon Sep 24, 2025
@emberquill You are complete right! I am no longer using terminal in standalone mode, only through VSCode, and did not realize that VSCode is doing something weird with it... So the issue was not in upgrading Python but rather the version of the VSCode Python extension.
Ref https://github.com/microsoft/vscode-python/releases/tag/v2024.0.0 and microsoft/vscode-python@1ea53e2
[-]ValueError: Bad Args PS1 object – on python 3.12[/-][+]ValueError: Bad Args PS1 object – when using VSCode Python extension v2024.0.0 or newer[/+]Convert sys.ps1 to a string to work-around non-str sys.ps1 from vscode (