Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 06:38
    daniel-shimon commented #4279
  • 06:11
    halloleo commented #2933
  • 05:50
    anki-code commented #2933
  • 05:46
    anki-code edited #4277
  • 05:45
    anki-code labeled #4281
  • 05:45
    anki-code labeled #4281
  • 05:45
    anki-code opened #4281
  • 05:37
    jnoortheen synchronize #4280
  • 05:36
    anki-code commented #2933
  • 05:27
    halloleo commented #2933
  • 05:00
    Pzoom522 starred xonsh/xonsh
  • 03:37
    skymyyang starred xonsh/xonsh
  • 03:07
    Jason1108 starred xonsh/xonsh
  • 02:40
    niujiangpu starred xonsh/xonsh
  • 02:33
    xwindow21 starred xonsh/xonsh
  • 02:06
    liuxingpluck starred xonsh/xonsh
  • 01:42
    gzeronet starred xonsh/xonsh
  • 01:30
    luanshixia starred xonsh/xonsh
  • 00:12
    IcingHackz starred xonsh/xonsh
  • May 12 21:46
    anki-code commented #3414
|RePa|
@dyuri:horak.hu
[m]
well, I blame prompt_toolkit for anything similar
Andy Kipp
@anki-code
))
|RePa|
@dyuri:horak.hu
[m]
they broke right prompt months ago
and the PR that fixes it might never gonna make it
Andy Kipp
@anki-code
Is there a link to the issue/pr?
|RePa|
@dyuri:horak.hu
[m]
prompt-toolkit/python-prompt-toolkit#1241 (you already mentioned this in a starship related discussion)
prompt-toolkit/python-prompt-toolkit#1271 this PR fixes this issue (and other completion menu related ones)
for me at least
Andy Kipp
@anki-code
The kind reminder has been added :)
halloleo
@halloleo

Strange probelm: When I interrupt an on the xonsh commandline long running for-loop (something like:

for f in open('filelist.txt'):
     grep -H "MySearchTerm" @(f.strip())

) with a SIGINT signal, then I get sometimes in the xonsh shell the error:

>$ RecursionError: maximum recursion depth exceeded in comparison

Any idea why?

2 replies
alat-rights
@alat-rights

Hey everyone, hope you’re well.

having a weird issue with Xonsh. Tried to write a little program to move files, and its failing with “name file is not defined”

image.png
dyuri
@dyuri:horak.hu
[m]
files.txt in for filename in files.txt: is interpreted as a python variable and it isn't defined ineed
alat-rights
@alat-rights
oh gosh! That’s silly of me. Thanks for letting me know.
dyuri
@dyuri:horak.hu
[m]
you can do something like
for filename in $(cat files.txt).split("\n"):
(strange issue, I can't see the attached image in my matrix client)
Andy Kipp
@anki-code
The best way is to use splitlines instead of split and stripping:
for filename in $(cat files.txt).splitlines():
    mv @(filename) misc/
    # OR explicitly:
    $[mv @(filename) misc/]
@alat-rights I recommend to read the xonsh cheatsheet - it's good start.
alat-rights
@alat-rights
Awesome, thank you!
alat-rights
@alat-rights
Ok one more question, do you guys know how I can get tmux to auto-start xonsh at startup?
1 reply
Cadair
@cadair:cadair.com
[m]
Use default-shell not default-command as I found out the hard way.
eggcaker
@eggcaker
Any one use xonsh on Windows w/o wsl , seems it cant run very well always like Linux os
1 reply
Dominic Ward
@deeuu
@alat-rights I have this in my tmux config:
set-option -g default-shell "${HOME}/.local/share/virtualenvs/xonsh/bin/xonsh"
alat-rights
@alat-rights
Thank you!
scratchyone
@scratchyone
Hi! How do I get standard shell utilities like "ls" and "cp" working in xonsh on windows?
4 replies
my first thought would be PowerShell -Command ls but that has a delay of about a second before it actually runs the command which would suck for regular use
and cmd /c dir gives you less information and a worse UI than the powershell version
halloleo
@halloleo

Is there a way to use the command mode globbing operator

g`...`

with Python expressions? Given my_path = 'data/*.csv' I tried

ls -l g`@(my_path)`

but this way it doesn't work.

5 replies
Ramon
@Raqbit
Hi there! I'm trying out xonsh and I find that the reverse-i-search mode is not working as I expect: If I search for something and then press enter, on bash/zsh it will execute the selected command. Xonsh deletes the line yet does not execute the command and stays in the reverse-i-search mode. Another thing is that if I press the right/left arrow keys or end/home while in reverse-i-search mode, I expect to drop into the shell where I can edit the command, while xonsh moves the cursor in the reverse-i-search query. Would this be categorized as a bug or is this a change xonsh deliberately made?
5 replies
Rit
@RitikShah
Is there a git autocompletion engine for xonsh
syntaxman
@syntaxman
It appears the bot that bridges IRC and Gitter isn't running.
dyuri
@dyuri:horak.hu
[m]
I can see the same messages in the gitter website than in matrix
Maxim Yurchenkov
@ggdwbg

setting both

$ENABLE_ASYNC_PROMPT = True
$UPDATE_PROMPT_ON_KEYPRESS = True

makes xonsh (or, rather, prompt-toolkit, i guess) crash with

Traceback (most recent call last):
  File "/home/ggdwbg/.local/lib/python3.9/site-packages/xonsh/main.py", line 421, in main
    sys.exit(main_xonsh(args))
  File "/home/ggdwbg/.local/lib/python3.9/site-packages/xonsh/main.py", line 459, in main_xonsh
    shell.shell.cmdloop()
  File "/home/ggdwbg/.local/lib/python3.9/site-packages/xonsh/ptk_shell/shell.py", line 338, in cmdloop
    line = self.singleline(auto_suggest=auto_suggest)
  File "/home/ggdwbg/.local/lib/python3.9/site-packages/xonsh/ptk_shell/shell.py", line 307, in singleline
    line = self.prompter.prompt(**prompt_args)
  File "/home/ggdwbg/.local/lib/python3.9/site-packages/prompt_toolkit/shortcuts/prompt.py", line 1013, in prompt
    return self.app.run(set_exception_handler=set_exception_handler)
  File "/home/ggdwbg/.local/lib/python3.9/site-packages/prompt_toolkit/application/application.py", line 825, in run
    return loop.run_until_complete(
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/home/ggdwbg/.local/lib/python3.9/site-packages/prompt_toolkit/application/application.py", line 792, in run_async
    return await _run_async2()
  File "/home/ggdwbg/.local/lib/python3.9/site-packages/prompt_toolkit/application/application.py", line 774, in _run_async2
    result = await _run_async()
  File "/home/ggdwbg/.local/lib/python3.9/site-packages/prompt_toolkit/application/application.py", line 652, in _run_async
    self._pre_run(pre_run)
  File "/home/ggdwbg/.local/lib/python3.9/site-packages/prompt_toolkit/application/application.py", line 610, in _pre_run
    c()
  File "/home/ggdwbg/.local/lib/python3.9/site-packages/prompt_toolkit/shortcuts/prompt.py", line 1202, in pre_run2
    pre_run()
  File "/home/ggdwbg/.local/lib/python3.9/site-packages/xonsh/ptk_shell/formatter.py", line 69, in start_update
    self.updator.start()
AttributeError: 'PTKPromptFormatter' object has no attribute 'updator'

Disabling either of them stops crashing. Even more: setting async, then running xonsh, then setting update on keypress makes it work fine too. Is this a well-known issue?

1 reply
Chris Braun
@cryzed
Anyone know how I can get xonsh to reload the prompt colors after changing $XONSH_COLOR_STYLE? Apparently not even reset is enough to get the new colors in the prompt, I have to start a completely new xonsh process. My plan is to make 2 aliases next-style and previous-style which cycle through all styles and take care of reapplying the colors. That works mostly, except for the prompt colors.
dyuri
@dyuri:horak.hu
[m]
well, it works here
ah prompt colors, sorry
@cryzed: could you open a github issue? I might look at it later
dyuri
@dyuri:horak.hu
[m]
found a bug during investigation that if $XONSH_COLOR_STYLE is set to something invalid then xonsh can't start (got the fix already)
dyuri
@dyuri:horak.hu
[m]
well, for me the colors of the prompt are also changing
Andy Kipp
@anki-code
:up: Hi folks! I've created a PR to adding xonsh to the list of tools on python.org. Please support the request!
  1. Open python/pythondotorg#1769
  2. Click to the thumbs up on the first message
jan Swedneck
@swedneck:feneas.org
[m]
hey is it just me or does if/else shorthand not work in xonsh?
oh nvm apparently the websites just don't make it clear how that shorthand works
Thomas A Caswell
@tacaswell
I have a possibly silly question
I'm trying to do something like
    cmd = ['xclip', '-selection', 'clipboard', '-t', content_type]
    p = Popen(cmd, stdin=PIPE)
    p.communicate(content)
(after https://github.com/brandon-rhodes/homedir/blob/1878c32bb0546f8485b768cd8d8399f4c422e53e/.fvwm/z_transform.py) in xonsh and can not figure out how to pipe the contents of a variable into the stdin of a subprocess
2 replies
jan Swedneck
@swedneck:feneas.org
[m]
can i change what version of python xonsh uses?
2 replies
syntaxman
@syntaxman

I've been combing through the docs for xonsh and prompt-toolkit, as well as the source code, and haven't been able to figure this out: I would like to map the key sequence: ";;" to "escape" in ViInsertMode. I found where escape is defined in the prompt-toolkit code, but it doesn't seem to have a related function name like "event.current_buffer.open_in_editor". So I tried copying the code into my custom_keybindings() which causes a syntax error in unrelated lines. I expected more helpful errors.

@bindings.add(';', ';', filter=ViInsertMode())
def _back_to_navigation_mode(event):
      buffer = event.current_buffer
      vi_state = event.app.vi_state
     if vi_state.input_mode in (InputMode.INSERT, InputMode.REPLACE):
         buffer.cursor_position += buffer.document.get_cursor_left_position()
     vi_state.input_mode = InputMode.NAVIGATION
     if bool(buffer.selection_state):
         buffer.exit_selection()

The code I tried to adapt came from python-prompt-toolkit/prompt_toolkit/key_bindings/bindings/vi.py:421 I tried to see if I could make KEY_ALIASES work for this, but I obviously didn't understand it. Am I missing something obvious here?

syntaxman
@syntaxman
BTW, None of the posts here are showing up in the OFTC #xonsh channel. I think the bot is down.