mechatroner / rainbow_csv

🌈Rainbow CSV - Vim plugin: Highlight columns in CSV and TSV files and run queries in SQL-like language
MIT License
626 stars 22 forks source link

`g:rbql_use_system_python` does not work well #48

Closed KSR-Yasuda closed 8 months ago

KSR-Yasuda commented 9 months ago

With g:rbql_use_system_python enabled, RBQL query does not work well.

" ${HOME}/.vimrc
Plugin 'mechatroner/rainbow_csv'

let g:rbql_backend_language  = 'python'
let g:rbql_use_system_python = v:true
:Select a1 group by a1

" Vim message
executing...
OK^M

" The target window does not change.

It works with g:rbql_backend_language = 'js'.


In my env, Windows MSYS, Vim native python looks not working well (see https://github.com/msys2/MSYS2-packages/issues/1930, The python lib subprocess raises an error).

So, I'd like to use external python binary, but it just returns the message OK as above.

It looks writing into /tmp/TARGET_FILE_NAME.txt on every query, but it does not switching the window to the output file.


Env

% cmd /v | head -n1
Microsoft Windows [Version 10.0.22631.3155]

% pacman -Q msys2-runtime
msys2-runtime 3.4.10-5

% pacman -Q vim
vim 9.1.0000-1

% vim --version
VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Jan 04 2024 08:28:51)
Compiled by <https://www.msys2.org/>
Huge version without GUI.  Features included (+) or not (-):
+acl               +file_in_path      +mouse_urxvt       -tag_any_white
+arabic            +find_in_path      +mouse_xterm       -tcl
+autocmd           +float             +multi_byte        +termguicolors
+autochdir         +folding           +multi_lang        +terminal
-autoservername    -footer            -mzscheme          +terminfo
-balloon_eval      +fork()            +netbeans_intg     +termresponse
+balloon_eval_term +gettext           +num64             +textobjects
-browse            -hangul_input      +packages          +textprop
++builtin_terms    +iconv             +path_extra        +timers
+byte_offset       +insert_expand     +perl/dyn          +title
+channel           +ipv6              +persistent_undo   -toolbar
+cindent           +job               +popupwin          +user_commands
-clientserver      +jumplist          +postscript        +vartabs
+clipboard         +keymap            +printer           +vertsplit
+cmdline_compl     +lambda            +profile           +vim9script
+cmdline_hist      +langmap           -python            +viminfo
+cmdline_info      +libcall           +python3/dyn       +virtualedit
+comments          +linebreak         +quickfix          +visual
+conceal           +lispindent        +reltime           +visualextra
+cryptv            +listcmds          +rightleft         +vreplace
+cscope            +localmap          +ruby/dyn          +wildignore
+cursorbind        -lua               +scrollbind        +wildmenu
+cursorshape       +menu              +signs             +windows
+dialog_con        +mksession         +smartindent       +writebackup
+diff              +modify_fname      -sodium            -X11
+digraphs          +mouse             -sound             +xattr
-dnd               -mouseshape        +spell             -xfontset
-ebcdic            +mouse_dec         +startuptime       -xim
+emacs_tags        -mouse_gpm         +statusline        -xpm
+eval              -mouse_jsbterm     -sun_workshop      -xsmp
+ex_extra          +mouse_netterm     +syntax            -xterm_clipboard
+extra_search      +mouse_sgr         +tag_binary        -xterm_save
-farsi             -mouse_sysmouse    -tag_old_static    
   system vimrc file: "/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/etc"
 f-b for $VIMRUNTIME: "/usr/share/vim/vim91"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -I/usr/include/ncursesw -march=nocona -msahf -mtune=generic -O2 -pipe -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 
Linking: 
gcc -pipe -Wl,--as-needed -o vim.exe -lm -lncursesw -liconv -lacl -lintl 

% pacman -Q {mingw-w64-x86_64-,}python
mingw-w64-x86_64-python 3.11.8-1
python 3.11.8-1

% type -ap python
/mingw64/bin/python             # for MINGW64 binary
/usr/bin/python                 # for MSYS binary
/bin/python                     # for MSYS binary (the same of the above)
/c/Users/xxxxxxxx/AppData/Local/Microsoft/WindowsApps/python
                                # for Windows binary installer (not installed now)
KSR-Yasuda commented 9 months ago

This was because report parsing considers LF only for linefeed.

In MSYS (Windows) env, linefeed is CRLF, and it had thought the query command was failed.

KSR-Yasuda commented 8 months ago

The PR has been merged.