vim-Grammalecte icon indicating copy to clipboard operation
vim-Grammalecte copied to clipboard

Gvim 8.0.69 on windows 7 : error message How can I help ?

Open ledshark24 opened this issue 8 years ago • 9 comments

Hi, First let me thanks you for the work done here, I tried to enable Grammalecte on my Vim setup in windows 7 Install and setup where painless and easy, however I call to cli tool fails I join a screen shot of the error.

image

a manual call (fom vim) to the cli tool with no options does not fails. :python3 cli.py

using the cli from cmd works fine too.

ledshark24 avatar Jun 08 '17 09:06 ledshark24

I don't know yet why you see this error. Can you provide the versions that you use for Grammalecte and Vim (output of :version)?

I don't have Windows (I use Linux, xubuntu-14.04 and xubuntu-16.04). Perhaps this problem is specific to Windows. I'll try to find a Windows machine to check on Windows.

dpelle avatar Jun 08 '17 09:06 dpelle

Of course : Grammalecte : V.0.5.17 (downloaed today) Vim :

:version
:version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Apr 23 2017 20:01:28)
Version graphique MS-Windows 32 bits supportant l'OLE
Rustines incluses : 1-586
Compilé par mool@tororo
Énorme version avec une interface graphique.  Fonctionnalités incluses (+) ou non (-) :
+acl                +cmdline_compl      +digraphs           +float              +langmap            +mouseshape         -postscript         +smartindent        -termresponse       +vreplace
+arabic             +cmdline_hist       +directx            +folding            +libcall            +multi_byte_ime/dyn +printer            +startuptime        +textobjects        +wildignore
+autocmd            +cmdline_info       -dnd                -footer             +linebreak          +multi_lang         +profile            +statusline         +timers             +wildmenu
+balloon_eval       +comments           -ebcdic             +gettext/dyn        +lispindent         -mzscheme           +python/dyn         -sun_workshop       +title              +windows
+browse             +conceal            +emacs_tags         -hangul_input       +listcmds           +netbeans_intg      +python3/dyn        +syntax             +toolbar            +writebackup
++builtin_terms     +cryptv             +eval               +iconv/dyn          +localmap           +num64              +quickfix           +tag_binary         +user_commands      -xfontset
+byte_offset        +cscope             +ex_extra           +insert_expand      -lua                +ole                +reltime            +tag_old_static     +vertsplit          -xim
+channel            +cursorbind         +extra_search       +job                +menu               +packages           +rightleft          -tag_any_white      +virtualedit        +xpm_w32
+cindent            +cursorshape        +farsi              +jumplist           +mksession          +path_extra         +ruby/dyn           +tcl/dyn            +visual             -xterm_save
+clientserver       +dialog_con_gui     +file_in_path       +keymap             +modify_fname       +perl/dyn           +scrollbind         -termguicolors      +visualextra
+clipboard          +diff               +find_in_path       +lambda             +mouse              +persistent_undo    +signs              -tgetent            +viminfo
         fichier vimrc système : "$VIM\vimrc"
     fichier vimrc utilisateur : "$HOME\_vimrc"
 2me fichier vimrc utilisateur : "$HOME\vimfiles\vimrc"
 3me fichier vimrc utilisateur : "$VIM\_vimrc"
      fichier exrc utilisateur : "$HOME\_exrc"
  2me fichier exrc utilisateur : "$VIM\_exrc"
        fichier gvimrc système : "$VIM\gvimrc"
    fichier gvimrc utilisateur : "$HOME\_gvimrc"
2me fichier gvimrc utilisateur : "$HOME\vimfiles\gvimrc"
3me fichier gvimrc utilisateur : "$VIM\_gvimrc"
 fichier de valeurs par défaut : "$VIMRUNTIME\defaults.vim"
          fichier menu système : "$VIMRUNTIME\menu.vim"
Compilation : cl -c /W3 /nologo  -I. -Iproto -DHAVE_PATHDEF -DWIN32  -DFEAT_CSCOPE -DFEAT_NETBEANS_INTG -DFEAT_JOB_CHANNEL   -DFEAT_XPM_W32   -DWINVER=0x0501 -D_WIN32_WINNT=0x0501  /Fo.\ObjGXOLYHTRi386/
/Ox /GL -DNDEBUG  /Zl /MT -DFEAT_OLE -DFEAT_MBYTE_IME -DDYNAMIC_IME -DFEAT_GUI_W32 -DFEAT_DIRECTX -DDYNAMIC_DIRECTX -DDYNAMIC_ICONV -DDYNAMIC_GETTEXT -DFEAT_TCL -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"tcl86.dl
l\" -DDYNAMIC_TCL_VER=\"8.6\" -DFEAT_PYTHON -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"python27.dll\" -DFEAT_PYTHON3 -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"python35.dll\" -DFEAT_PERL -DPERL_IMPLICIT_CONT
EXT -DPERL_IMPLICIT_SYS -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl524.dll\" -DFEAT_RUBY -DDYNAMIC_RUBY -DDYNAMIC_RUBY_VER=22 -DDYNAMIC_RUBY_DLL=\"msvcrt-ruby220.dll\" -DFEAT_HUGE /Fd.\ObjGXOLYHTRi386/ /Zi
Édition de liens : link /RELEASE /nologo /subsystem:windows /LTCG:STATUS oldnames.lib kernel32.lib advapi32.lib shell32.lib gdi32.lib  comdlg32.lib ole32.lib uuid.lib /machine:i386 gdi32.lib version.lib
  winspool.lib comctl32.lib advapi32.lib shell32.lib  /machine:i386 /nodefaultlib libcmt.lib oleaut32.lib user32.lib     /nodefaultlib:python27.lib /nodefaultlib:python35.lib   "E:\tcl\lib\tclstub86.lib"
 WSock32.lib xpm\x86\lib\libXpm.lib /PDB:gvim.pdb -debug
                

Edit : upgraded vim to latest aviable version ( http://www.vim.org/download.php#pc ) no luck.

ledshark24 avatar Jun 08 '17 09:06 ledshark24

I just downloaded the latest Grammalecte 0.5.17 and it works fine for me with Vim-8.628 on Linux and the latest vim grammalecte plugin from github (fffc6762c1929bd17eb1dfce966d609df4658245). I'll have to spend time later trying to reproduce it when I find a Windows box.

Just to be sure: python3 is in your PATH, right?

Something else worth checking: what is the output of this vim command? :set shell?

dpelle avatar Jun 08 '17 10:06 dpelle

I should have time to try the vim-Grammalecte plugin on a Windows 7 machine this coming weekend.

In the mean time, something worth trying: you could hard-code the full path of python3 (as an experiment) in this line in plugin/Grammalecte.vim:

let l:grammalecte_cmd = 'python3 ' . s:grammalecte_cli_py

dpelle avatar Jun 09 '17 08:06 dpelle

Hi, Things seems to progress : I changed it to

let l:grammalecte_cmd = '' . s:grammalecte_cli_py

and it worked fine cli client seems to be executed (I have testfile.res.txt) in my local temp dir.

The plugin fails to fetch the json data now :/

As I understand it Json data is exepected to be a return of the cli call but in windows -f and -ff are similar i.e. the json data is in the TMP.res.txt. only.

sadly I am not familiar enough with vimscript to fetch a read of a different file by myself (more specificity to set a variable to the TMP.res.txt and then fetch its content to l:errors) ...

By the way, the plugin does rm the tempfile but not the .res.txt tempfile if I am not mistaken this is a ramification off the -f == -ff under windows.

ledshark24 avatar Jun 12 '17 10:06 ledshark24

Hi, Got back to this ... mess of mine Finaly got this working, not without problems ... I had to modify Grammalecte.vim heavily...

  1. had to create a new variable to read the .res.txt temp file : let l:tmpjson = substitute(l:tmpfilename,".tmp",".res.txt","")
  2. had to modify l:grammalecte_cmd to change the phyton interpreter let l:grammalecte_cmd = 'python ' . s:grammalecte_cli_py
  3. had to read .res.txt file file to a variable and pass it to json_decode (harder said than done)
  if filereadable(l:tmpjson)
	  echo "lecture"
	let l:errors_json_raw=readfile(l:tmpjson)
	let l:errors_json=''
	for l in l:errors_json_raw
		let l:errors_json.=l
	endfor
  else
	  echo l:tmpjson ." not readable"
  endif

for whatever reason readfile was returning a list I had to loop on its items to get a passable json all temps files are not deleted with this but it is a start, encoding is a problem as well...

but It doses work ! image

ledshark24 avatar Jan 29 '19 17:01 ledshark24

Thanks @ledshark24 for digging into this. Not having Windows, I was in the dark as I could not reproduce the issue. I understand that it's not not entirely right on Windows yet with your fix (e.g. encoding issue). I hope to look at your changes soon.

dpelle avatar Jan 29 '19 22:01 dpelle

some news : the display errors I got are not encoding related but the font I use does not support exponent chars...

ledshark24 avatar Jan 30 '19 12:01 ledshark24

Hi, I put some more polish to this fix : 0001-FIX-Issue-6-windows-compatibilty.patch.txt

  1. new config item g:grammalecte_py_bin to specify python binary
  2. new var l:tmpjson for the json error file
  3. modified l:grammalecte_cmd to accommodate 1. and the option -ff for constancy across platforms
  4. reading json file to l:errors_json
  5. deleting the json error file

I could only test this fix on my windows machine though, and since I am fairly new to Vim scripts, I can offer little more.

ledshark24 avatar Jan 31 '19 10:01 ledshark24